Skip to content
STACK IT FAST

Apache Answer

Curated OSSClassicQ&A & Developer Knowledge Community6-20 People

Audited from github.com/apache/answer

Apache Answer is an open-source Q&A platform for communities, help centers and internal knowledge bases, delivered as a single Go binary with an embedded React UI and a Go plugin system.

Language
Go
Database
MySQL
Hosting
Docker
License
Apache-2.0
Running for
2 years
Team
6-20 People

Why this architecture

A statically linked Go binary that embeds its React UI and supports SQLite, MySQL or PostgreSQL keeps deployment to one container, while typed plugin interfaces extend auth, storage, search and AI without forking.

Tech stack by layer

10 technologies · audited Sep 17, 2026
Frontend & UI
  • ReactSingle-page admin and community UI under `ui/`, routed with `react-router-dom`, state in Zustand and SWR for data.
  • TypeScriptThe whole `ui/` package is TypeScript with an Airbnb-style ESLint setup.
  • BootstrapUI kit via `react-bootstrap`, `bootstrap` and `bootstrap-icons`; styles in SCSS.
  • Create React AppBuilt with `react-scripts` customised through `react-app-rewired`/`customize-cra` (`ui/config-overrides.js`).
  • CodeMirrorMarkdown editor for questions and answers (`@codemirror/lang-markdown`), rendered with `marked`.
  • i18nextFrontend translations backed by the `i18n/` YAML catalogue synced through Crowdin.
Backend & APIs
  • GoSingle binary (`cmd/answer`) on Go 1.25; layered `internal/` packages for controller, service, repo, entity, router and migrations.
  • GinHTTP framework (`gin-gonic/gin`) with Brotli compression and `go-playground/validator` for request validation.
  • Google WireCompile-time dependency injection; the graph is declared in `cmd/wire.go` and generated into `cmd/wire_gen.go`.
  • SwaggerAPI docs generated by `swag` into `docs/swagger.json` and `docs/swagger.yaml` during `make generate`.
  • Model Context Protocol`mark3labs/mcp-go` lets the server expose an MCP interface; `go-openai` backs AI features and `plugin/agent.go` defines agent plugins.
Data & Persistence
  • MySQLSupported database via `go-sql-driver/mysql`.
  • PostgreSQLSupported database via `lib/pq`.
  • SQLiteDefault zero-dependency database; the Docker image is built with the `sqlite sqlite_unlock_notify` tags and ships the `sqlite` CLI.
Infrastructure & Deploy
  • DockerTwo-stage image: `golang:1.25-alpine` builds the binary and UI, a plain `alpine` image runs it with a `/data` volume on port 80.
  • KubernetesHelm chart under `charts/` for cluster installs.
  • GoReleaserCross-platform release binaries (`.goreleaser.yaml`, `build-binary-for-release.yml`).
Tooling, Testing & Ops
  • GitHub ActionsLint, ASF license-header check and image/binary builds for releases and tests; a GitLab CI file also exists.
  • golangci-lintGo linting pinned in the Makefile (v2); `mockgen` generates test doubles.
  • pnpmFrontend package manager (`pnpm@9.7.0`, Node >= 20) installed inside the Docker build to compile the UI.

Apache Answer architecture diagram

Open SVG
Apache Answer architecture diagramCommunity UI → answer binary (REST); AI agents → answer binary (MCP); answer binary → Database (repo layer); answer binary → Plugins (hooks); answer binary → AI features (answers · search); AI features → LLM provider (API)CLIENTSSERVICESWORKERS & JOBSDATA & STORAGEEXTERNALCommunity UIReact · ZustandAI agentsMCPanswer binaryGo · Gin · WirePluginstyped Go pluginsAI featuresgo-openaiDatabaseSQLite / MySQL / PostgresLLM providerOpenAI-compatibleRESTMCPhooksanswers · searchrepo layerAPI
How the main components of Apache Answer connect, drawn from the audited repository.
Diagram as text
  • Community UI (React · Zustand) → answer binary (Go · Gin · Wire): REST
  • AI agents (MCP) → answer binary (Go · Gin · Wire): MCP
  • answer binary (Go · Gin · Wire) → Database (SQLite / MySQL / Postgres): repo layer
  • answer binary (Go · Gin · Wire) → Plugins (typed Go plugins): hooks
  • answer binary (Go · Gin · Wire) → AI features (go-openai): answers · search
  • AI features (go-openai) → LLM provider (OpenAI-compatible): API

