# baibhab-adhikari/ats-eureka architecture

> Architecture diagram of the GitHub repository baibhab-adhikari/ats-eureka, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/baibhab-adhikari/ats-eureka
- Repository: https://github.com/baibhab-adhikari/ats-eureka

## Overview

##### Project type and purpose
- ATS-Eureka is a full-stack, AI-powered resume screening web application.
- Backend: FastAPI (Python), exposing RESTful /api endpoints for authentication, single-resume analysis, and batch analysis.
- Frontend: Static HTML/CSS/JavaScript pages (employer and employee portals) served via AWS S3/CloudFront.
- Core functionality: Accept resumes (PDF/DOCX), send text to Google Gemini Flash API, compute matching scores, store results in MongoDB Atlas, enforce rate limits via Redis Cloud.

##### File structure
- Top level:
- app.py – FastAPI application entry point
- auth.py – JWT auth and user-type logic
- db.py – Database connection to MongoDB Atlas
- helpers.py – Utility functions (parsing files, formatting JSON)
- requirements.txt, Dockerfile, heroku.yml – containerization and deployment
- frontend/ – Static client assets: HTML pages, CSS styles, JS logic for API calls
- assets/ – Images used in static pages (landing, dashboards)
- .env / environment variables for MONGO_URI, GEMINI_API_KEY, REDIS config

##### Key architectural insights from README
- Dual-interface: separate flows for employers vs. job seekers
- AI integration: Google Gemini Flash 1.5 8B model via REST API
- Rate limiting: Redis-based, sits in front of FastAPI to throttle requests
- Persistence: MongoDB Atlas stores user profiles and analysis history
- Deployment: Backend in Docker on Heroku; static frontend on S3 + CloudFront CDN

##### Main components & interactions
a. Frontend (Client Browser + S3/CloudFront)
- Pages: /signin, /signup, /employee_home, /employer_home, /plans, /index
- JS modules call FastAPI endpoints under /api
b. API Layer (FastAPI app.py)
- Authentication endpoints (JWT, auth.py)
- Profile endpoints (GET /api/profile, /api/profile/history)
- Resume analysis endpoints (POST /api/employee, /api/employer)
- Rate limiter middleware (Redis Cloud)
c. AI Service (External)
- Google Gemini Flash API (requires GEMINI_API_KEY)
- Receives extracted text, returns matching scores & JSON analysis
d. Database & Cache
- MongoDB Atlas (db.py): stores users, company info, analysis results
- Redis Cloud: rate-limit counters, optional caching of frequent queries
e. Deployment & Infrastructure
- Docker container built via Dockerfile
- Heroku container registry (heroku.yml) runs backend
- AWS S3 + CloudFront serve static assets globally
- Environment variables stored in Heroku config & .env locally

##### Architectural patterns and design principles
- Layered architecture: Presentation (frontend), API/Business Logic (FastAPI), Data (MongoDB), External Services (AI, Redis)
- Single-page/static multipage front-end calling REST API
- Loose coupling: AI integration abstracted behind helper modules
- Scalability: Stateless API servers (Docker), horizontal scale on Heroku; CDN for static content
- Security: JWT for auth, HTTPS endpoints, rate limiting

