# vicelikedust/gitdiagram architecture

> Architecture diagram of the GitHub repository vicelikedust/gitdiagram, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vicelikedust/gitdiagram
- Repository: https://github.com/vicelikedust/gitdiagram

## Overview

##### Main Components

a) Client-Side (Frontend):
- Next.js Application Layer
- Pages and Routes (src/app directory)
- Components (src/components)
- Server Actions (src/app/_actions)
- Database Integration (src/server/db)

b) Server-Side (Backend):
- FastAPI Application
- Core Services
- API Routers
- Rate Limiter
- Nginx Reverse Proxy

c) External Services:
- Claude 3.5 Sonnet AI
- GitHub API
- PostgreSQL Database
- Analytics Services (PostHog, Api-Analytics)

**[Client Layer]**
- ↕️
**[API/Backend Layer]**
- ↕️
**[External Services Layer]**

##### Component Relationships

- Backend → Claude AI (for processing repository data)
- Backend → GitHub API (for fetching repository information)
- Frontend ↔️ PostgreSQL (via server actions for data persistence)
- Backend → Rate Limiter (for request throttling)

##### Specific Implementation Details

Frontend Section:
- Next.js app structure with pages, components, and server actions
- TypeScript and Tailwind CSS layers

Backend Section:
- FastAPI routes (/generate, /modify)
- Nginx reverse proxy configuration
- Rate limiting boundaries
- Service integrations (Claude, GitHub)

Database Section:
- PostgreSQL with Drizzle ORM connection
- Schema relationships if applicable

##### Deployment Architecture

Deployment information:
- Vercel (Frontend hosting)
- EC2 (Backend hosting)
- Docker container boundaries
- GitHub Actions CI/CD pipeline

##### Additional Elements

- Version/environment indicators
- Security boundaries and API key requirements
- Rate limit thresholds

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        NextApp["Next.js Application"]
        Pages["Pages & Routes"]:::frontend
        Components["UI Components"]:::frontend
        ServerActions["Server Actions"]:::frontend
        MermaidDiagram["Mermaid Diagram Renderer"]:::frontend
        FrontendAPI["API Integration"]:::frontend
        DBIntegration["Database Integration"]:::frontend
    end

    subgraph Backend
        FastAPI["FastAPI Application"]:::backend
        APIRouters["API Routers"]:::backend
        CoreServices["Core Services"]:::backend
        RateLimiter["Rate Limiter"]:::security
        NginxProxy["Nginx Reverse Proxy"]:::security
    end

    subgraph ExternalServices
        Claude["Claude 3.5 Sonnet AI"]:::external
        GitHubAPI["GitHub API"]:::external
        PostgreSQL[(PostgreSQL)]:::database
        Analytics["Analytics Services"]:::external
    end

    %% Frontend Relationships
    NextApp --> Pages
    NextApp --> Components
    NextApp --> ServerActions
    NextApp --> MermaidDiagram
    NextApp --> FrontendAPI
    NextApp --> DBIntegration

    %% Backend Relationships
    NginxProxy --> FastAPI
    FastAPI --> APIRouters
    FastAPI --> CoreServices
    FastAPI --> RateLimiter

    %% Cross-Layer Relationships
    FrontendAPI --> NginxProxy
    CoreServices --> Claude
    CoreServices --> GitHubAPI
    DBIntegration --> PostgreSQL
    FastAPI --> Analytics

    %% Click Events
    click Pages "https://github.com/vicelikedust/gitdiagram/tree/main/src/app"
    click Components "https://github.com/vicelikedust/gitdiagram/tree/main/src/components"
    click ServerActions "https://github.com/vicelikedust/gitdiagram/tree/main/src/app/_actions"
    click DBIntegration "https://github.com/vicelikedust/gitdiagram/tree/main/src/server/db"
    click FastAPI "https://github.com/vicelikedust/gitdiagram/blob/main/backend/app/main.py"
    click APIRouters "https://github.com/vicelikedust/gitdiagram/tree/main/backend/app/routers"
    click CoreServices "https://github.com/vicelikedust/gitdiagram/tree/main/backend/app/core"
    click RateLimiter "https://github.com/vicelikedust/gitdiagram/blob/main/backend/app/core/limiter.py"
    click NginxProxy "https://github.com/vicelikedust/gitdiagram/blob/main/backend/nginx/api.conf"
    click MermaidDiagram "https://github.com/vicelikedust/gitdiagram/blob/main/src/components/mermaid-diagram.tsx"
    click FrontendAPI "https://github.com/vicelikedust/gitdiagram/blob/main/src/lib/fetch-backend.ts"

    %% Styles
    classDef frontend fill:#3b82f6,color:white
    classDef backend fill:#22c55e,color:white
    classDef security fill:#ef4444,color:white
    classDef external fill:#a855f7,color:white
    classDef database fill:#eab308,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Service"]:::backend
        Security["Security Layer"]:::security
        External["External Service"]:::external
        Database["Database"]:::database
    end
```
