How srirammurugesan/fastapiapp works
Purpose and entry points
TalentSpark is a full-stack AI job portal: authenticated users manage companies/jobs, upload resumes, perform semantic job discovery and matching, analyze resumes, and use a career chatbot. Backend startup is backend/app/main.py (uvicorn app.main:app); frontend startup is frontend/talentspark/src/main.tsx, which mounts frontend/talentspark/src/App.tsx.
Client application
The React/TypeScript Vite client provides login/registration, job matching, resume analysis, and chat views. Pages call the FastAPI REST API through domain-specific service clients, keeping UI concerns separate from API transport and domain types.
• frontend/talentspark/src/App.tsx
• frontend/talentspark/src/Services/api.ts
• frontend/talentspark/src/pages/JobMatch.tsx
API composition and request boundary
FastAPI’s application entry point registers routers and cross-cutting logging/middleware. Router modules are the HTTP boundary: they validate requests with Pydantic schemas, apply authorization dependencies where required, invoke persistence/AI/storage services, and return API responses. Swagger is exposed by FastAPI.
• backend/app/main.py
• backend/routers/auth.py
• backend/routers/rag.py
Identity and authorization
Authentication registers users with hashed passwords, logs them in to receive JWTs, and protects selected routes through OAuth2/JWT dependencies and RBAC (admin, hr, student). Authorization is primarily enforced at backend route boundaries rather than trusted to the frontend.
• backend/routers/auth.py
• backend/utils/oauth2.py
• backend/utils/token.py
Relational job-domain persistence
SQLAlchemy async models represent users, companies, jobs, and resume metadata. API CRUD routers operate against PostgreSQL—documented as Supabase-hosted locally—with Alembic managing schema evolution. Jobs and companies are the source data for vector indexing; resume records link uploaded objects to users.
• backend/database.py
• backend/models/job.py
• backend/alembic/versions/250d9ca9979c_initial_migrations.py
Resume object-storage flow
A logged-in user uploads a resume through the S3 router. The storage service sends the file to AWS S3 when configured, with a documented local fallback, then resume-related persistence can retain filename, object URL, and owning user. This isolates cloud-storage mechanics from request handlers.
• backend/routers/s3_demo.py
• backend/services/s3_service.py
• backend/models/resume.py
AI, retrieval, and conversational flows
RAG endpoints index PostgreSQL job content into Qdrant using embeddings, perform semantic retrieval, and use retrieved job context for answers, resume analysis, and job-match scoring. Qdrant is an external vector-store boundary. The chat router delegates session-memory career conversations to LangChain and Groq Llama; resume-oriented generation uses Gemini. These API-key-backed services are isolated from routers.
• backend/services/rag_service.py
• backend/services/qdrant_service.py
• backend/services/langchai_service.py
Runtime and deployment
The system runs as separate backend and frontend containers coordinated by Compose. Backend runtime is Python/FastAPI with async PostgreSQL access; frontend is Node-built React/Vite. External infrastructure comprises PostgreSQL/Supabase, Qdrant Cloud, AWS S3, Groq, and Google Gemini; deployment guidance targets AWS Elastic Beanstalk.
• docker-compose.yml
• backend/Dockerfile
• frontend/talentspark/Dockerfile
Components 22
React client
- React/Vite app · Authenticated portal views for jobs, resumes, and chat.
frontend/talentspark/src/App.tsx - API service clients
frontend/talentspark/src/Services/api.ts - Job matching view
frontend/talentspark/src/pages/JobMatch.tsx
FastAPI backend
- FastAPI application · Registers routers, middleware, and Swagger.
backend/app/main.py - Auth routes · Registration and login endpoints.
backend/routers/auth.py - RAG routes · Retrieval, analysis, and matching request boundary.
backend/routers/rag.py - JWT and RBAC · OAuth2/JWT validation and role enforcement.
backend/utils/oauth2.py - Token service
backend/utils/token.py - Resume upload routes
backend/routers/s3_demo.py
Data and AI services
- Job-domain models · Users, companies, jobs, and resume metadata.
backend/models/job.py - PostgreSQL / Supabase
backend/database.py - Schema migrations
backend/alembic/versions/250d9ca9979c_initial_migrations.py - Object storage service · Uses AWS S3 with a local fallback.
backend/services/s3_service.py - AWS S3
- RAG service · Indexes jobs and grounds matching and resume generation.
backend/services/rag_service.py - Qdrant adapter
backend/services/qdrant_service.py - Qdrant Cloud
- Career chat service · LangChain session memory with Groq Llama; resume generation uses Gemini.
backend/services/langchai_service.py - Groq and Gemini
Runtime
- Compose deployment · Runs separate frontend and backend containers.
docker-compose.yml - Backend container
backend/Dockerfile - Frontend container
frontend/talentspark/Dockerfile
Connections 24
- React/Vite app → API service clients: uses
- Job matching view → API service clients: calls through
- API service clients → FastAPI application: REST API
- FastAPI application → Auth routes: registers
- FastAPI application → RAG routes: registers
- FastAPI application → Resume upload routes: registers
- Auth routes → JWT and RBAC: protects routes
- JWT and RBAC → Token service: validates JWTs
- Auth routes → Job-domain models: persists users
- RAG routes → RAG service: invokes
- RAG routes → Career chat service: delegates chat
- Resume upload routes → Object storage service: uploads via
- Object storage service → AWS S3: stores files
- Resume upload routes → Job-domain models: records resume metadata
- Job-domain models → PostgreSQL / Supabase: maps to
- Schema migrations → PostgreSQL / Supabase: migrates schema
- RAG service → PostgreSQL / Supabase: indexes job content
- RAG service → Qdrant adapter: retrieves through
- Qdrant adapter → Qdrant Cloud: queries
- Career chat service → Groq and Gemini: generates with
- Compose deployment → Backend container: runs
- Compose deployment → Frontend container: runs
- Backend container → FastAPI application: starts
- Frontend container → React/Vite app: serves