# rishi-gurjar/webpage architecture

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

- Interactive diagram: https://gitdiagram.com/rishi-gurjar/webpage
- Repository: https://github.com/rishi-gurjar/webpage

## Overview

##### Main Components
- Frontend Application (Next.js):
- Components and Pages: Located in src/app and src/components/ui. Note that the project leverages the latest Next.js app directory structure for page routing.
- MDX & Blog Content: Pages for the blog and MDX integration are present, with markdown files residing in src/blog-content.
- Public Assets: Static files, images, interestingly a JS-DOS integration (in public/jsdoom) and a WASM module (public/ort-wasm.wasm) are used, which should be highlighted separately.
- Backend Server:
- API Server/Core Logic: Found in src/server (with index.ts, routes, and server-specific configuration). This handles API endpoints and probably server-side rendering or additional backend tasks.
- Services & Watchers: Under src/server/services you have modules for emailService, gitService, llmService, and v9Service. Also, src/server/watchers (e.g., blogWatcher.ts) indicates background processes tied to content updates or other events.
- Configuration & Build Tools:
- Build files (next.config.mjs, tailwind.config.ts, postcss.config.mjs, tsconfig.json) and package management (package.json, package-lock.json) should be noted as they control project assembly and style.
- External Tools & Frameworks:
- Integration with shadcn-ui components (as seen in instructions in the README) which influences the design of the UI components.

##### Diagramming the Relationships and Interactions
- Next.js Page Components (src/app pages).
- UI Components (from src/components/ui).
- Blog/Mdx Integration: Reference to markdown files (src/blog-content).
- Public Assets Container: Illustrate static file serving (public folder) including special directories such as jsdoom for game integration.
- API Routes: Emphasize src/server/routes/api.ts as a central integration point.
- Services Layer: Group emailService, gitService, llmService, and others from src/server/services.
- Watchers/Background Tasks: Note the blogWatcher under src/server/watchers.
- UI-to-API communication (data flow from the frontend to backend services for dynamic content or processing).
- Static Asset serving from the public folder directly to the client.
- Internal interactions between the backend server and its various services.
- Possible monitoring or update processes (for example, how blogWatcher might trigger content updates that eventually reflect in the frontend).

##### Highlighting Architectural Patterns and Technologies
- Separation of Concerns: The division between presentation (Next.js pages/components) and backend processing (API server & services) is clear.
- Modern React & Next.js Architecture: Use of the app directory signals server-side rendering and incremental adoption of React Server Components.
- Service-Oriented Design: Backend services are modularized, indicating that each has a clear responsibility (email, version control, LLM, etc.).
- Static Content & Dynamic Data: The use of a public folder combined with MD content shows a hybrid approach to content delivery.

##### Elements
- “Frontend” or “Next.js Application” for client-side components.
- “Backend API Server” for the server logic.
- “Service Modules” for emailService, gitService, llmService, etc.
- “Static Assets & External Libraries” for public assets and shadcn-ui.
- Flow from user requests hitting the frontend, which communicates with the backend through API endpoints.
- Flow of data from the backend’s services to the frontend.
- Differentiate Components Visually:

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Application
    subgraph "Frontend Application"
        FP["Next.js Pages"]:::frontend
        FC["UI Components"]:::frontend
        FMD["MDX & Blog Content"]:::frontend
    end

    %% Static Assets & External Libraries
    subgraph "Static & External Assets"
        PA["Public Assets"]:::external
        JD["JS-DOS Integration"]:::external
        WM["WASM Module"]:::external
        EX["shadcn-ui Library"]:::external
    end

    %% Backend Server
    subgraph "Backend Server"
        API["API Server Core Logic"]:::backend
        subgraph "Backend Services"
            ES["Email Service"]:::backendService
            GS["Git Service"]:::backendService
            LS["LLM Service"]:::backendService
            VS["V9 Service"]:::backendService
        end
        BW["Background Watchers"]:::backendWatcher
    end

    %% Connections - Frontend
    FP -->|"calls"| API
    FC -->|"utilizes"| EX
    PA -->|"serves"| FP
    JD -->|"serves"| FP
    WM -->|"serves"| FP

    %% Connections - Backend
    API -->|"invokes"| ES
    API -->|"invokes"| GS
    API -->|"invokes"| LS
    API -->|"invokes"| VS

    %% Interaction: Background Watchers update MD content
    BW -->|"triggers"| FMD

    %% Click Events
    click FP "https://github.com/rishi-gurjar/webpage/tree/main/src/app"
    click FC "https://github.com/rishi-gurjar/webpage/tree/main/src/components/ui"
    click FMD "https://github.com/rishi-gurjar/webpage/tree/main/src/blog-content"
    click PA "https://github.com/rishi-gurjar/webpage/tree/main/public"
    click JD "https://github.com/rishi-gurjar/webpage/tree/main/public/jsdoom"
    click WM "https://github.com/rishi-gurjar/webpage/blob/main/public/ort-wasm.wasm"
    click API "https://github.com/rishi-gurjar/webpage/blob/main/src/server/routes/api.ts"
    click ES "https://github.com/rishi-gurjar/webpage/blob/main/src/server/services/emailService.ts"
    click GS "https://github.com/rishi-gurjar/webpage/blob/main/src/server/services/gitService.ts"
    click LS "https://github.com/rishi-gurjar/webpage/blob/main/src/server/services/llmService.ts"
    click VS "https://github.com/rishi-gurjar/webpage/blob/main/src/server/services/v9Service.ts"
    click BW "https://github.com/rishi-gurjar/webpage/blob/main/src/server/watchers/blogWatcher.ts"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#1E90FF,stroke-width:2px;
    classDef external fill:#E6E6FA,stroke:#9370DB,stroke-width:2px;
    classDef backend fill:#FFE4B5,stroke:#FF8C00,stroke-width:2px;
    classDef backendService fill:#FFF5EE,stroke:#CD853F,stroke-width:2px;
    classDef backendWatcher fill:#F5DEB3,stroke:#D2691E,stroke-width:2px;
```