Key architectural decisions

6 decisions
  1. 01

    One static Go binary that embeds the React UI

    The Makefile builds cmd/answer with CGO_ENABLED=0 and static linking, and the Dockerfile adds the bindata tag so the compiled ui/build is embedded through ui/static.go. Deploying Answer means shipping a single executable plus a /data directory.

  2. 02

    Bring your own database: SQLite, MySQL or PostgreSQL

    Drivers for all three are in go.mod, and the default image is compiled with SQLite tags so a trial needs no external service. The internal/migrations package keeps schema changes database-agnostic.

  3. 03

    Extension through a typed Go plugin system

    The plugin/ package defines interfaces for cache, captcha, CDN, connectors (OAuth), embeds, filters, importers, KV storage, notifications, parsers, render, reviewer, search, sidebar, storage, user center and vector search. script/build_plugin.sh compiles the plugins listed in script/plugin_list into the binary at image build time.

  4. 04

    Compile-time wiring with Google Wire and a layered internal/ tree

    Instead of a runtime DI container, cmd/wire.go declares providers for internal/controller, service, repo and friends and wire generates the constructor graph, which keeps startup explicit and testable.

  5. 05

    AI and MCP built into the core rather than bolted on

    go.mod pulls sashabaranov/go-openai and mark3labs/mcp-go, and the plugin package includes agent.go and vector_search.go, so assistants and semantic search are first-class extension points.

  6. 06

    Governed as an Apache Software Foundation project

    .asf.yaml, the check-asf-header.yml workflow and licenserc.toml enforce ASF conventions; the license is Apache-2.0 and the Go module path is github.com/apache/answer.

How Apache Answer is built

How Apache Answer is structured

The repository is a Go module (github.com/apache/answer, Go 1.25) with the frontend checked in under ui/. The Go side follows a conventional layered layout: cmd/answer is the entry point, cmd/wire.go declares the dependency graph, and internal/ splits into router, controller and controller_admin, service, repo, entity, schema, migrations, install and base. Reusable helpers live in pkg/ (checker, converter, encryption, gravatar, htmltext, token, uid, writer) and the extension surface in plugin/.

ui/ is a pnpm project (pnpm@9.7.0, Node >= 20) with ui/static.go embedding the production build into the Go binary. The i18n/ directory holds one YAML file per locale (more than forty), managed through crowdin.yml.

Frontend

The UI is a React and TypeScript single-page app built with react-scripts and customised through react-app-rewired (ui/config-overrides.js). Routing uses react-router-dom, client state uses Zustand, and data fetching uses SWR over axios. The component layer is react-bootstrap with bootstrap-icons and SCSS. Questions and answers are written in a CodeMirror markdown editor and rendered with marked; react-helmet-async manages page metadata for SEO and next-share provides share buttons. Translations come from i18next/react-i18next.

Backend & APIs

The server is Gin with Brotli compression, go-playground/validator for input validation and goccy/go-json for serialisation. Google Wire generates the constructor graph at build time (make generate installs wire, swag and mockgen). REST endpoints are documented with Swagger (docs/swagger.yaml). Scheduled work runs with robfig/cron, IDs come from bwmarrin/snowflake, user content is sanitised with bluemonday, and images are processed with disintegration/imaging and EXIF stripping. AI capabilities use sashabaranov/go-openai, and mark3labs/mcp-go exposes a Model Context Protocol interface.

The plugin/ package is the extension API: interfaces for agent, cache, captcha, cdn, config, connector, embed, filter, importer, kv_storage, notification, parser, render, reviewer, search, sidebar, storage, user_center, user_config and vector_search. script/build_plugin.sh compiles the plugins named in script/plugin_list into the binary during the Docker build.

Data & persistence

