Frontend (React)¶
The production UI is the Next.js/React frontend in frontend/, backed by the FastAPI service through Next.js server routes.
Architecture boundary¶
- Browser requests go to the frontend domain and Next.js routes under
/api/*. - Next.js server routes proxy requests to FastAPI using
RAG_API_URL(frontend/src/app/api/_proxy.ts). - Proxy routes attach
x-api-keywhenRAG_API_KEYis set. - Auth is enforced on both page render and proxy routes:
- unauthenticated page requests redirect to
/login - unauthenticated proxy requests return
401
Local development¶
Prerequisites¶
- Node.js 20+
pnpm- FastAPI reachable from the frontend host (default:
http://localhost:8000)
1) Install and configure¶
Required in frontend/.env.local:
RAG_API_URL=http://localhost:8000AUTH_SECRET=<random hex>AUTH_USERS=<username:scrypt:salt_hex:hash_hex>
Generate a random AUTH_SECRET:
| PowerShell | |
|---|---|
Generate one AUTH_USERS entry:
| PowerShell | |
|---|---|
Optional values are documented in:
frontend/.env.exampledeploy/.env.DOKPLOY.example
2) Run locally¶
Open http://localhost:3000, sign in, then run retrieval/synthesis/chat flows.
Build and quality checks¶
Deployment notes¶
- Frontend service runs on container port
3000(deploy/docker-compose.yml). - Domain routing should target the
frontendservice. - In container networking, set
RAG_API_URL=http://api:8000. - Do not call
http://api:8000directly from the browser; keep browser traffic on frontend routes (/api/*). - Keep
AUTH_SECRETandAUTH_USERSserver-side only.