# jaydip-satani/git-spect architecture

> Architecture diagram of the GitHub repository jaydip-satani/git-spect, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jaydip-satani/git-spect
- Repository: https://github.com/jaydip-satani/git-spect

## Overview

##### Project Type and Purpose
- Gitspect is a single‐page/full-stack (server-rendered) web application built with Next.js.
- It’s a frontend‐centric project that fetches data from an external service (the GitHub API), processes it, and displays interactive visualizations.

##### Main System Components
a. Client Browser
- Renders UI (HTML/CSS/JS).
- Users enter GitHub usernames and interact with the charts/components.
b. Next.js Server (SSR/SSG)
- Hosts React components in the `src/app` and `src/components` directories.
- Responsible for server‐side rendering (or static generation) of pages at build time or on request.
c. Static Asset Host / CDN
- Serves the built JS/CSS bundles, images (in `/public`), and favicon.
- Often implemented via Vercel, Netlify, or any static‐hosting provider.
d. GitHub API (External Service)
- Provides public user data (repos, followers, activity).
- Gitspect sends HTTPS requests to endpoints like `https://api.github.com/users/:username` and GitHub’s REST API for language statistics, commit activity, etc.

##### Relationships and Data Flows
1) User opens the web page in Browser.
2) Browser loads HTML/CSS/JS from CDN.
3) Browser invokes client‐side code (or Next.js SSR fetches on the server) to call the GitHub API.
4) GitHub API returns JSON data.
5) Next.js processes that data, hydrates React components (`GitHubCard`, `GitHubChart`, `GitHubCalendar`).
6) The Browser renders the interactive charts and UI state.
7) For subsequent searches, the Browser repeats steps 3–6 (client‐side fetch).

##### Architectural Patterns and Design Principles
- Component‐based UI (React + Next.js App Router).
- Separation of concerns:
- `src/app` for routing/layout pages (page.tsx, layout.tsx)
- `src/components` for reusable UI pieces ( charts, cards, spinners )
- External API integration: data‐fetching hooks or `fetch` calls within server‐components or client‐components.
- Styling via Tailwind CSS (postcss.config.mjs, tailwind imports in globals.css).

## Diagram (Mermaid)

```mermaid
flowchart TB
    Browser["Client Browser"]:::browser
    CDN["CDN / Static Host"]:::cdn
    GitHubAPI["GitHub API"]:::api

    subgraph "Next.js Server"
        direction TB
        NextjsCore["Next.js"]:::server

        subgraph "App Router"
            direction TB
            LayoutComp["layout.tsx"]:::server
            PageComp["page.tsx"]:::server
        end

        subgraph "Components"
            direction TB
            Card["GitHubCard.tsx"]:::server
            Chart["GitHubChart.tsx"]:::server
            Calendar["GitHubCalendar.tsx"]:::server
            Spinner["LoadingSpinner.tsx"]:::server
            Favicon["DynamicFavicon.tsx"]:::server
        end

        subgraph "Config & Assets"
            direction TB
            Globals["globals.css"]:::server
            PostCSS["postcss.config.mjs"]:::server
            NextConfig["next.config.ts"]:::server
            Public["public"]:::server
        end
    end

    Browser -->|"GET /_next/... JS, CSS, images"|CDN
    CDN -->|"serves JS/CSS, images"|Browser
    CDN -->|"serves SSR assets"|NextjsCore
    Browser -->|"client fetch /users/:username"|GitHubAPI
    NextjsCore -->|"HTTPS GET /users/:username"|GitHubAPI
    GitHubAPI -->|"JSON data"|NextjsCore
    NextjsCore -->|"HTML + JSON props"|Browser

    click NextjsCore "https://github.com/jaydip-satani/git-spect/tree/master/src/app"
    click LayoutComp "https://github.com/jaydip-satani/git-spect/blob/master/src/app/layout.tsx"
    click PageComp "https://github.com/jaydip-satani/git-spect/blob/master/src/app/page.tsx"
    click Globals "https://github.com/jaydip-satani/git-spect/blob/master/src/app/globals.css"
    click Card "https://github.com/jaydip-satani/git-spect/blob/master/src/components/GitHubCard.tsx"
    click Chart "https://github.com/jaydip-satani/git-spect/blob/master/src/components/GitHubChart.tsx"
    click Calendar "https://github.com/jaydip-satani/git-spect/blob/master/src/components/GitHubCalendar.tsx"
    click Spinner "https://github.com/jaydip-satani/git-spect/blob/master/src/components/LoadingSpinner.tsx"
    click Favicon "https://github.com/jaydip-satani/git-spect/blob/master/src/components/DynamicFavicon.tsx"
    click PostCSS "https://github.com/jaydip-satani/git-spect/blob/master/postcss.config.mjs"
    click NextConfig "https://github.com/jaydip-satani/git-spect/blob/master/next.config.ts"
    click Public "https://github.com/jaydip-satani/git-spect/tree/master/public"

    classDef browser fill:#add8e6,stroke:#333,stroke-width:1px
    classDef cdn fill:#90ee90,stroke:#333,stroke-width:1px
    classDef server fill:#20b2aa,stroke:#333,stroke-width:1px
    classDef api fill:#ffcc99,stroke:#333,stroke-width:1px
```
