# skill-sync-mnnit/skillsync-ai architecture

> Architecture diagram of the GitHub repository skill-sync-mnnit/skillsync-ai, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/skill-sync-mnnit/skillsync-ai
- Repository: https://github.com/skill-sync-mnnit/skillsync-ai

## Overview

1. **Overall shape**
   SkillSync AI is a three-service application with a clear split between user-facing UI, business API, and AI/vector services. The main runtime pieces are:
   - **frontend**: React/Vite SPA
   - **backend**: Node.js/Express API for core product logic
   - **ai-service**: Python/FastAPI service for embeddings, semantic search, moderation, and ranking
   - **workers**: Python batch job runner for scheduled embedding sync

2. **Frontend boundary**
   The React app is the presentation layer only. It contains route-level pages, shared UI components, layout shells, context providers, and client-side stores. Pages such as login, profile, jobs, search, messages, and dashboard talk to backend APIs through the service layer in `frontend/src/services`. Real-time chat state is handled with a socket hook and a chat store, so the UI depends on both HTTP and websocket-style interactions.

3. **Backend boundary**
   The Node.js backend is the system of record for application workflows that are not pure AI: authentication, profiles, jobs, notifications, chat, connections/networking, projects, and internal maintenance endpoints. Its structure is layered:
   - **routes** expose REST endpoints
   - **controllers** translate requests into use cases
   - **services** hold business logic
   - **repositories** isolate persistence access
   - **models** define MongoDB documents
   This separation is important for diagramming because most product flows terminate in backend services, not directly in AI service calls.

4. **AI service boundary**
   The Python FastAPI service is dedicated to machine-assisted features. Its routers expose separate endpoints for:
   - **embed**: generating and managing resume/job embeddings
   - **search**: semantic similarity search over vectors
   - **moderate**: AI moderation of content
   - **analytics**: skill/trend analytics
   Under the routers, service modules implement embedding generation, Pinecone access, ranking, moderation, and explanation logic. This service is intentionally distinct from the Node backend so the vector/LLM stack can evolve independently.

5. **Core data stores and external services**
   Several external systems materially shape the architecture:
   - **MongoDB Atlas** stores users, profiles, jobs, notifications, conversations, connections, and other application entities
   - **Pinecone** stores vector embeddings for semantic discovery
   - **Upstash Redis** supports caching/queue-like behavior and state coordination
   - **Cloudinary** stores uploaded resume PDFs
   - **Gemini + text-embedding-004** provide language model and embedding generation
   - **Gmail SMTP/Nodemailer** handles OTP and email notifications
   These are not interchangeable details; they define the persistence and AI boundaries of the system.

6. **Primary product flows**
   The most important end-to-end flows are:
   - **registration/login/OTP**: frontend → backend auth services → MongoDB + email
   - **resume upload/profile update**: frontend → backend profile services → Cloudinary + MongoDB
   - **embedding generation**: backend/internal trigger or worker → ai-service → Pinecone
   - **semantic search**: frontend search page → backend search controller or internal proxy → ai-service search/ranking → MongoDB/Pinecone results
   - **job posting and moderation**: backend jobs services → ai-service moderation → job publish/store
   - **job matching notifications**: backend jobs/notification services consume matching logic and notify users

7. **Jobs and notifications subsystem**
   Jobs are a major domain area in the backend. The `jobs` controllers/services and `notifications` engine implement posting, applications, expiration, and user alerts. The architecture suggests moderation is part of job publishing, and matching logic likely relies on profile/job skill data. Notifications are a separate subsystem rather than inline with jobs, which makes it easier to diagram event-driven or service-triggered alerts.

8. **Search and talent discovery**
   Search is split across the backend and AI service. The backend exposes search routes/services for request handling and authorization, while the AI service performs semantic retrieval and ranking using Pinecone and embeddings. This means search is not simple database lookup; the architecture depends on vector similarity plus ranking/explanation layers for result quality.

9. **Chat and networking**
   Messaging and connections are first-class backend subsystems. The backend models include chat rooms, chat messages, conversations, and connections, and the frontend has dedicated pages and socket integration. This indicates a mixed real-time and persisted conversation model, with MongoDB as the durable store and a socket service for live updates.

10. **Internal/admin-style integration points**
   There are internal backend routes and middleware around secret verification and embedding status updates. These endpoints are meant for service-to-service or worker-driven operations rather than end-user interaction. In a diagram, they should be shown as private control-plane paths between the backend, workers, and AI service.

11. **Batch processing**
   The `workers/batch_embed.py` script and backend job files imply scheduled offline processing, especially for embeddings and scraped content. This is distinct from request/response traffic: workers likely pull pending items, call the AI service, and update backend state or Pinecone records. The architecture therefore includes both synchronous APIs and asynchronous batch jobs.

12. **Repository structure and engineering boundaries**
   The repo is organized by deployable unit, not just by feature:
   - `frontend` for browser UI
   - `backend` for application APIs and persistence
   - `ai-service` for ML/vector capabilities
   - `workers` for scheduled automation
   Supporting files like Docker Compose, GitHub Actions, and test suites reinforce that these units are intended to run independently but integrate through HTTP, MongoDB, Pinecone, Redis, and Cloudinary.

