# herin7/gitforme architecture

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

- Interactive diagram: https://gitdiagram.com/herin7/gitforme
- Repository: https://github.com/herin7/gitforme

## Overview

##### Project type and purpose
- GitForMe is a full-stack, microservice-based web application whose goal is to help developers explore and understand GitHub repositories via an AI-powered dashboard and chat interface.

##### File structure
- Top-level directories:
- gitforme/   → Frontend (React + Vite + Tailwind + Framer Motion)
- server/    → Node.js/Express backend (authentication, GitHub API integration, business-logic controllers, Redis client)
- llm-server/→ Python/Flask microservice (vector embedding, FAISS index, Azure OpenAI orchestration)
- Supporting files and configs:
- .github/workflows → CI/CD on GitHub Actions, deploy to Azure Static Web Apps
- Dockerfile in llm-server → container for LLM microservice
- Staticwebapp.config.json, azure workflows → Azure deployment

##### README for additional insights
- Microservice architecture: Frontend, Backend, LLM server
- Tech stack explicitly listed under “How It Works: Architecture”
- External dependencies: GitHub OAuth, Azure OpenAI, FAISS

##### Detail without overthinking
- Break each microservice into its critical components (e.g., Node.js: Controllers, Routes, Middlewares)
- Every external interaction: OAuth handshakes, API calls, embedding/storage steps.
- Essential cross-service contracts: REST endpoints, message formats, streaming flows.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        Browser["Browser"]:::external
    end

    %% Frontend Layer
    subgraph "Frontend Layer"
        SWA["Azure Static Web App CDN"]:::frontend
        SPA["React/Vite SPA"]:::frontend

        subgraph "Frontend Modules"
            Pages["Pages"]:::frontend
            Components["Components"]:::frontend
            Cards["Cards"]:::frontend
            Context["AuthContext"]:::frontend
            APIConfig["axios Config"]:::frontend
            PageContent["PageContent"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Backend Layer"
        Express["Express API"]:::backend

        subgraph "Controllers & Routes"
            AuthRoute["AuthRoute"]:::backend
            RepoRoutes["RepoRoutes"]:::backend
            InsightRoutes["InsightRoutes"]:::backend
            AuthController["AuthController"]:::backend
            GithubController["GithubController"]:::backend
            InsightController["InsightController"]:::backend
        end

        subgraph "Utilities & Middleware"
            AuthMiddleware["AuthMiddleware"]:::backend
            RedisClient["Redis Client"]:::backend
            SecretToken["Secret Token Util"]:::backend
            GitHubAPI["GitHub API Module"]:::backend
        end
    end

    %% LLM Layer
    subgraph "LLM Layer"
        Flask["Flask LLM Service"]:::ai
        Dependencies["Dependencies"]:::ai
        DockerCfg["Dockerfile"]:::ai

        subgraph "Embedding Pipeline"
            Transformers["sentence-transformers"]:::ai
            FAISS["FAISS Index"]:::storage
        end

        subgraph "Azure Integration"
            AzureOpenAI["Azure OpenAI API"]:::external
        end
    end

    %% External Services
    subgraph "External Services"
        GitHub["GitHub API/OAuth"]:::external
        RedisDB["Redis Store"]:::storage
    end

    %% Connections
    Browser --> SWA
    SWA --> SPA
    SPA --> Express
    SPA --> APIConfig
    SPA --> Context
    SPA --> Pages
    SPA --> Components
    SPA --> Cards
    SPA --> PageContent

    Express --> AuthRoute
    Express --> RepoRoutes
    Express --> InsightRoutes
    Express --> AuthMiddleware
    Express --> RedisClient
    Express --> SecretToken
    Express --> GitHubAPI

    AuthRoute --> GitHub
    RepoRoutes --> GitHub
    InsightRoutes --> Flask
    Express --> RedisDB

    Flask --> Transformers
    Transformers --> FAISS
    Flask --> AzureOpenAI
    Flask --> Express

    %% Click Events
    click SWA "https://github.com/herin7/gitforme/blob/main/gitforme/staticwebapp.config.json"
    click SPA "https://github.com/herin7/gitforme/tree/main/gitforme/"
    click Pages "https://github.com/herin7/gitforme/tree/main/gitforme/pages/"
    click Components "https://github.com/herin7/gitforme/tree/main/gitforme/src/components/"
    click Cards "https://github.com/herin7/gitforme/tree/main/gitforme/src/cards/"
    click Context "https://github.com/herin7/gitforme/blob/main/gitforme/src/context/AuthContext.jsx"
    click APIConfig "https://github.com/herin7/gitforme/blob/main/gitforme/src/api/axiosConfig.js"
    click PageContent "https://github.com/herin7/gitforme/tree/main/gitforme/src/PageContent/"

    click AuthMiddleware "https://github.com/herin7/gitforme/blob/main/server/Middlewares/AuthMiddleware.js"
    click AuthController "https://github.com/herin7/gitforme/blob/main/server/Controllers/AuthController.js"
    click AuthRoute "https://github.com/herin7/gitforme/blob/main/server/Routes/AuthRoute.js"
    click GitHubAPI "https://github.com/herin7/gitforme/blob/main/server/api/githubApi.js"
    click RepoRoutes "https://github.com/herin7/gitforme/blob/main/server/Routes/RepoRoutes.js"
    click GithubController "https://github.com/herin7/gitforme/blob/main/server/Controllers/GithubController.js"
    click InsightRoutes "https://github.com/herin7/gitforme/blob/main/server/Routes/InsightRoutes.js"
    click InsightController "https://github.com/herin7/gitforme/blob/main/server/Controllers/InsightController.js"
    click RedisClient "https://github.com/herin7/gitforme/blob/main/server/util/RediaClient.js"
    click SecretToken "https://github.com/herin7/gitforme/blob/main/server/util/SecretToken.js"
    click Express "https://github.com/herin7/gitforme/blob/main/server/index.js"

    click Flask "https://github.com/herin7/gitforme/blob/main/llm-server/app.py"
    click Dependencies "https://github.com/herin7/gitforme/blob/main/llm-server/requirements.txt"
    click DockerCfg "https://github.com/herin7/gitforme/tree/main/llm-server/Dockerfile"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#333,stroke-width:1px
    classDef backend fill:#D0FFD6,stroke:#333,stroke-width:1px
    classDef ai fill:#F3D1FF,stroke:#333,stroke-width:1px
    classDef external fill:#F2F2F2,stroke:#333,stroke-width:1px
    classDef storage fill:#FFF4C1,stroke:#333,stroke-width:1px
```
