Architecture
BrowserNginxNext.jsFastAPIMongoDB + Redis
The problem
The team needed separate, repeatable environments and reliable routing between a Next.js front end, a FastAPI backend and supporting services.
Approach
- Set up Dev / QA / Prod environments with Nginx reverse proxy per environment.
- Split routing cleanly between Next.js internal routes and FastAPI endpoints.
- Role-based access for admin, clinical, front-desk and billing staff.
- Diagnosed a production 502 caused by large JWT headers and tuned Nginx proxy buffers.
Outcome
- Consistent promotion path from Dev to QA to Prod.
- Root-caused and fixed an admin-only outage at the proxy layer.