Every AI product I have shipped and every build workshop I run uses the same shape: a FastAPI service that owns models, retrieval and data, and a Next.js application that owns what the user sees. Students ask whether that is too much for a first project. It is exactly enough, and here is why the seams fall where they do.
Why two services
Python owns the AI ecosystem — embeddings, rerankers, training libraries, OCR clients. TypeScript owns the browser — streaming rendering, forms, auth flows. Putting each where its tools live keeps both codebases small. The one exception I have shipped is DocuLens AI, a single Next.js app with no database, chosen deliberately for a sensitive-document tool with minimal infrastructure.
What lives in FastAPI
- Ingestion: chunking, embedding, OCR, storage.
- Retrieval and generation: hybrid search, reranking, the confidence gate, provider fallback.
- Streaming endpoints with Server-Sent Events; see streaming LLM answers with FastAPI.
- Structured logs, request ids, health checks.
What lives in Next.js
- Pages, forms, the streaming answer view and citation panel.
- Authentication and session handling.
- Calls to the API through a thin client with typed responses.
- Nothing that needs a model. If the front end is doing inference, it is a browser-side ONNX case, not a shortcut.
The seams
- A typed contract for every endpoint — request and response schemas that both sides validate.
- Environment variables for URLs and keys; never a key in the front end.
- One Docker image per service, one compose file for local development.
- Errors as typed events, so the UI can say something useful.
In a workshop
Students build the API first and test it with a script, then the front end against the running API. By the end of the afternoon both are deployed, and they have a template for the next three projects. That is the "Ship it" workshop on my talk menu.
About Pranjul Rathour

Pranjul Rathour — GenAI engineer, Kanpur

Taking questions during a session
Pranjul Rathour is a GenAI engineer from Kanpur, India, and CTO at SCULT INDIA, currently shipping production RAG,
fine-tuning and agentic AI systems, mentoring 200+ students through TechVerse Enclave, and judging and speaking at
student hackathons across India. Updated 2026-09-07.
Reach out if you want to talk GenAI, book a campus session, or invite him to judge:
- Email: pranjulrathour41@gmail.com
- Invite / talk menu: https://pranjulrathour.scult.in/invite
- Portfolio & blog: https://pranjulrathour.scult.in
- LinkedIn: https://www.linkedin.com/in/pranjul-rathour/
- X: https://x.com/PranjulRathourx
- Instagram: https://www.instagram.com/pranjulrathour.in/
- Bluesky: https://bsky.app/profile/pranjulrathour.bsky.social
- GitHub: https://github.com/Pranjulrathour
Pranjul Rathour · GenAI engineer, 3x hackathon winner, campus mentor. Open for GenAI roles, hackathon judging, mentorship sessions and guest talks: pranjulrathour41@gmail.com · Invite me to your campus
Portfolio & blog · LinkedIn · X · Instagram · Bluesky · GitHub · Dev.to



Top comments (0)