Answer targets three databases: SQLite (default, enabled through the sqlite sqlite_unlock_notify build tags), MySQL (go-sql-driver/mysql) and PostgreSQL (lib/pq). Schema changes are versioned in internal/migrations. Uploads are written to /data/uploads in the container, and the i18n catalogue is copied to /data/i18n so it can be edited without rebuilding.

Build, test & deploy

  • make build produces a static binary (CGO_ENABLED=0, -extldflags -static) stamped with version, revision and build time; make universal creates a macOS universal binary with lipo.
  • make lint runs golangci-lint v2 and the ASF header check; make test runs the repository tests, which use ory/dockertest for real database containers.
  • CI: lint.yml, check-asf-header.yml, build-image-for-*.yml and build-binary-for-release.yml; .goreleaser.yaml publishes release binaries and .gitlab-ci.yml mirrors the pipeline.
  • The Dockerfile builds on golang:1.25-alpine (installing Node and pnpm to compile ui/), runs the plugin build script, and copies the binary into a minimal alpine image with dumb-init, sqlite and timezone data. It exposes port 80 and declares /data as a volume.

Self-hosting notes

The README's quick start is a single docker run -d -p 9080:80 -v answer-data:/data apache/answer command; docker-compose.yaml wraps the same service. The Helm chart in charts/ targets Kubernetes. Because the default build uses SQLite, no external database is required to start; production installs typically point configs/config.yaml at MySQL or PostgreSQL.

What to copy (and what not to)

Copy the single-binary-with-embedded-UI packaging if your product is self-hosted by non-specialists: one artifact, one volume, three database options. Copy the interface-based plugin package if you want extensions compiled in rather than loaded dynamically. Be careful copying Create React App in 2026: it still works here because the build is wrapped by react-app-rewired, but new projects will find Vite or a framework easier to maintain.

Sources & repo audit

Audited
Sep 17, 2026
Commit
3b9f137
License
Apache-2.0

Independent analysis of repository at github.com/apache/answer. Spotted an inaccuracy? Use the claim form to request a correction.

