Recommended stack & delivery plan

A production path from RAG demo to multi-tenant SaaS

This demo runs entirely in the browser. The production build keeps the same answer and citation contract, then adds real embeddings, a Python API, tenant isolation and evals.

6 weeks

MVP timeline

$6.4k–9.4k

MVP estimate

4 LLM steps

Answer path

SOC 2 ready

Security

Reference architecture

Stateless API, queue-based ingestion and a versioned retrieval contract.

Client

Next.js 14 · React · TypeScript · Tailwind

App RouterSSE streamingCitation drawerMobile drawers
HTTPS · SSE

API

FastAPI (Python) · Pydantic · Node worker

Auth + tenant scopeStreaming answersRate limitsOpenAPI
graph invoke

Orchestration

LangGraph agent · retrieval · rerank · citations

Query rewriteHybrid retrieveCross-encoder rerankGrounded prompt
read / write

Data layer

Postgres 16 · pgvector · Redis · S3

Tenant RLSVector indexAnswer cacheRaw documents

Model providers

OpenAI · Anthropic · fallback routing

text-embedding-3-smallGPT-4o miniClaude SonnetCost guard
Deployment:ECS Fargate·RDS Postgres·ElastiCache·S3 + CloudFront·GitHub Actions·LangSmith / OpenTelemetry

MVP delivery plan

Six weekly milestones. Each week ends with a deployed, testable increment.

Week 1FoundationsRepo, CI/CD, auth, Postgres + pgvector, S3 ingestion skeleton, staging environment.
Week 2IngestionPDF/DOCX parsing, chunking, embeddings, backfill job, document status tracking.
Week 3RetrievalHybrid search (vector + keyword), reranker, citation contract, golden-question evals.
Week 4Agent & APILangGraph graph, streaming FastAPI endpoint, guardrails, rate limits, tracing.
Week 5Product UIWorkspace chat, document manager, source drawer, workspace switching, onboarding.
Week 6LaunchSecurity review, load test, UAT, production deploy, runbook and handover.
Phase 2 · Weeks 7–14Full productBilling, multi-tenancy, SSO, eval dashboard, observability and scale work.

Cost estimate

MVP build160–200 h
At $40/h$6,400–8,000
Infra + tokens~$80–120 / mo
Phase 2Scoped after MVP

Estimate assumes 1,000 queries per day and a single-region AWS deployment.

Phase 2 scope

  • Stripe billing and plan limits
  • Multi-tenant roles and SSO
  • Eval dashboard and regression gates
  • Observability and alerting
  • Queue-based ingestion at scale
  • SOC 2 readiness evidence

How I use AI tools

Claude Code

Scaffolding, tests, migrations and repetitive refactors. Runs the full test suite before every PR.

Cursor

Faster UI iteration and safe renames across the workspace. Review each diff before commit.

Codex

Parallel spikes such as eval harnesses and provider adapters, kept on short-lived branches.

This demo was built with the same workflow.

Answer contract

Shared by demo and production

Grounded

Every answer sentence carries at least one chunk citation. No citation, no claim.

Refuses low confidence

A top rerank score below 0.08 returns a refusal instead of a guess.

Measured

Tokens, cost, latency and retrieval scores are logged for every request.