Apache Answer
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- 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.
- 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.
- 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.
- 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`).
- 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 SVGDiagram 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- 01
One static Go binary that embeds the React UI
The Makefile builds
cmd/answerwithCGO_ENABLED=0and static linking, and the Dockerfile adds thebindatatag so the compiledui/buildis embedded throughui/static.go. Deploying Answer means shipping a single executable plus a/datadirectory. - 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. Theinternal/migrationspackage keeps schema changes database-agnostic. - 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.shcompiles the plugins listed inscript/plugin_listinto the binary at image build time. - 04
Compile-time wiring with Google Wire and a layered internal/ tree
Instead of a runtime DI container,
cmd/wire.godeclares providers forinternal/controller,service,repoand friends andwiregenerates the constructor graph, which keeps startup explicit and testable. - 05
AI and MCP built into the core rather than bolted on
go.modpullssashabaranov/go-openaiandmark3labs/mcp-go, and the plugin package includesagent.goandvector_search.go, so assistants and semantic search are first-class extension points. - 06
Governed as an Apache Software Foundation project
.asf.yaml, thecheck-asf-header.ymlworkflow andlicenserc.tomlenforce ASF conventions; the license is Apache-2.0 and the Go module path isgithub.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 buildproduces a static binary (CGO_ENABLED=0,-extldflags -static) stamped with version, revision and build time;make universalcreates a macOS universal binary withlipo.make lintruns golangci-lint v2 and the ASF header check;make testruns the repository tests, which useory/dockertestfor real database containers.- CI:
lint.yml,check-asf-header.yml,build-image-for-*.ymlandbuild-binary-for-release.yml;.goreleaser.yamlpublishes release binaries and.gitlab-ci.ymlmirrors the pipeline. - The Dockerfile builds on
golang:1.25-alpine(installing Node and pnpm to compileui/), runs the plugin build script, and copies the binary into a minimalalpineimage withdumb-init,sqliteand timezone data. It exposes port 80 and declares/dataas 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
- go.mod (gin, wire, lib/pq, mysql, mcp-go, go-openai, cron)
- ui/package.json (react, react-bootstrap, zustand, swr, codemirror, pnpm)
- Dockerfile (golang alpine builder, sqlite tags, plugin build)
- Makefile (static build, wire, swag, mockgen, golangci-lint)
- plugin/ (plugin interfaces)
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
[](https://stackitfast.com/project/apache-answer)Paste it into your README. It shows your current stack and links to this page.
Scaffold it with your agent
Paste this prompt into Claude Code, Cursor, Windsurf or AGY to start a project with Apache Answer's architecture.
- 1Copy the promptThe full markdown spec, with every layer and decision.
- 2Open your AI toolClaude Code, Cursor, Windsurf or Copilot, in a new repo.
- 3Paste and scaffoldUse it as the first instruction; review before you ship.
# 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.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.
Similar architectures
- GotifyClassicSelf-Hosted Real-Time Push Server · 2-5 PeopleShares Go · TypeScript · React
- StrapiClassicHeadless CMS · 20+ peopleShares TypeScript · React · PostgreSQL
- GiteaClassicLightweight Self-Hosted Git Service · 20+ peopleShares Go · TypeScript · SQLite
- AutheliaClassicAuthentication & SSO Proxy Companion · 6-20 PeopleShares Go · React · TypeScript
- PrismaClassicNext-Generation Node.js & TypeScript ORM · 1M+ MAUShares TypeScript · PostgreSQL · MySQL
- Payload CMSHybridNext.js-Native Headless CMS & App Framework · 6-20 peopleShares TypeScript · React · PostgreSQL