# ghiberti85/devfinder-ssr architecture

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

- Interactive diagram: https://gitdiagram.com/ghiberti85/devfinder-ssr
- Repository: https://github.com/ghiberti85/devfinder-ssr

## Overview

##### Project type and purpose
- This is a full-stack web application built with Next.js (Node.js + React) using TypeScript and Tailwind CSS.
- It consumes the GitHub REST API to implement:
- A search page (SSR via getServerSideProps)
- A user profile page (ISR via getStaticProps + getStaticPaths)
- It includes dark-mode toggling via React Context and enforces code quality with ESLint/Prettier + Husky.

##### File structure
- Config & tooling (root): next.config.ts, tsconfig.json, postcss.config.mjs, tailwind.config.js, eslint.config.mjs, .husky hooks, .prettierrc.
- Public assets (public/)
- Source code (src/):
- pages/ → file-based routing:
– index.tsx (SSR search page)
– user/[username].tsx (ISR profile page + fallback/404)
- components/ → reusable UI pieces (ThemeToggle, UserCard, etc.)
- context/ → ThemeContext provider for dark mode
- lib/ (mentioned in README) → GitHub API wrappers & utilities
- styles/ → globals.css (Tailwind base + custom)
- types.d.ts → custom TypeScript types

##### Key README insights
- Rendering strategies: SSR for search, ISR for profiles (with incremental regeneration).
- Optional GITHUB_TOKEN via .env.local for rate-limit avoidance.
- Pre-commit linting with Husky + lint-staged.
- Deployed on any Node host or Vercel for built-in SSR/ISR support.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    subgraph "Client"
        BROWSER["Browser (CSR + Hydration)"]:::frontend
    end

    %% Next.js Server
    subgraph "Next.js Server"
        AWRAP["App Wrapper (_app.tsx)"]:::frontend
        THEMECTX["ThemeContext Provider"]:::frontend
        SSR["getServerSideProps (SSR)"]:::server
        INDEX["SSR Search Page"]:::frontend
        ISR["getStaticProps/getStaticPaths + ISR"]:::server
        USERPAGE["ISR User Profile Page"]:::frontend
        APILAYER["API Layer (src/lib)"]:::server
    end

    %% External Services
    subgraph "External Services"
        GITHUB["GitHub REST API v3"]:::external
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        TS["TypeScript Compile"]:::pipeline
        TAILWIND["Tailwind CSS Processing"]:::pipeline
        NEXTBUILD["Next.js Build"]:::pipeline
        CDN["CDN / Static Host"]:::pipeline
    end

    %% Config & Tooling
    subgraph "Config & Tooling"
        NextConfig["next.config.ts"]:::pipeline
        TSConfig["tsconfig.json"]:::pipeline
        PostCSS["postcss.config.mjs"]:::pipeline
        TailwindConf["tailwind.config.js"]:::pipeline
        ESLintConf["eslint.config.mjs"]:::pipeline
        Prettier[".prettierrc"]:::pipeline
        Husky[".husky/pre-commit"]:::pipeline
        Package["package.json\npackage-lock.json"]:::pipeline
        GitIgnore[".gitignore\n.eslintignore"]:::pipeline
    end

    %% Flows
    BROWSER -->|Request “/”| SSR
    SSR -->|calls| APILAYER
    APILAYER -->|REST API v3| GITHUB
    GITHUB -->|data| APILAYER
    APILAYER -->|data| SSR
    SSR -->|renders| INDEX
    INDEX -->|HTML| BROWSER

    BROWSER -->|Request “/user/:username”| ISR
    ISR -->|calls| APILAYER
    APILAYER -->|REST API v3| GITHUB
    GITHUB -->|data| APILAYER
    APILAYER -->|data| ISR
    ISR -->|renders| USERPAGE
    USERPAGE -->|HTML| BROWSER
    ISR -->|caches + revalidate| ISR

    %% Context Wrapping
    BROWSER -->|hydrates| AWRAP
    AWRAP --> THEMECTX
    THEMECTX --> INDEX
    THEMECTX --> USERPAGE

    %% Build & Deployment Flows
    NextConfig --> TS
    TSConfig --> TS
    PostCSS --> TAILWIND
    TailwindConf --> TAILWIND
    ESLintConf --> NEXTBUILD
    Prettier --> NEXTBUILD
    Husky --> NEXTBUILD
    Package --> NEXTBUILD
    GitIgnore --> NEXTBUILD
    TS --> NEXTBUILD
    TAILWIND --> NEXTBUILD
    NEXTBUILD --> CDN

    %% Click Events
    click INDEX "https://github.com/ghiberti85/devfinder-ssr/blob/main/src/pages/index.tsx"
    click USERPAGE "https://github.com/ghiberti85/devfinder-ssr/blob/main/src/pages/user/[username].tsx"
    click AWRAP "https://github.com/ghiberti85/devfinder-ssr/blob/main/src/pages/_app.tsx"
    click THEMECTX "https://github.com/ghiberti85/devfinder-ssr/blob/main/src/context/ThemeContext.tsx"
    click NextConfig "https://github.com/ghiberti85/devfinder-ssr/blob/main/next.config.ts"
    click TSConfig "https://github.com/ghiberti85/devfinder-ssr/blob/main/tsconfig.json"
    click PostCSS "https://github.com/ghiberti85/devfinder-ssr/blob/main/postcss.config.mjs"
    click TailwindConf "https://github.com/ghiberti85/devfinder-ssr/blob/main/tailwind.config.js"
    click ESLintConf "https://github.com/ghiberti85/devfinder-ssr/blob/main/eslint.config.mjs"
    click Prettier "https://github.com/ghiberti85/devfinder-ssr/blob/main/.prettierrc"
    click Husky "https://github.com/ghiberti85/devfinder-ssr/tree/main/.husky/pre-commit"
    click Package "https://github.com/ghiberti85/devfinder-ssr/blob/main/package.json"
    click Package "https://github.com/ghiberti85/devfinder-ssr/blob/main/package-lock.json"
    click GitIgnore "https://github.com/ghiberti85/devfinder-ssr/blob/main/.gitignore"
    click GitIgnore "https://github.com/ghiberti85/devfinder-ssr/blob/main/.eslintignore"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef server fill:#DFFFE0,stroke:#28a745,color:#28a745;
    classDef external fill:#FFE0E0,stroke:#d73a49,color:#d73a49;
    classDef pipeline fill:#FFF4E5,stroke:#e36209,color:#e36209
```