13. **Security and access control**
   Access control is centralized in the backend through JWT/token verification, role checks, ban checks, and internal-secret verification. The readme also makes clear the platform is invite-only and email-domain restricted. For an architecture diagram, this means authentication/authorization is not just a UI concern; it is enforced in backend middleware and service logic.

14. **Testing and operational seams**
   The presence of unit and integration tests across backend and AI service, plus scripts for validating embedding/Pinecone behavior, shows that the system has strong seams around service boundaries. Those seams map well to architecture boxes: UI tests around frontend state, API tests around backend routes/services, and model/vector tests around the AI layer.

Main entry points: [`backend/src/services`](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/services) (Domain Services), [`ai-service/services`](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/ai-service/services) (Vector Services), [`backend/src/routes`](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/routes) (API Routes), [`ai-service/routers`](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/ai-service/routers) (AI Routers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_frontend_app["SPA Shell<br/>React/Vite UI"]
  node_frontend_services["UI Services<br/>HTTP client"]
  node_frontend_pages["Route Pages<br/>screens"]
  node_frontend_chat["Chat State<br/>client state"]
end

subgraph group_backend["Backend"]
  node_backend_routes["API Routes<br/>Express routes"]
  node_backend_controllers["Controllers<br/>request layer"]
  node_backend_services["Domain Services<br/>business logic"]
  node_backend_repos["Repositories<br/>persistence adapters"]
  node_backend_models[("Mongo Models<br/>documents")]
  node_backend_jobs["Job Runners<br/>async jobs"]
end

subgraph group_ai["AI Service"]
  node_ai_routers["AI Routers<br/>FastAPI routes"]
  node_ai_services["Vector Services<br/>ML logic"]
  node_ai_pinecone[("Vector Store Access<br/>Pinecone repo<br/>[pinecone_repo.py]")]
end

subgraph group_workers["Workers"]
  node_worker_batch["Batch Embed<br/>scheduled worker<br/>[batch_embed.py]"]
end

subgraph group_external["External Systems"]
  node_db[("MongoDB Atlas<br/>primary datastore")]
  node_vector_store[("Pinecone<br/>vector database")]
  node_redis[("Redis<br/>cache/coordination")]
  node_cloudinary[("Cloudinary<br/>media storage")]
  node_email["Gmail SMTP<br/>email delivery"]
  node_gemini(("Gemini API<br/>LLM/embeddings"))
end

node_frontend_app -->|"renders"| node_frontend_pages
node_frontend_app -->|"uses"| node_frontend_services
node_frontend_app -->|"uses"| node_frontend_chat
node_frontend_services -->|"HTTP"| node_backend_routes
node_frontend_chat -->|"realtime/API"| node_backend_routes
node_backend_routes -->|"dispatches"| node_backend_controllers
node_backend_controllers -->|"invokes"| node_backend_services
node_backend_services -->|"reads/writes"| node_backend_repos
node_backend_repos -->|"maps"| node_backend_models
node_backend_models -->|"persisted in"| node_db
node_backend_services -->|"uploads"| node_cloudinary
node_backend_services -->|"sends"| node_email
node_backend_services -->|"coordinates"| node_redis
node_backend_services -->|"calls"| node_ai_routers
node_backend_jobs -->|"triggers"| node_ai_routers
node_worker_batch -->|"syncs embeddings"| node_ai_routers
node_ai_routers -->|"delegates"| node_ai_services
node_ai_services -->|"uses"| node_ai_pinecone
node_ai_services -->|"stores/searches"| node_vector_store
node_ai_services -->|"generates"| node_gemini
node_backend_jobs -->|"uses"| node_backend_services
node_backend_routes -.->|"admin/internal"| node_backend_models

click node_frontend_app "https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/frontend/src"
click node_frontend_services "https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/frontend/src/services"
click node_frontend_pages "https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/frontend/src/pages"
click node_frontend_chat "https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/frontend/src/hooks"
click node_backend_routes "https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/routes"
click node_backend_controllers "https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/controllers"
click node_backend_services "https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/services"
click node_backend_repos "https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/repositories"
click node_backend_models "https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/models"
click node_backend_jobs "https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/jobs"
click node_ai_routers "https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/ai-service/routers"
click node_ai_services "https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/ai-service/services"
click node_ai_pinecone "https://github.com/skill-sync-mnnit/skillsync-ai/blob/main/ai-service/services/pinecone_repo.py"
click node_worker_batch "https://github.com/skill-sync-mnnit/skillsync-ai/blob/main/workers/batch_embed.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_frontend_app,node_frontend_services,node_frontend_pages,node_frontend_chat toneBlue
class node_backend_routes,node_backend_controllers,node_backend_services,node_backend_repos,node_backend_models,node_backend_jobs toneAmber
class node_ai_routers,node_ai_services,node_ai_pinecone toneMint
class node_worker_batch toneRose
class node_db,node_vector_store,node_redis,node_cloudinary,node_email,node_gemini toneIndigo
```

## Components

### Frontend

React/Vite presentation layer and client state.

- [SPA Shell](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/frontend/src): React/Vite UI · Main browser app with layouts, route pages, context, and client stores. · `frontend/src`
- [UI Services](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/frontend/src/services): HTTP client · Browser service layer plus socket hook for backend and realtime chat integration. · `frontend/src/services`
- [Route Pages](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/frontend/src/pages): screens · Login, profile, jobs, search, messages, dashboard, and settings views. · `frontend/src/pages`
- [Chat State](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/frontend/src/hooks): client state · Socket hook and chat store coordinating live messaging UI. · `frontend/src/hooks`

### Backend

Node/Express application API and domain logic.

- [API Routes](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/routes): Express routes · REST entrypoints for auth, profile, jobs, search, chat, networking, and internal control paths. · `backend/src/routes`
- [Controllers](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/controllers): request layer · Translate HTTP requests into domain use cases and service calls. · `backend/src/controllers`
- [Domain Services](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/services): business logic · Auth, profile, jobs, search, notifications, and socket coordination. · `backend/src/services`
- [Repositories](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/repositories): persistence adapters · Data access boundary for users, chat, connections, projects, and profiles. · `backend/src/repositories`
- [Mongo Models](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/models): documents · Core persisted entities such as users, jobs, conversations, notifications, and projects. · `backend/src/models`
- [Job Runners](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/backend/src/jobs): async jobs · Moderation, expiry, scraper, and embedding-control jobs. · `backend/src/jobs`

### AI Service

FastAPI vector and moderation service.

- [AI Routers](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/ai-service/routers): FastAPI routes · Embed, search, moderate, and analytics endpoints. · `ai-service/routers`
- [Vector Services](https://github.com/skill-sync-mnnit/skillsync-ai/tree/main/ai-service/services): ML logic · Embedding generation, ranking, moderation, explanation, and analytics logic. · `ai-service/services`
- [Vector Store Access](https://github.com/skill-sync-mnnit/skillsync-ai/blob/main/ai-service/services/pinecone_repo.py): Pinecone repo · Repository layer for vector persistence and retrieval. · `ai-service/services/pinecone_repo.py`

### Workers

Offline batch automation.

- [Batch Embed](https://github.com/skill-sync-mnnit/skillsync-ai/blob/main/workers/batch_embed.py): scheduled worker · Offline embedding sync and other scheduled automation. · `workers/batch_embed.py`

### External Systems

Persistent stores and third-party services.

- **MongoDB Atlas**: primary datastore · System of record for application entities and workflows.
- **Pinecone**: vector database · Stores embeddings for semantic search and matching.
- **Redis**: cache/coordination · Supports caching and coordination across backend workflows.
- **Cloudinary**: media storage · Stores uploaded resume PDFs and related assets.
- **Gmail SMTP**: email delivery · Sends OTP and notification email through Nodemailer/SMTP.
- **Gemini API**: LLM/embeddings · Language and embedding generation provider used by AI services.

## Connections

- SPA Shell → Route Pages: renders · Route-level views are composed inside the SPA shell.
- SPA Shell → UI Services: uses · Pages call browser services for backend communication.
- SPA Shell → Chat State: uses · Messaging UI depends on realtime chat state and sockets.
- UI Services → API Routes: HTTP · Frontend service layer calls the backend API.
- Chat State → API Routes: realtime/API · Chat state syncs with backend messaging endpoints.
- API Routes → Controllers: dispatches · Routes forward requests to controller handlers.
- Controllers → Domain Services: invokes · Controllers delegate workflow logic to services.
- Domain Services → Repositories: reads/writes · Services use repositories for persistence access.
- Repositories → Mongo Models: maps · Repositories operate over MongoDB models and documents.
- Mongo Models → MongoDB Atlas: persisted in · Primary application data is stored in MongoDB Atlas.
- Domain Services → Cloudinary: uploads · Profile/resume flows store files in Cloudinary.
- Domain Services → Gmail SMTP: sends · Auth and notification flows deliver OTPs and emails.
- Domain Services → Redis: coordinates · Backend uses Redis for cache and coordination.
- Domain Services → AI Routers: calls · Search, moderation, and embedding-related flows reach the AI service.
- Job Runners → AI Routers: triggers · Async jobs invoke AI endpoints for moderation and embeddings.
- Batch Embed → AI Routers: syncs embeddings · Scheduled worker drives offline embedding updates.
- AI Routers → Vector Services: delegates · Routers hand off to vector and ML service modules.
- Vector Services → Vector Store Access: uses · AI logic reads and writes vector data through the repository.
- Vector Services → Pinecone: stores/searches · Semantic retrieval runs against Pinecone.
- Vector Services → Gemini API: generates · LLM and embedding provider powers ranking, explanations, and embeddings.
- Job Runners → Domain Services: uses · Jobs reuse domain services for moderation and expiry workflows.
- API Routes → Mongo Models: admin/internal · Internal endpoints expose status and embedding-control paths.