Show this stack on your README or website
Tech stack of Apache Answer
[![Tech stack of Apache Answer on STACK IT FAST](https://stackitfast.com/badge/apache-answer.svg)](https://stackitfast.com/project/apache-answer)

Paste it into your README. It shows your current stack and links to this page.

Use this stack

Scaffold it with your agent

Paste this prompt into Claude Code, Cursor, Windsurf or AGY to start a project with Apache Answer's architecture.

  1. 1Copy the promptThe full markdown spec, with every layer and decision.
  2. 2Open your AI toolClaude Code, Cursor, Windsurf or Copilot, in a new repo.
  3. 3Paste and scaffoldUse it as the first instruction; review before you ship.
use-this-stack.md · 61 lines · 8.0 KB
# MISSION: Scaffold "Apache Answer" Production Architecture
You are an expert Senior Staff Software Architect and Full-Stack Engineer. Your mission is to scaffold and implement a production-grade, highly reliable, and modular codebase following the proven architecture of **Apache Answer**.
---
## 1. PROJECT SPECIFICATIONS & BENCHMARK
- **Reference Architecture**: Apache Answer
- **What It Does**: Apache Answer is an open-source Q&A platform for communities, help centers and internal knowledge bases, delivered as a single Go binary with an embedded React UI and a Go plugin system.
- **Domain & Category**: Q&A & Developer Knowledge Community
- **Production Scale**: 6-20 People
- **Development Mode**: CLASSIC
- **Architectural Rationale**: A statically linked Go binary that embeds its React UI and supports SQLite, MySQL or PostgreSQL keeps deployment to one container, while typed plugin interfaces extend auth, storage, search and AI without forking.
- **Live Website Reference**: https://answer.apache.org
- **Source Repository**: https://github.com/apache/answer
---
## 2. PRODUCTION TECH STACK
- **Full Stack Array**: Go, Gin, TypeScript, React, Bootstrap, MySQL, PostgreSQL, SQLite, Docker, Kubernetes
- **Primary Language(s)**: Go, TypeScript
- **License of the reference repo**: Apache-2.0
- **Frontend**: React — Single-page admin and community UI under `ui/`, routed with `react-router-dom`, state in Zustand and SWR for data.; TypeScript — The whole `ui/` package is TypeScript with an Airbnb-style ESLint setup.; Bootstrap — UI kit via `react-bootstrap`, `bootstrap` and `bootstrap-icons`; styles in SCSS.; Create React App — Built with `react-scripts` customised through `react-app-rewired`/`customize-cra` (`ui/config-overrides.js`).; CodeMirror — Markdown editor for questions and answers (`@codemirror/lang-markdown`), rendered with `marked`.; i18next — Frontend translations backed by the `i18n/` YAML catalogue synced through Crowdin.
- **Backend & APIs**: Go — Single binary (`cmd/answer`) on Go 1.25; layered `internal/` packages for controller, service, repo, entity, router and migrations.; Gin — HTTP framework (`gin-gonic/gin`) with Brotli compression and `go-playground/validator` for request validation.; Google Wire — Compile-time dependency injection; the graph is declared in `cmd/wire.go` and generated into `cmd/wire_gen.go`.; Swagger — API docs generated by `swag` into `docs/swagger.json` and `docs/swagger.yaml` during `make generate`.; Model Context Protocol — `mark3labs/mcp-go` lets the server expose an MCP interface; `go-openai` backs AI features and `plugin/agent.go` defines agent plugins.
- **Data & persistence**: MySQL — Supported database via `go-sql-driver/mysql`.; PostgreSQL — Supported database via `lib/pq`.; SQLite — Default zero-dependency database; the Docker image is built with the `sqlite sqlite_unlock_notify` tags and ships the `sqlite` CLI.
- **Infrastructure & deploy**: Docker — Two-stage image: `golang:1.25-alpine` builds the binary and UI, a plain `alpine` image runs it with a `/data` volume on port 80.; Kubernetes — Helm chart under `charts/` for cluster installs.; GoReleaser — Cross-platform release binaries (`.goreleaser.yaml`, `build-binary-for-release.yml`).
- **Tooling, testing & ops**: GitHub Actions — Lint, ASF license-header check and image/binary builds for releases and tests; a GitLab CI file also exists.; golangci-lint — Go linting pinned in the Makefile (v2); `mockgen` generates test doubles.; pnpm — Frontend package manager (`pnpm@9.7.0`, Node >= 20) installed inside the Docker build to compile the UI.
---
## 3. KEY ARCHITECTURAL DECISIONS (audited from https://github.com/apache/answer @ 3b9f137)
1. **One static Go binary that embeds the React UI**: The Makefile builds `cmd/answer` with `CGO_ENABLED=0` and static linking, and the Dockerfile adds the `bindata` tag so the compiled `ui/build` is embedded through `ui/static.go`. Deploying Answer means shipping a single executable plus a `/data` directory.
2. **Bring your own database: SQLite, MySQL or PostgreSQL**: Drivers for all three are in `go.mod`, and the default image is compiled with SQLite tags so a trial needs no external service. The `internal/migrations` package keeps schema changes database-agnostic.
3. **Extension through a typed Go plugin system**: The `plugin/` package defines interfaces for cache, captcha, CDN, connectors (OAuth), embeds, filters, importers, KV storage, notifications, parsers, render, reviewer, search, sidebar, storage, user center and vector search. `script/build_plugin.sh` compiles the plugins listed in `script/plugin_list` into the binary at image build time.
4. **Compile-time wiring with Google Wire and a layered internal/ tree**: Instead of a runtime DI container, `cmd/wire.go` declares providers for `internal/controller`, `service`, `repo` and friends and `wire` generates the constructor graph, which keeps startup explicit and testable.
5. **AI and MCP built into the core rather than bolted on**: `go.mod` pulls `sashabaranov/go-openai` and `mark3labs/mcp-go`, and the plugin package includes `agent.go` and `vector_search.go`, so assistants and semantic search are first-class extension points.
6. **Governed as an Apache Software Foundation project**: `.asf.yaml`, the `check-asf-header.yml` workflow and `licenserc.toml` enforce ASF conventions; the license is Apache-2.0 and the Go module path is `github.com/apache/answer`.
---
## 4. NON-NEGOTIABLE ARCHITECTURAL GUARDRAILS
1. **Monorepo & Modular Separation**:
   - Structure as a Turborepo monorepo with strict package boundaries:
     - `apps/web`: Application UI, routing, layouts, and server endpoints.
     - `packages/ui`: Shared design tokens, CSS variables, and Radix UI primitive components.
     - `packages/db`: Database schemas, client singleton, declarative migrations, and seed scripts.
     - `packages/config`: Shared TypeScript, ESLint, and build configurations.
2. **Strict Type Safety & Zero `any` Policy**:
   - Enable `strict: true`, `noImplicitAny: true`, and `strictNullChecks: true`.
   - Validate ALL external inputs, API request bodies, and query parameters with **Zod** schemas before execution.
3. **Frontend & Rendering Guidelines**:
   - Isolate interactive UI state to leaf components. Keep core pages lightweight and performant.
4. **Design System & Aesthetics**:
   - Keep every color, radius, shadow and font in a single token file (CSS variables) and consume tokens everywhere; never hardcode hex values in components.
   - Prefer crisp 1px borders and one subtle shadow scale over blurry default shadows. Pair one sans-serif for body/headings with one monospace for tags, badges, metrics, and code.
5. **Data Layer & Reliability**:
   - Write declarative schema definitions with foreign keys, composite indexes on queried filters, and automated timestamp triggers.
   - Use connection pooling and prepared statements for serverless database execution.
---
## 5. STEP-BY-STEP SCAFFOLDING ROADMAP
- **Phase 1: Workspace & Root Config**: Initialize package manager, monorepo configuration (`turbo.json`, `tsconfig.base.json`, `package.json`).
- **Phase 2: Database Schema & Client**: Set up the data layer (MySQL, PostgreSQL, SQLite): client, connection pool, models, and migration scripts.
- **Phase 3: Design Tokens & UI Primitives**: Build accessible `Button`, `Input`, `Card`, `Badge`, and layout wrappers inside `packages/ui`.
- **Phase 4: Core Application Routes & Handlers**: Implement primary authentication, user session handling, and application routes.
- **Phase 5: Quality Assurance & Build Verification**: Run `tsc --noEmit`, ESLint, Prettier, and smoke test suites to ensure zero compilation or runtime errors.
---
## 6. EXECUTION INSTRUCTIONS
1. Review all specifications, architectural guardrails, and stack choices above.
2. Present the full monorepo directory tree structure.
3. Systematically generate the complete, production-ready codebase according to the 5-phase roadmap above — starting with the root workspace setup, followed by the database schema, UI design system package, and full-stack application routes until the repository is fully scaffolded and ready to run.
Scaffolded something with this prompt?
Would you pick this stack for a q&a & developer knowledge community project?

Frequently asked about Apache Answer

What is Apache Answer built with?

Apache Answer is a Go backend using the Gin HTTP framework with Google Wire for dependency injection, and a React + TypeScript frontend styled with Bootstrap. It supports SQLite, MySQL and PostgreSQL, and ships as a single binary and Docker image with a Helm chart.

Which database does Apache Answer need?

Any one of SQLite, MySQL or PostgreSQL. The official Docker image is compiled with SQLite support, so you can start with no external database and switch to MySQL or PostgreSQL later.

Can I self-host Apache Answer?

Yes. The README documents a one-line docker run with a persistent /data volume, the repository includes a docker-compose.yaml and a Helm chart, and GoReleaser publishes standalone binaries for each platform.

How do plugins work in Apache Answer?

Plugins are Go packages that implement interfaces from the plugin/ package, such as connectors for OAuth login, storage, search, captcha, CDN, notifications or reviewers. They are compiled into the binary by script/build_plugin.sh according to script/plugin_list.

One email a month: new deep dives and stack trends

New source-audited architectures, head-to-head comparisons and the monthly stack report. No spam, unsubscribe anytime.

use-this-stack.md