# changteezy/cv-manager architecture

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

- Interactive diagram: https://gitdiagram.com/changteezy/cv-manager
- Repository: https://github.com/changteezy/cv-manager

## Overview

##### Main Components
- Frontend SPA
- Hosted as a static site (e.g. Vercel, Netlify)
- Built with React + TypeScript (client/src)
- UI via ShadCN UI & Tailwind CSS
- Form validation with React Hook Form & Zod
- BaaS Backend (Supabase)
- Authentication (supabaseAuth)
- PostgreSQL database (applicant, event, assessment tables)
- Storage (for file metadata)
- Edge functions or triggers (optional)
- External File Storage
- AWS S3 bucket (CV uploads, assignment files, offer/rejection letters)
- Email Service (can be via Supabase SMTP or third-party)
- CDN/Hosting
- Vercel (via vercel.json) or similar for static assets

##### Relationships & Data Flows
a. User (HR or Candidate) opens browser → requests static files from CDN
b. React SPA makes REST/Real-Time calls to Supabase Auth & Postgres via supabaseClient.ts
c. For file uploads/downloads → SPA uses presigned URLs to AWS S3
d. When sending emails → SPA invokes Supabase Function or direct SMTP/API call to email service
e. Analytics dashboard reads aggregated data from Postgres via Supabase queries

##### Architectural Patterns
- Single-Page Application (SPA) on the client
- Backend-as-a-Service (BaaS): no custom Node server
- “Jamstack” style: pre-built frontend + API integrations
- Event-driven file storage (uploads → S3 + metadata in Postgres)
- Component-based UI (client/src/components/*) following Atomic/UI library

##### Relevant Technologies
- Frontend: React, TypeScript, Vite, Tailwind CSS, ShadCN UI
- Forms & Validation: React Hook Form + Zod
- Data Layer: Supabase JS client (supabaseClient.ts)
- File Storage: AWS S3
- Hosting: Vercel (vercel.json)
- CI/CD: pnpm, Github Actions (optional)

- User → CDN (GET index.html)
- SPA → Supabase Auth (login/token)
- SPA → Supabase DB (CRUD queries)
- SPA → S3 (PUT/GET files)
- SPA → Email Service (POST email)
- Blue for client components
- Green for Supabase services
- Orange for AWS S3
- Gray for external email service

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User (HR/Candidate)"]:::frontend
    CDN["CDN/Hosting\n(Vercel)"]:::frontend

    User -->|"GET index.html"| CDN

    subgraph "Client Layer"
        ReactApp["React SPA\n(client/src)"]:::frontend
        UI["UI Library\n(client/src/components/ui)"]:::frontend
        CoreComp["Core Components\n(client/src/components)"]:::frontend
        Routes["Routing\nPublicRoute.tsx\nProtectedRoute.tsx\nRoutes.tsx"]:::frontend
        Pages["Pages\n(client/src/pages)"]:::frontend
        Layouts["Layouts\n(AuthenticationLayout.tsx\nRootLayout.tsx)"]:::frontend
        Schemas["Form Schemas\n(client/src/schemas)"]:::frontend
        SupabaseClient["Supabase Client\n(client/src/utils/supabaseClient.ts)"]:::frontend
        AuthServ["Auth Service\n(client/src/services/auth.ts)"]:::frontend
        AuthCtx["Auth Context\n(client/src/contexts/AuthContext.tsx)"]:::frontend
        Hooks["Hooks\n(client/src/hooks)"]:::frontend
        Assets["Assets\n(images & styles)"]:::frontend
        Consts["Constants\n(client/src/constants)"]:::frontend
        Utils["Utils\n(client/src/lib/utils.ts)"]:::frontend
        Config["Vercel Config\n(client/vercel.json)"]:::frontend
        Package["Package & Tooling\n(package.json\nvite.config.ts\ntsconfig.json)"]:::frontend
    end

    CDN --> ReactApp

    subgraph "API Layer"
        AuthAPI["Supabase Auth"]:::supabase
        DBAPI["Supabase DB"]:::supabase
        StorageAPI["Supabase Storage"]:::supabase
    end

    ReactApp -->|"supabase.auth.signIn()/signUp()"| AuthAPI
    ReactApp -->|"supabase.from(...).select/insert"| DBAPI
    ReactApp -->|"supabase.storage.from().upload/download"| StorageAPI

    subgraph "Data Layer"
        Postgres["PostgreSQL\n(applicants, events, assessments)"]:::supabase
        S3["AWS S3\nbucket for files"]:::aws
    end

    DBAPI -->|"SQL CRUD"| Postgres
    StorageAPI -->|"file metadata"| Postgres
    StorageAPI -->|"presigned URLs"| S3

    subgraph "External Services"
        EmailSvc["Email Service\n(SMTP/API)"]:::external
    end

    ReactApp -->|"send email via SMTP/API"| EmailSvc

    %% Click Events
    click ReactApp "https://github.com/changteezy/cv-manager/tree/main/client/src"
    click UI "https://github.com/changteezy/cv-manager/tree/main/client/src/components/ui"
    click CoreComp "https://github.com/changteezy/cv-manager/tree/main/client/src/components"
    click Routes "https://github.com/changteezy/cv-manager/blob/main/client/src/routes/PublicRoute.tsx"
    click Routes "https://github.com/changteezy/cv-manager/blob/main/client/src/routes/ProtectedRoute.tsx"
    click Routes "https://github.com/changteezy/cv-manager/blob/main/client/src/routes/Routes.tsx"
    click Pages "https://github.com/changteezy/cv-manager/tree/main/client/src/pages"
    click Layouts "https://github.com/changteezy/cv-manager/blob/main/client/src/layouts/AuthenticationLayout.tsx"
    click Layouts "https://github.com/changteezy/cv-manager/blob/main/client/src/layouts/RootLayout.tsx"
    click Schemas "https://github.com/changteezy/cv-manager/tree/main/client/src/schemas"
    click SupabaseClient "https://github.com/changteezy/cv-manager/blob/main/client/src/utils/supabaseClient.ts"
    click AuthServ "https://github.com/changteezy/cv-manager/blob/main/client/src/services/auth.ts"
    click AuthCtx "https://github.com/changteezy/cv-manager/blob/main/client/src/contexts/AuthContext.tsx"
    click Hooks "https://github.com/changteezy/cv-manager/tree/main/client/src/hooks"
    click Assets "https://github.com/changteezy/cv-manager/tree/main/client/src/assets/images"
    click Assets "https://github.com/changteezy/cv-manager/blob/main/client/src/assets/styles/global.css"
    click Consts "https://github.com/changteezy/cv-manager/tree/main/client/src/constants"
    click Utils "https://github.com/changteezy/cv-manager/blob/main/client/src/lib/utils.ts"
    click Config "https://github.com/changteezy/cv-manager/blob/main/client/vercel.json"
    click Package "https://github.com/changteezy/cv-manager/blob/main/client/package.json"
    click Package "https://github.com/changteezy/cv-manager/blob/main/client/vite.config.ts"
    click Package "https://github.com/changteezy/cv-manager/blob/main/client/tsconfig.json"

    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef supabase fill:#d4edda,stroke:#333,stroke-width:1px
    classDef aws fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef external fill:#e2e3e5,stroke:#333,stroke-width:1px
```
