TalentSync

AI resume builder and ATS optimizer for job seekers. Tailored resumes, outreach, and interview prep from one profile.

Architecture overview

TalentSync runs as three Compose services: Next.js, FastAPI, and PostgreSQL.

  • Frontend: Next.js application with TypeScript, Prisma ORM, and PWA support
  • Backend: FastAPI microservice implementing route-based APIs and LangChain integrations
  • Infrastructure: Docker Compose configurations for local and production environments

Building blocks#

  • Frontend (Next.js)
  • Built with React and TypeScript, styled with Tailwind CSS
  • Authentication via Google OAuth on FastAPI (ts_access_token). NextAuth is gone.
  • ORM via Prisma targeting PostgreSQL
  • PWA enabled for offline-capable experiences
  • Backend (FastAPI)
  • Microservice exposing REST endpoints under /api/v1 and /api/v2
  • Centralized middleware for CORS, request ID tracing, and request/response logging
  • LangChain integration for AI/ML workflows and LLM orchestration
  • Containerized with Python 3.13 slim image
  • AI/ML Service (LangChain)
  • Provider-agnostic LLM factory supporting OpenAI, Anthropic, Google Gemini, Ollama, OpenRouter, and DeepSeek
  • JSON parsing helpers for structured LLM outputs
  • Database (PostgreSQL)
  • Prisma schema defines core entities: User, Role, Resume, Analysis, Interview, and related request/response entities
  • Migrations managed via Prisma CLI

How it fits together#

The system follows a classic three-tier pattern :

  • Presentation Layer: Next.js frontend serving dynamic UI and handling authentication
  • Application Layer: FastAPI backend implementing business logic and integrating AI/ML
  • Data Layer: PostgreSQL storing user profiles, resumes, analyses, and AI-generated artifacts

Frontend (Next.js) authentication and routing#

  • Authentication
  • Google OAuth on FastAPI. getSession() verifies ts_access_token with BACKEND_JWT_SECRET and loads Prisma User.
  • Client useSession() hits /api/v1/auth/me. NextAuth is gone.
  • Routing
  • App Router. BFF under app/api. Rewrite /api/v1/:path* to FastAPI.
  • proxy.ts presence-checks the access cookie.
  • Database Integration
  • Prisma client uses DATABASE_URL for public.
  • Backend Alembic owns talentsync_backend.

Backend (FastAPI) API surface and middleware#

  • API Versioning
  • v1 and v2 route sets expose features like resume analysis, ATS evaluation, cover letter generation, hiring assistant, and tailored resume creation
  • Middleware
  • CORS enabled for configured origins
  • Request ID propagation and request/response logging with structured logs
  • Containerization
  • Python 3.13 slim image, exposed on port 8000, served by uvicorn

AI/ML orchestration with LangChain#

  • LLM Factory
  • Provider-agnostic factory supports OpenAI, Anthropic, Google Gemini, Ollama, OpenRouter, and DeepSeek
  • Temperature handling varies by provider/model
  • JSON Parsing Helpers
  • Reliable extraction and parsing of structured JSON from LLM responses
  • Configuration
  • Environment-driven provider selection and API keys

Database schema and ORM#

  • Entities
  • Role, User, Resume, Analysis, InterviewRequest/Answer, Recruiter, tokens, and accounts/sessions
  • Relationships
  • Users have roles and multiple related entities (resumes, interviews, requests)
  • Analysis is one-to-one with Resume
  • Migrations
  • Prisma migrations executed at container startup in development

Dependencies#

  • Technology Stack Decisions
  • Frontend: Next.js, Prisma, FastAPI cookie session, Tailwind
  • Backend: FastAPI for performance and automatic OpenAPI docs, LangChain for AI/ML orchestration
  • Database: PostgreSQL for relational data persistence
  • Deployment: Docker with multi-stage builds for frontend and backend
  • Third-Party Dependencies (selected)
  • Frontend: next, react, @prisma/client, jose, lucide-react, recharts, mermaid, posthog-js
  • Backend: fastapi, langchain, langchain-google-genai, langchain-openai, langchain-anthropic, cryptography, sse-starlette, httpx, numpy, langgraph, bs4, gitingest, tavily-python, pymupdf, pymupdf4llm
  • Version Compatibility Matrix (selected)
  • Python: 3.13 (backend)
  • Bun: 1.x (frontend build/runtime)
  • Next.js: ^16.1.6
  • Prisma: ^6.19.2
  • PostgreSQL: 16 (image)

Performance#

  • Container Images
  • Multi-stage Docker builds reduce image sizes and attack surface
  • Frontend uses slim base images for production runtime
  • API Design
  • Structured logging and request ID propagation aid observability and debugging
  • Database
  • Prisma schema includes indexes for common query patterns (e.g., Resume index on userId and isMaster)
  • AI/ML
  • Separate faster LLM instance allows cost/performance tuning for lightweight tasks

[No sources needed since this section provides general guidance]

Troubleshooting#

  • Authentication Issues
  • Verify JWT_SECRET / BACKEND_JWT_SECRET and Google OAuth redirect URI
  • NEXTAUTH_* in .env.example is leftover naming
  • Database Connectivity
  • Confirm DATABASE_URL matches PostgreSQL service and schema
  • Run Prisma migrations before starting the frontend in development
  • LLM Configuration
  • Ensure provider-specific API keys are present in environment
  • Check model availability and rate limits for selected provider
  • Networking
  • In development, frontend exposes port 3000; backend listens on 8000
  • Production compose uses external network for reverse proxy integration

Appendix#

Deployment topology and infrastructure#

  • Local Development
  • Docker Compose brings up db, backend, and frontend with shared network
  • Frontend publishes port 3000; backend on 8000
  • Production
  • Multi-stage frontend build with separate migration stage
  • Health checks for PostgreSQL
  • External network integration for reverse proxy

Cross-Cutting concerns#

  • Authentication
  • Google OAuth on FastAPI. Cookies ts_access_token / ts_refresh_token.
  • API Gateway and Load Balancing
  • Reverse proxy network integration in production compose
  • Monitoring and Observability
  • Structured request/response logging in backend
  • PostHog instrumentation configured in frontend