CareerQ v2: Node.js Backend Service with TypeScript and MongoDB

I rebuilt CareerQ from scratch. Not a refactor. A complete restart. The original was a tightly coupled Next.js full-stack app built while I was still learning. It worked, but the backend had no identity of its own. Everything was tangled with the frontend. So I separated them. CareerQ v2 is a backend-only Node.js service. No framework opinions. No frontend pulling the architecture in two directions. Here is what the new architecture looks like and why I made each decision: Express.js + TypeScript strict mode No any types. No shortcuts. Every input validated at the boundary before it reaches the service layer. MongoDB for LLM response storage LLM outputs are unpredictable JSON. A flexible document store handles this without fighting schema migrations every time the AI response shape changes. Zod for runtime validation TypeScript catches compile-time errors. Zod catches what TypeScript cannot - malformed requests at runtime. Both layers active on every endpoint. Layered architecture: Routes -> Controllers -> Services -> Models Each layer has one job. Controllers do not touch the database. Services do not know about HTTP. Clean separation makes the codebase testable and replaceable. JWT auth with bcrypt password hashing Stateless authentication. Tokens expire. Passwords never stored in plain text. Centralized error handling One error middleware handles everything - Zod failures, JWT errors, DB errors, LLM parsing failures. No scattered try-catch blocks returning inconsistent response shapes. Paginated interview history Sortable, configurable page size, returns total count and page metadata. Clients never have to guess what is on the next page. The image attached is the actual API response - real AI-generated interview questions coming back from the live service. What is coming next: SSE streaming so LLM tokens arrive in real-time instead of a single blocking response. Redis-backed rate limiting per user on LLM endpoints. Live API: https://lnkd.in/gNcx32et GitHub: https://lnkd.in/gStKFJ3C Building in public. Backend only from here. #NodeJS #TypeScript #BackendDevelopment #LLM #SystemDesign #AI #GenrativeAI #Learning #Growth

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories