# taranjyots/portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/taranjyots/portfolio
- Repository: https://github.com/taranjyots/portfolio

## Overview

##### Project Type and Purpose
- Type: Full-stack web application (personal portfolio)
- Frontend: React SPA (create-react-app + shadcn/ui + Tailwind)
- Backend: Python web service (likely Flask or FastAPI)
- Database: Relational (configured via backend/.env)
- Purpose: Serve static content (About, Projects, Contact) and dynamic API endpoints for form submissions and data seeding.

##### Main Components
a. Client Browser (User)
b. CDN / Static File Host (optional) – serves build/compiled React assets
c. Frontend Application
– React components (pages, UI primitives, contexts, hooks, services/api.js)
– Environment config (.env, tailwind.config.js, craco.config.js)
d. Backend Application
– server.py (HTTP API endpoints)
– database.py (DB connection)
– models.py (ORM models)
– seed_data.py (initial data population)
– backend/.env (DB credentials, secrets)
e. Database
– PostgreSQL/MySQL/SQLite (as specified in .env)
f. External Services (if any)
– Email service for contact form (SMTP or third-party)
– Analytics or CDN providers

##### Relationships and Data Flows
1. Client Browser → (1) HTTP GET / → CDN → index.html + JS bundles
2. React App in Browser → (2) fetch(‘/api/projects’) → Backend
3. Backend server.py → (3) Query via database.py/models.py → Database
4. Database → (4) Result → Backend → (5) JSON response → Frontend
5. Frontend → (6) POST /api/contact → Backend → (7) Send email or store data → Response
6. seed_data.py (offline) → (8) Writes initial records → Database

##### Architectural Patterns & Principles
- Separation of concerns: UI layer (React) vs. business logic (Python API) vs. persistence (DB).
- MVC-like in backend: models.py (Model), server.py (Controller), responses (View).
- Component-driven UI with context providers/hooks for state management.
- Environment isolation via .env files in both frontend/backend.

##### Final Checklist
– [ ] Client browser and static asset host
– [ ] React SPA (split into UI components, contexts, hooks, services)
– [ ] Backend service (server.py, models, DB connector)
– [ ] Database (with credentials from .env)
– [ ] External services (email, analytics)
– [ ] Deployment annotations (optional: Docker, CI/CD, hosting)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client and CDN
    Browser["Client Browser"]:::client
    CDN["CDN / Static Host"]:::cloud
    Browser -->|"GET /"| CDN

    %% Frontend Layer
    subgraph "Frontend (React SPA)"
        direction TB
        IndexHTML["index.html"]:::frontend
        IndexJS["index.js"]:::frontend
        AppJS["App.js"]:::frontend
        AppCSS["App.css"]:::frontend
        UIComponents["UI Components"]:::frontend
        UILibrary["UI Library Components"]:::frontend
        ContextProviders["Context Providers"]:::frontend
        CustomHooks["Custom Hooks"]:::frontend
        APIService["API Abstraction Layer"]:::frontend
        EnvFE["frontend/.env"]:::frontend
        TailwindConfig["tailwind.config.js"]:::frontend
        CracoConfig["craco.config.js"]:::frontend
    end

    CDN -->|"serves index.html"| IndexHTML
    IndexHTML -->|"loads"| IndexJS
    IndexJS --> AppJS
    AppJS --> AppCSS
    AppJS --> UIComponents
    AppJS --> UILibrary
    AppJS --> ContextProviders
    AppJS --> CustomHooks
    AppJS --> APIService
    EnvFE --> AppJS
    TailwindConfig --> AppCSS
    CracoConfig --> AppJS

    %% Backend Layer
    subgraph "Backend Service (Python API)"
        direction TB
        Server["server.py"]:::backend
        DBModule["database.py"]:::backend
        Models["models.py"]:::backend
        SeedData["seed_data.py"]:::backend
        EnvBE["backend/.env"]:::backend
        Requirements["requirements.txt"]:::backend
    end

    APIService -->|"GET /api/projects\nPOST /api/contact"| Server
    Server --> DBModule
    Server --> EnvBE
    Server --> Requirements
    DBModule --> Models
    Models --> Database

    %% Database
    Database["Database"]:::database

    %% External Services
    EmailService["Email Service"]:::cloud
    Analytics["Analytics Service"]:::cloud

    Server -->|"send email"| EmailService
    Browser -->|"load analytics"| Analytics
    SeedData -->|"writes initial data"| Database

    %% Click events
    click IndexHTML "https://github.com/taranjyots/portfolio/blob/main/frontend/public/index.html"
    click IndexJS "https://github.com/taranjyots/portfolio/blob/main/frontend/src/index.js"
    click AppJS "https://github.com/taranjyots/portfolio/blob/main/frontend/src/App.js"
    click AppCSS "https://github.com/taranjyots/portfolio/blob/main/frontend/src/App.css"
    click UIComponents "https://github.com/taranjyots/portfolio/tree/main/frontend/src/components"
    click UILibrary "https://github.com/taranjyots/portfolio/tree/main/frontend/src/components/ui"
    click ContextProviders "https://github.com/taranjyots/portfolio/blob/main/frontend/src/contexts/ThemeContext.js"
    click CustomHooks "https://github.com/taranjyots/portfolio/tree/main/frontend/src/hooks"
    click APIService "https://github.com/taranjyots/portfolio/blob/main/frontend/src/services/api.js"
    click EnvFE "https://github.com/taranjyots/portfolio/blob/main/frontend/.env"
    click TailwindConfig "https://github.com/taranjyots/portfolio/blob/main/frontend/tailwind.config.js"
    click CracoConfig "https://github.com/taranjyots/portfolio/blob/main/frontend/craco.config.js"
    click Server "https://github.com/taranjyots/portfolio/blob/main/backend/server.py"
    click DBModule "https://github.com/taranjyots/portfolio/blob/main/backend/database.py"
    click Models "https://github.com/taranjyots/portfolio/blob/main/backend/models.py"
    click SeedData "https://github.com/taranjyots/portfolio/blob/main/backend/seed_data.py"
    click EnvBE "https://github.com/taranjyots/portfolio/blob/main/backend/.env"
    click Requirements "https://github.com/taranjyots/portfolio/blob/main/backend/requirements.txt"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,color:#000;
    classDef backend fill:#90EE90,stroke:#000,color:#000;
    classDef database fill:#FFA500,stroke:#000,color:#000;
    classDef cloud fill:#D3D3D3,stroke:#000,color:#000;
    classDef client fill:#FFFFFF,stroke:#000,color:#000;
```
