# johanperjulius1/top architecture

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

- Interactive diagram: https://gitdiagram.com/johanperjulius1/top
- Repository: https://github.com/johanperjulius1/top

## Overview

##### Project type and purpose
- This is a Next.js (React) application, bootstrapped via `create-next-app`.
- Purpose: A static/SSR site listing casinos and categories (e.g., “alla-casinon”, “casino-med-bankid”), rendering pages from local Markdown-like data under `src/lib` and `casinos`/`categories` folders, along with a set of shared React components (badge board, FAQ, toplist, etc.).

##### File structure
- Top-level files: `package.json`, `next.config.mjs`, TypeScript config, ESLint config.
- `public/`: Static assets (images, badges, logos).
- `src/app/`: Next.js App Router—per-route directories (e.g., `[id]`, `alla-casinon`, etc.) each with its `page.tsx`.
- `src/components/`: Reusable React UI components (badge-board, faq, feber, footer, menu, toplist) each with accompanying CSS modules.
- `src/lib/`: Data layer / utils (e.g., `casinos-data.ts`, `categories-utils.ts`, `toplist-utils.ts`).
- `src/types/`: Shared TypeScript types.

##### README
- Confirms Next.js, SSG/SSR usage, local development via `npm run dev`, deployment to Vercel.
- No external API integrations mentioned—data is authored locally.

##### Main components
a. User’s Browser (Client)
b. CDN / Vercel Edge (Optional)
c. Next.js Serverless Functions (Routing & Rendering Engine)
d. Data Layer (Local Markdown/data files via `src/lib`)
e. React Components & Layout (UI Layer under `src/app` & `src/components`)
f. Static Assets (Images, CSS Modules in `public/`)

##### Relationships & interactions
- Browser → HTTP Request → CDN/Vercel Edge
- CDN → Next.js Serverless →
- Reads route definitions in `src/app/`
- Fetches data via `src/lib` (during SSG or on-demand SSR)
- Assembles React component tree (`layout.tsx` + `page.tsx` + child components)
- Applies CSS modules
- Bundles and returns HTML/CSS/JS
- Browser loads static assets (images, fonts) directly from CDN or `public/` directory.

##### Architectural patterns & principles
- App-Router structure (folder-based routing).
- Static Site Generation (SSG) for category and casino pages, with fallback SSR for dynamic `[id]` routes.
- Componentization: UI atoms/molecules (badge-board, faq, etc.).
- Data-first: All content is sourced locally, no external API dependencies.

##### Relevant technologies/frameworks
- Next.js (App Router, SSG/SSR)
- React (Function components, TSX)
- TypeScript (types in `src/types/`)
- CSS Modules for scoped styling
- Vercel (deployment, edge/CDN)

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["Client Browser"]:::external
    CDN["CDN / Vercel Edge"]:::infra
    NextServer["Next.js Server\u000A(Serverless Routing & Rendering)"]:::infra

    subgraph "Data Layer"
      RawCasinos["Raw Casino Markdown (casinos/)"]:::data
      RawCategories["Raw Category Markdown (categories/)"]:::data
      Lib["Data Utilities (src/lib/)"]:::data
    end

    subgraph "UI Layer"
      AppRouter["Next.js App Router (src/app/)"]:::ui
      Components["React UI Components (src/components/)"]:::ui
    end

    Static["Static Assets (public/)"]:::assets

    Browser -->|HTTP Request| CDN
    CDN --> NextServer
    NextServer -->|Reads Data| RawCasinos
    NextServer -->|Reads Data| RawCategories
    NextServer -->|Uses Utilities| Lib
    NextServer -->|Renders Pages| AppRouter
    AppRouter -->|Composes UI| Components
    NextServer -->|Returns HTML/CSS/JS| Browser
    Browser -->|Fetches Assets| Static

    classDef external fill:#DDEBF7,stroke:#91C4F2
    classDef infra fill:#F2F2F2,stroke:#CCCCCC
    classDef data fill:#E2EFDA,stroke:#8FB77E
    classDef ui fill:#DEEAF6,stroke:#6C8EBF
    classDef assets fill:#FFF2CC,stroke:#D6B656

    click RawCasinos "https://github.com/johanperjulius1/top/tree/main/casinos/"
    click RawCategories "https://github.com/johanperjulius1/top/tree/main/categories/"
    click Lib "https://github.com/johanperjulius1/top/tree/main/src/lib/"
    click AppRouter "https://github.com/johanperjulius1/top/tree/main/src/app/"
    click Components "https://github.com/johanperjulius1/top/tree/main/src/components/"
    click Static "https://github.com/johanperjulius1/top/tree/main/public/"
```
