# sarthak8404/resume-intelligence-engine architecture

> Architecture diagram of the GitHub repository sarthak8404/resume-intelligence-engine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sarthak8404/resume-intelligence-engine
- Repository: https://github.com/sarthak8404/resume-intelligence-engine

## Overview

This is a multi-tenant resume and job-description intelligence API. Clients authenticate, upload PDFs, and track asynchronous processing; the worker extracts and chunks text, generates embeddings, and stores searchable content. Authenticated searches combine vector and full-text retrieval with reciprocal-rank fusion, optionally using tenant-scoped Redis caching. The graph includes documented capabilities such as SSE, retries, and tenant isolation; source excerpts are partial, so links for unsampled internals rely on README statements where indicated.

Main entry points: [`app/db/database.py`](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/db/database.py) (Database access), [`app/api/routes/auth.py`](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/api/routes/auth.py) (Auth endpoints), [`app/api/routes/search.py`](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/api/routes/search.py) (Search endpoint), [`app/main.py`](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/main.py) (FastAPI application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and tenancy"]
  node_application["FastAPI application<br/>[main.py]"]
  node_auth_routes["Auth endpoints<br/>[auth.py]"]
  node_auth_schema["Auth schemas<br/>[auth.py]"]
  node_auth_services["Password services<br/>[auth.py]"]
  node_token_service["JWT service<br/>[token.py]"]
  node_identity["Identity dependency<br/>[dependencies.py]"]
  node_tenant_routes["Tenant endpoints<br/>[tenants.py]"]
end

subgraph group_ingest["Document ingestion"]
  node_document_routes["Document endpoints<br/>[documents.py]"]
  node_task_queue["Celery task queue"]
  node_worker_tasks["Worker tasks<br/>[tasks.py]"]
  node_processing["PDF processing"]
  node_chunking["Text chunking<br/>[chunking.py]"]
  node_embedding["Gemini embeddings<br/>[embedding.py]"]
end

subgraph group_search["Hybrid retrieval"]
  node_search_routes["Search endpoint<br/>[search.py]"]
  node_search_schema["Search schema<br/>[search.py]"]
end

subgraph group_runtime["Runtime and storage"]
  node_redis_cache[("Redis cache<br/>[redis.py]")]
  node_database["Database access<br/>[database.py]"]
  node_postgres[("PostgreSQL")]
  node_config["Application config<br/>[config.py]"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_application
node_application -->|"registers router"| node_auth_routes
node_application -->|"registers router"| node_document_routes
node_application -->|"registers router"| node_search_routes
node_application -->|"registers router"| node_tenant_routes
node_auth_routes -->|"validates requests"| node_auth_schema
node_auth_routes -->|"hashes passwords"| node_auth_services
node_auth_routes -->|"creates token"| node_token_service
node_auth_routes -->|"uses identity"| node_identity
node_auth_routes -->|"queries users"| node_database
node_identity -->|"checks identity"| node_database
node_document_routes -->|"requires identity"| node_identity
node_search_routes -->|"requires identity"| node_identity
node_document_routes -->|"stores metadata"| node_database
node_document_routes -->|"dispatches task"| node_task_queue
node_task_queue -.->|"delivers task"| node_worker_tasks
node_worker_tasks -->|"calls processor"| node_processing
node_processing -->|"chunks text"| node_chunking
node_processing -->|"embeds chunks"| node_embedding
node_processing -->|"persists chunks"| node_database
node_search_routes -->|"accepts query"| node_search_schema
node_search_routes -->|"embeds query"| node_embedding
node_search_routes -->|"runs hybrid query"| node_database
node_search_routes -->|"reads and writes cache"| node_redis_cache
node_document_routes -.->|"streams status"| node_client
node_database -->|"opens pool"| node_postgres
node_config -->|"configures connection"| node_database
node_config -->|"configures API key"| node_embedding
node_config -->|"configures Redis"| node_redis_cache

click node_application "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/main.py"
click node_auth_routes "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/api/routes/auth.py"
click node_auth_schema "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/schemas/auth.py"
click node_auth_services "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/services/auth.py"
click node_token_service "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/services/token.py"
click node_identity "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/api/dependencies.py"
click node_tenant_routes "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/api/routes/tenants.py"
click node_document_routes "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/api/routes/documents.py"
click node_worker_tasks "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/worker/tasks.py"
click node_processing "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/services/document_processing.py"
click node_chunking "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/services/chunking.py"
click node_embedding "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/services/embedding.py"
click node_search_routes "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/api/routes/search.py"
click node_search_schema "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/schemas/search.py"
click node_redis_cache "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/core/redis.py"
click node_database "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/db/database.py"
click node_config "https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/core/config.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_application,node_auth_routes,node_auth_schema,node_auth_services,node_token_service,node_identity,node_tenant_routes,node_client toneBlue
class node_document_routes,node_task_queue,node_worker_tasks,node_processing,node_chunking,node_embedding toneAmber
class node_search_routes,node_search_schema toneMint
class node_redis_cache,node_database,node_postgres,node_config toneRose
```

## Components

### API and tenancy

- [FastAPI application](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/main.py): `app/main.py`
- [Auth endpoints](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/api/routes/auth.py): `app/api/routes/auth.py`
- [Auth schemas](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/schemas/auth.py): `app/schemas/auth.py`
- [Password services](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/services/auth.py): `app/services/auth.py`
- [JWT service](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/services/token.py): `app/services/token.py`
- [Identity dependency](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/api/dependencies.py): `app/api/dependencies.py`
- [Tenant endpoints](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/api/routes/tenants.py): `app/api/routes/tenants.py`

### Document ingestion

- [Document endpoints](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/api/routes/documents.py): `app/api/routes/documents.py`
- **Celery task queue**
- [Worker tasks](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/worker/tasks.py): `app/worker/tasks.py`
- [PDF processing](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/services/document_processing.py): `app/services/document_processing.py`
- [Text chunking](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/services/chunking.py): `app/services/chunking.py`
- [Gemini embeddings](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/services/embedding.py): `app/services/embedding.py`

### Hybrid retrieval

- [Search endpoint](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/api/routes/search.py): `app/api/routes/search.py`
- [Search schema](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/schemas/search.py): `app/schemas/search.py`

### Runtime and storage

- [Redis cache](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/core/redis.py): `app/core/redis.py`
- [Database access](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/db/database.py): `app/db/database.py`
- **PostgreSQL**
- [Application config](https://github.com/sarthak8404/resume-intelligence-engine/blob/main/app/core/config.py): `app/core/config.py`

### Other components

- **API client**

## Connections

- API client → FastAPI application: sends requests (evidence: `Readme.md`)
- FastAPI application → Auth endpoints: registers router (evidence: `app/main.py`)
- FastAPI application → Document endpoints: registers router (evidence: `app/main.py`)
- FastAPI application → Search endpoint: registers router (evidence: `app/main.py`)
- FastAPI application → Tenant endpoints: registers router (evidence: `app/main.py`)
- Auth endpoints → Auth schemas: validates requests (evidence: `app/api/routes/auth.py`)
- Auth endpoints → Password services: hashes passwords (evidence: `app/api/routes/auth.py`)
- Auth endpoints → JWT service: creates token (evidence: `app/api/routes/auth.py`)
- Auth endpoints → Identity dependency: uses identity (evidence: `app/api/routes/auth.py`)
- Auth endpoints → Database access: queries users (evidence: `app/api/routes/auth.py`)
- Identity dependency → Database access: checks identity (evidence: `app/api/dependencies.py`)
- Document endpoints → Identity dependency: requires identity (evidence: `app/api/routes/documents.py`)
- Search endpoint → Identity dependency: requires identity (evidence: `app/api/routes/search.py`)
- Document endpoints → Database access: stores metadata (evidence: `app/api/routes/documents.py`)
- Document endpoints → Celery task queue: dispatches task (evidence: `app/api/routes/documents.py`)
- Celery task queue → Worker tasks: delivers task (evidence: `Readme.md`)
- Worker tasks → PDF processing: calls processor (evidence: `app/worker/tasks.py`)
- PDF processing → Text chunking: chunks text (evidence: `app/services/document_processing.py`)
- PDF processing → Gemini embeddings: embeds chunks (evidence: `app/services/document_processing.py`)
- PDF processing → Database access: persists chunks (evidence: `app/services/document_processing.py`)
- Search endpoint → Search schema: accepts query (evidence: `app/api/routes/search.py`)
- Search endpoint → Gemini embeddings: embeds query (evidence: `app/api/routes/search.py`)
- Search endpoint → Database access: runs hybrid query (evidence: `app/api/routes/search.py`)
- Search endpoint → Redis cache: reads and writes cache (evidence: `app/api/routes/search.py`)
- Document endpoints → API client: streams status (evidence: `Readme.md`)
- Database access → PostgreSQL: opens pool (evidence: `app/db/database.py`)
- Application config → Database access: configures connection (evidence: `app/db/database.py`)
- Application config → Gemini embeddings: configures API key (evidence: `app/services/embedding.py`)
- Application config → Redis cache: configures Redis (evidence: `app/core/redis.py`)
