# rishikendai/octoviz architecture

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

- Interactive diagram: https://gitdiagram.com/rishikendai/octoviz
- Repository: https://github.com/rishikendai/octoviz

## Overview

##### Project type and purpose
– Octoviz is a full-stack, single-page application that analyzes and visualizes GitHub user profile data.
– The frontend is a React/TypeScript SPA built with Vite, and the backend is a Go (Gin) HTTP API that proxies requests to GitHub’s public API.

##### File structure
– Top level: two peer directories, “frontend” and “server.”
– frontend/ contains:
- Vite build and config files (vite.config.ts, tsconfig.json, vercel.json)
– server/ contains:
- main.go entrypoint, go.mod/go.sum, .air.toml for live reload
- api/v1/controllers/dashboard – HTTP handlers, helpers, types
- api/v1/routes – route definitions
- middleware – CORS, security headers, error handling, request decoding
- pkg/config – environment configuration loader
- pkg/config/response – uniform API response builder

##### README for additional insights
– User enters GitHub URL in frontend → frontend components (Search, ProfileCard, ContributionGraph, TechStack, TopRepo) render data.
– Frontend calls backend endpoints for data; backend uses GitHub Personal Access Token to fetch data and returns JSON.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    User["User"]:::frontend
    Browser["Browser"]:::frontend
    User -->|Interacts| Browser
    Browser -->|Loads SPA| ReactSPA

    %% Frontend Layer
    subgraph "Frontend - React SPA" 
        direction TB
        ReactSPA["React SPA"]:::frontend
        subgraph "React Components"
            direction TB
            Search["Search Component"]:::frontend
            ProfileCard["ProfileCard Component"]:::frontend
            ContributionGraph["ContributionGraph Component"]:::frontend
            TechStack["TechStack Component"]:::frontend
            TopRepo["TopRepo Component"]:::frontend
        end
        subgraph "Pages"
            direction TB
            ProfilePage["Profile Page"]:::frontend
            NotFound["NotFound Page"]:::frontend
        end
        subgraph "Utilities & Data"
            direction TB
            HelperUtils["Helper Utilities"]:::frontend
            ColorsData["colors.json"]:::frontend
        end
        subgraph "Config Files"
            direction TB
            ViteConfig["vite.config.ts"]:::frontend
            TSConfig["tsconfig.json"]:::frontend
            ESLintConfig["eslint.config.js"]:::frontend
            VercelConfig["vercel.json"]:::frontend
        end
        ReactSPA -->|Uses| Search
        ReactSPA -->|Uses| ProfileCard
        ReactSPA -->|Uses| ContributionGraph
        ReactSPA -->|Uses| TechStack
        ReactSPA -->|Uses| TopRepo
        ReactSPA -->|Renders| ProfilePage
        ReactSPA -->|Renders| NotFound
        ReactSPA -->|Calls Helpers| HelperUtils
        ReactSPA -->|Loads Colors| ColorsData
    end

    %% Offline Tool
    subgraph "Offline CLI Tool" 
        direction TB
        CLI["Go CLI Tool"]:::tool
        LangYAML["language.yml"]:::tool
        ColorsJSON["colors.json"]:::tool
        CLI --> LangYAML
        CLI --> ColorsJSON
    end

    %% Backend Layer
    subgraph "Backend - Go Gin API"
        direction TB
        Middleware["Middleware\n(CORS, Security, Error, Decoder)"]:::backend
        Router["Router\n(dashboard routes)"]:::backend
        Controller["Dashboard Controller"]:::backend
        HelperBackend["Helper Functions"]:::backend
        HTTPUtils["HTTP Utils & Types"]:::backend
        ConfigLoader["Config Loader\n(env)"]:::backend
        ResponseBuilder["Response Builder"]:::backend
    end

    %% External Service
    GitHubAPI["GitHub API"]:::external

    %% Data Flows
    ReactSPA -->|HTTPS/JSON Request| Middleware
    Middleware -->|Passes| Router
    Router -->|Routes to| Controller
    Controller -->|Calls| HelperBackend
    HelperBackend -->|Fetches via| GitHubAPI
    GitHubAPI -->|Returns JSON| Controller
    Controller -->|Formats| ResponseBuilder
    ResponseBuilder -->|JSON Response| ReactSPA
    ConfigLoader -->|Provides Env| Controller

    %% Click Events
    click ReactSPA "https://github.com/rishikendai/octoviz/tree/main/frontend/src"
    click Search "https://github.com/rishikendai/octoviz/blob/main/frontend/src/components/common/Search.tsx"
    click ProfileCard "https://github.com/rishikendai/octoviz/blob/main/frontend/src/components/ProfileCard.tsx"
    click ContributionGraph "https://github.com/rishikendai/octoviz/blob/main/frontend/src/components/ContributionGraph.tsx"
    click TechStack "https://github.com/rishikendai/octoviz/blob/main/frontend/src/components/TechStack.tsx"
    click TopRepo "https://github.com/rishikendai/octoviz/blob/main/frontend/src/components/TopRepo.tsx"
    click ProfilePage "https://github.com/rishikendai/octoviz/blob/main/frontend/src/pages/Profile.tsx"
    click NotFound "https://github.com/rishikendai/octoviz/blob/main/frontend/src/pages/Notfound.tsx"
    click HelperUtils "https://github.com/rishikendai/octoviz/blob/main/frontend/src/components/utils/helper.ts"
    click ColorsData "https://github.com/rishikendai/octoviz/blob/main/frontend/src/data/colors.json"
    click ViteConfig "https://github.com/rishikendai/octoviz/blob/main/frontend/vite.config.ts"
    click TSConfig "https://github.com/rishikendai/octoviz/blob/main/frontend/tsconfig.json"
    click ESLintConfig "https://github.com/rishikendai/octoviz/blob/main/frontend/eslint.config.js"
    click VercelConfig "https://github.com/rishikendai/octoviz/blob/main/frontend/vercel.json"
    click CLI "https://github.com/rishikendai/octoviz/blob/main/frontend/tools/go/gh-colors.go"
    click LangYAML "https://github.com/rishikendai/octoviz/blob/main/frontend/tools/go/language.yml"
    click ColorsJSON "https://github.com/rishikendai/octoviz/blob/main/frontend/tools/README.md"
    click Middleware "https://github.com/rishikendai/octoviz/blob/main/server/middleware/cors.go"
    click Middleware "https://github.com/rishikendai/octoviz/blob/main/server/middleware/security_headers.go"
    click Middleware "https://github.com/rishikendai/octoviz/blob/main/server/middleware/error_handler.go"
    click Middleware "https://github.com/rishikendai/octoviz/blob/main/server/middleware/request_body.go"
    click Router "https://github.com/rishikendai/octoviz/blob/main/server/api/v1/routes/dashboard.go"
    click Controller "https://github.com/rishikendai/octoviz/blob/main/server/api/v1/controllers/dashboard/dashboard.go"
    click HelperBackend "https://github.com/rishikendai/octoviz/blob/main/server/api/v1/controllers/dashboard/helper.go"
    click HTTPUtils "https://github.com/rishikendai/octoviz/blob/main/server/api/v1/controllers/dashboard/http_utils.go"
    click HTTPUtils "https://github.com/rishikendai/octoviz/blob/main/server/api/v1/controllers/dashboard/types.go"
    click ConfigLoader "https://github.com/rishikendai/octoviz/blob/main/server/pkg/config/env/env.go"
    click ResponseBuilder "https://github.com/rishikendai/octoviz/blob/main/server/pkg/config/response/response.go"
    click Main "https://github.com/rishikendai/octoviz/blob/main/server/main.go"
    click AirConfig "https://github.com/rishikendai/octoviz/blob/main/server/.air.toml"

    %% Styles
    classDef frontend fill:#e1f5fe,stroke:#0288d1,color:#01579b
    classDef backend fill:#fff3e0,stroke:#f57c00,color:#e65100
    classDef external fill:#e8f5e9,stroke:#43a047,color:#1b5e20
    classDef tool fill:#eeeeee,stroke:#9e9e9e,color:#424242
    class ReactSPA,Search,ProfileCard,ContributionGraph,TechStack,TopRepo,ProfilePage,NotFound,HelperUtils,ColorsData,ViteConfig,TSConfig,ESLintConfig,VercelConfig frontend
    class Middleware,Router,Controller,HelperBackend,HTTPUtils,ConfigLoader,ResponseBuilder backend
    class GitHubAPI external
    class CLI,LangYAML,ColorsJSON tool
```