##### Detailed capturing of essential elements
- Don’t include the unused market_data_analysis_scripts folder
- Call out the rate limiter as a middleware component in the API service
- Dual portals by grouping related frontend pages under “Employee UI” and “Employer UI”
- Batch vs. single-resume analysis flows separately if space allows

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Users & Browsers
    subgraph "Users & Browsers"
        direction TB
        JS1("Job Seeker"):::external
        JS2("Employer"):::external
    end

    %% Frontend Hosting
    subgraph "Frontend Hosting" 
        direction TB
        S3["AWS S3"]:::infra
        CF["AWS CloudFront"]:::infra
    end

    %% Frontend UI Components
    subgraph "Frontend Static Assets" 
        direction TB
        IDX["Index Page"]:::frontend
        SIGNIN_HTML["Signin Page"]:::frontend
        SIGNIN_JS["Signin Script"]:::frontend
        SIGNUP_HTML["Signup Page"]:::frontend
        SIGNUP_JS["Signup Script"]:::frontend
        SIGNUP_CSS["Signup Styles"]:::frontend
        PLANS["Plans Page"]:::frontend
    end

    subgraph "Employee UI" 
        direction TB
        EMP_HTML["Employee Home Page"]:::frontend
        EMP_JS["Employee Script"]:::frontend
        EMP_CSS["Employee Styles"]:::frontend
    end

    subgraph "Employer UI"
        direction TB
        ER_HTML["Employer Home Page"]:::frontend
        ER_JS["Employer Script"]:::frontend
    end

    %% Backend Services
    subgraph "Backend Services (Docker on Heroku)" 
        direction TB
        APT["FastAPI + Uvicorn"]:::backend
        AUTH["Authentication Logic (auth.py)"]:::backend
        DBCON["DB Connection (db.py)"]:::backend
        HELP["Helper Utilities (helpers.py)"]:::backend
        RATE["Rate Limiter (Redis Middleware)"]:::backend
        REQ["Requirements (requirements.txt)"]:::backend
        DOCK["Dockerfile"]:::backend
        HEROKU["heroku.yml"]:::backend
    end

    %% Data & External Services
    subgraph "Data & External Services"
        direction TB
        MONGO["MongoDB Atlas"]:::data
        REDIS["Redis Cloud"]:::data
        GEMINI["Google Gemini Flash API"]:::external
    end

    %% Static Images
    subgraph "Assets"
        direction TB
        IMAGES["Assets Images"]:::frontend
    end

    %% Relationships
    JS1 -->|HTTP GET| CF
    JS2 -->|HTTP GET| CF
    CF -->|Serves Static| S3

    CF -->|Delivers HTML/CSS/JS| IDX
    CF --> IDX
    CF --> SIGNIN_HTML
    CF --> SIGNIN_JS
    CF --> SIGNUP_HTML
    CF --> SIGNUP_JS
    CF --> SIGNUP_CSS
    CF --> PLANS
    CF --> EMP_HTML
    CF --> EMP_JS
    CF --> EMP_CSS
    CF --> ER_HTML
    CF --> ER_JS
    CF --> IMAGES

    IDX -->|JS Calls API| APT
    SIGNIN_JS -->|POST /api/auth| APT
    SIGNUP_JS -->|POST /api/auth| APT
    EMP_JS -->|POST /api/employee| APT
    ER_JS -->|POST /api/employer| APT
    PLANS -->|GET /api/plans| APT

    APT -->|uses| AUTH
    APT -->|uses| DBCON
    APT -->|uses| HELP
    APT -->|middleware| RATE

    APT -->|CRUD| MONGO
    RATE -->|check counters| REDIS
    APT -->|calls API| GEMINI

    %% Click Events
    click IDX "https://github.com/baibhab-adhikari/ats-eureka/blob/main/frontend/index.html"
    click SIGNIN_HTML "https://github.com/baibhab-adhikari/ats-eureka/blob/main/frontend/signin.html"
    click SIGNIN_JS "https://github.com/baibhab-adhikari/ats-eureka/blob/main/frontend/signin.js"
    click SIGNUP_HTML "https://github.com/baibhab-adhikari/ats-eureka/blob/main/frontend/signup.html"
    click SIGNUP_JS "https://github.com/baibhab-adhikari/ats-eureka/blob/main/frontend/signup.js"
    click SIGNUP_CSS "https://github.com/baibhab-adhikari/ats-eureka/blob/main/frontend/signup.css"
    click PLANS "https://github.com/baibhab-adhikari/ats-eureka/blob/main/frontend/plans.html"
    click EMP_HTML "https://github.com/baibhab-adhikari/ats-eureka/blob/main/frontend/employee_home.html"
    click EMP_JS "https://github.com/baibhab-adhikari/ats-eureka/blob/main/frontend/employee_home.js"
    click EMP_CSS "https://github.com/baibhab-adhikari/ats-eureka/blob/main/frontend/employee_home.css"
    click ER_HTML "https://github.com/baibhab-adhikari/ats-eureka/blob/main/frontend/employer_home.html"
    click ER_JS "https://github.com/baibhab-adhikari/ats-eureka/blob/main/frontend/employer_home.js"
    click IMAGES "https://github.com/baibhab-adhikari/ats-eureka/tree/main/assets/images/"
    click APT "https://github.com/baibhab-adhikari/ats-eureka/blob/main/app.py"
    click AUTH "https://github.com/baibhab-adhikari/ats-eureka/blob/main/auth.py"
    click DBCON "https://github.com/baibhab-adhikari/ats-eureka/blob/main/db.py"
    click HELP "https://github.com/baibhab-adhikari/ats-eureka/blob/main/helpers.py"
    click REQ "https://github.com/baibhab-adhikari/ats-eureka/blob/main/requirements.txt"
    click DOCK "https://github.com/baibhab-adhikari/ats-eureka/tree/main/Dockerfile"
    click HEROKU "https://github.com/baibhab-adhikari/ats-eureka/blob/main/heroku.yml"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,color:#004085
    classDef backend fill:#d4edda,stroke:#155724,color:#155724
    classDef data fill:#fff3cd,stroke:#856404,color:#856404
    classDef external fill:#f5c6cb,stroke:#721c24,color:#721c24
    classDef infra fill:#e2e3e5,stroke:#6c757d,color:#6c757d
```
