# adhimiw/adhithan-dev_portfolio architecture

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

- Interactive diagram: https://gitdiagram.com/adhimiw/adhithan-dev_portfolio
- Repository: https://github.com/adhimiw/adhithan-dev_portfolio

## Overview

##### Project type and purpose
- This is a full-stack portfolio website.
- Purpose: serve a React/Vite frontend (with dynamic and static modes), backed by an Express/MongoDB API, featuring real-time updates via WebSockets, data export for static builds, an admin dashboard, visitor analytics, file uploads, and third-party integrations (Cloudinary, email, push notifications, GitHub OAuth).

##### File structure
- Top-level directories:
- backend/ – Express server, config (db, Cloudinary), middleware, Mongoose models, routes, WebSocket & push services, utility scripts, server.js
- public/ – static assets and JSON data exports for static builds
- src/ – React application: components (3D, admin, UI, visitor tracking), pages (public and admin), contexts, hooks, services (API wrappers), utils
- Deployment scripts and config: Docker (docker-compose.yml), PM2 (ecosystem.config.js), Netlify (netlify.toml), Vercel (vercel.json), Render (render.yaml, build-for-render.sh), GitHub Actions (.github/workflows/deploy.yml)
- Build & utility scripts: data export/import (backend/scripts), start-dev.sh, deploy-*.sh, check-*.js, sampleData seeds.

