The AnswerFlow is designed for high performance, scale, and extreme flexibility. It leverages the Server Components architecture from Next.js, along with a robust background processing pipeline.
AnswerFlow is structured as a modern monorepo using Turborepo. This allows us to cleanly separate our frontend, background workers, and shared business logic.
At the root of the repository, we maintain the configuration files that orchestrate the entire developer experience, CI/CD pipeline, and deployment strategy.
biome.json: Our master configuration for lightning-fast formatting and linting.
Caddyfile: Reverse proxy configuration for local development routing.
commitlint.config.js: Enforces the Conventional Commits standard (e.g., feat:, fix:) across the repository.
compose.prod.yaml: The secure, production-ready Docker architecture.
compose.yaml: The local Docker development environment (spins up MinIO, Postgres, and Redis).
CONTRIBUTING.md: Guidelines for contributing to the repository.
lefthook.yaml: Our Git hooks manager that automatically formats code and checks types before you commit or push.
LICENSE: The open-source license governing this project.
package.json: Root package configuration and scripts.
pnpm-lock.yaml: Exact dependency versions locked for reproducible builds.
pnpm-workspace.yaml: Defines the boundaries of our monorepo workspaces for the package manager.
README.md: Project overview and getting started instructions.
turbo.json: The Turborepo configuration that orchestrates our build pipelines and aggressive task caching.
AnswerFlow uses a relational database architecture managed by Prisma. Below is a high-level overview of our core data models, followed by the complete schema reference.
To ensure the main Next.js web process stays lightning-fast, we offload heavy lifting (like compiling React email templates and sending Resend emails) to a background queue.
Because AnswerFlow is designed to be provider-agnostic, we support two completely different background worker architectures depending on how you want to deploy:
Perfect for self-hosters running traditional servers or Docker containers.
Event Dispatch: The Next.js API pushes a job payload to the included Dockerized Redis container.
Instant Response: Next.js immediately returns a 200 OK to the user so the UI feels instant.
Dedicated Worker: Our separate apps/worker Node.js process continuously listens to Redis via BullMQ, picks up the job, and executes the heavy lifting in the background.
Perfect for enterprise users deploying to Vercel, AWS, or Cloudflare.
Event Dispatch: Instead of needing a persistent Redis container, the Next.js API pushes the job payload securely to Upstash QStash.
Instant Response: Next.js returns a 200 OK to the user.
Webhook Trigger: QStash acts as the reliable middleman and fires a secure HTTP POST request back to a dedicated Next.js webhook route (e.g., /api/webhooks/worker), executing the job dynamically on a serverless edge function.
This decoupling prevents third-party API latency from ever blocking the user experience, regardless of where you deploy!