##### README insights
- Architecture summary: dynamic mode (MongoDB ➔ Express API ➔ React via REST + Socket.IO) and static mode (MongoDB ➔ JSON export ➔ static React).
- Tech stack: React-TypeScript, Vite, Tailwind CSS, shadcn/ui, Three.js, Framer Motion; Node.js, Express, MongoDB, Socket.IO; tooling (Bun, Biome, ESLint, GitHub Actions).

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Frontend"
        direction TB
        FEApp["React App"]:::frontend
        Entry["main.tsx"]:::frontend
        Comps["Components (UI, 3D, Admin, Visitor)"]:::frontend
        PageTracker["PageTracker Component"]:::frontend
        PagesPub["Pages (Public)"]:::frontend
        PagesAdmin["Pages (Admin)"]:::frontend
        VisitorStatsPage["VisitorStatsPage"]:::frontend
        ServicesFE["Services (API, Upload, Visitor)"]:::frontend
        Contexts["Contexts (Auth, Theme, WebSocket)"]:::frontend

        FEApp --> Entry
        FEApp --> Comps
        Comps --> PageTracker
        PagesAdmin --> VisitorStatsPage
        FEApp --> PagesPub
        FEApp --> PagesAdmin
        FEApp --> ServicesFE
        FEApp --> Contexts
    end

    subgraph "Backend"
        direction TB
        API["Express API"]:::backend
        EntryBE["server.js"]:::backend
        Routes["REST Routes"]:::backend
        Middleware["Middleware (Auth, Error)"]:::backend
        SocketSvc["Socket.IO Service"]:::backend
        PushSvc["Push Notification Service"]:::backend
        EmailSvc["Email Services"]:::backend
        CloudinaryCfg["Cloudinary Config"]:::backend
        DBConfig["DB Config"]:::backend
        Models["Mongoose Models"]:::backend
        OAuthRoute["GitHub OAuth Route"]:::backend
        UploadRoute["File Upload Route"]:::backend
        VisitorRoute["Visitor Tracking Route"]:::backend

        API --> EntryBE
        EntryBE --> Routes
        EntryBE --> Middleware
        EntryBE --> SocketSvc
        EntryBE --> PushSvc
        EntryBE --> EmailSvc
        EntryBE --> CloudinaryCfg
        EntryBE --> DBConfig
        Models --> Routes
        Routes --> OAuthRoute
        Routes --> UploadRoute
        Routes --> VisitorRoute
    end

    DB["MongoDB"]:::database

    FEApp -->|"HTTP(S)"| EntryBE
    FEApp -->|"WebSocket"| SocketSvc
    EntryBE -->|"Read/Write"| DB

    subgraph "Data Export Pipeline"
        direction TB
        ExportScript["exportData.js"]:::pipeline
        JSONData["public/data/*.json"]:::pipeline

        DB --> ExportScript
        ExportScript --> JSONData
        JSONData --> FEApp
    end

    subgraph CI/CD
        direction TB
        GitHubActions[".github/workflows/deploy.yml"]:::ci
        DockerCompose["docker-compose.yml"]:::ci
        PM2Cfg["ecosystem.config.js"]:::ci
        NetlifyCfg["netlify.toml"]:::ci
        VercelCfg["vercel.json"]:::ci
        RenderCfg["render.yaml & build-for-render.sh"]:::ci
        ViteCfg["vite.config.ts & vite.config.prod.ts"]:::ci
        DevScript["start-dev.sh"]:::ci

        GitHubActions --> ExportScript
        GitHubActions --> ViteCfg
        GitHubActions --> DockerCompose
        GitHubActions --> PM2Cfg
        GitHubActions --> NetlifyCfg
        GitHubActions --> VercelCfg
        GitHubActions --> RenderCfg
        GitHubActions --> DevScript
    end

    subgraph "External Services"
        direction TB
        Cloudinary["Cloudinary"]:::external
        OneSignal["OneSignal"]:::external
        EmailProvider["SendGrid/Mailgun"]:::external
        GitHubOAuth["GitHub OAuth"]:::external

        CloudinaryCfg --> Cloudinary
        PushSvc --> OneSignal
        EmailSvc --> EmailProvider
        OAuthRoute --> GitHubOAuth
    end

    click FEApp "https://github.com/adhimiw/adhithan-dev_portfolio/tree/main/src/"
    click Entry "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/src/main.tsx"
    click Comps "https://github.com/adhimiw/adhithan-dev_portfolio/tree/main/src/components/"
    click PageTracker "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/src/components/visitor/PageTracker.tsx"
    click PagesPub "https://github.com/adhimiw/adhithan-dev_portfolio/tree/main/src/pages/"
    click PagesAdmin "https://github.com/adhimiw/adhithan-dev_portfolio/tree/main/src/pages/admin/"
    click VisitorStatsPage "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/src/pages/admin/VisitorStatsPage.tsx"
    click ServicesFE "https://github.com/adhimiw/adhithan-dev_portfolio/tree/main/src/services/"
    click Contexts "https://github.com/adhimiw/adhithan-dev_portfolio/tree/main/src/contexts/"

    click EntryBE "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/backend/server.js"
    click Routes "https://github.com/adhimiw/adhithan-dev_portfolio/tree/main/backend/routes/"
    click Middleware "https://github.com/adhimiw/adhithan-dev_portfolio/tree/main/backend/middleware/"
    click DBConfig "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/backend/config/db.js"
    click CloudinaryCfg "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/backend/config/cloudinary.js"
    click Models "https://github.com/adhimiw/adhithan-dev_portfolio/tree/main/backend/models/"
    click SocketSvc "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/backend/services/socketService.js"
    click PushSvc "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/backend/services/pushNotificationService.js"
    click EmailSvc "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/backend/utils/emailService.js"
    click EmailSvc "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/backend/utils/emailServiceAlt.js"
    click OAuthRoute "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/backend/routes/githubAuth.js"
    click UploadRoute "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/backend/routes/upload.js"
    click VisitorRoute "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/backend/routes/visitors.js"

    click ExportScript "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/backend/scripts/exportData.js"
    click JSONData "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/public/data/*.json"

    click GitHubActions "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/.github/workflows/deploy.yml"
    click DockerCompose "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/docker-compose.yml"
    click PM2Cfg "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/ecosystem.config.js"
    click NetlifyCfg "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/netlify.toml"
    click VercelCfg "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/vercel.json"
    click RenderCfg "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/render.yaml"
    click ViteCfg "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/vite.config.ts"
    click DevScript "https://github.com/adhimiw/adhithan-dev_portfolio/blob/main/start-dev.sh"

    classDef frontend fill:#D6EFFF,stroke:#0B3D91,color:#000;
    classDef backend fill:#FFE5E5,stroke:#913535,color:#000;
    classDef database fill:#FFF0B3,stroke:#998300,color:#000;
    classDef external fill:#E8E8E8,stroke:#666666,color:#000;
    classDef pipeline fill:#E0FFE0,stroke:#2F8F2F,color:#000;
    classDef ci fill:#F0E0FF,stroke:#7F3F7F,color:#000;
```
