# jeffkko/ticket-ninja-site architecture

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

- Interactive diagram: https://gitdiagram.com/jeffkko/ticket-ninja-site
- Repository: https://github.com/jeffkko/ticket-ninja-site

## Overview

##### Project Type and Purpose
- This is a Next.js–based static/SSR marketing site for “TICKET.Ninja,” which serves as an informational and promotional frontend.
- It does not include its own backend/API or database layers; it relies on static generation and external services (e.g., Google Analytics, Discord).

##### File Structure
- Top‐Level Files:
- next.config.js, tsconfig.json, package.json → build & config
- pages/ → Next.js routing (SSR/SSG React pages)
- src/ → shared React components, theming, analytics integration
- No “api/” or “backend/” folder indicates no custom server APIs – this is purely a frontend app.

##### Extract Key Insights from the README
- Purpose: A peaceful ticket‐snatching discussion platform, modernizing Taiwan’s ticket‐buying system.
- External Links: Discord, “about” page, social channels.

##### Main Components
a. Client (User’s Browser)
- Loads React/Next.js pages (HTML, JS, CSS)
- Interacts with the UI components (src/*.tsx)
b. Hosting/CDN Layer (Vercel, Netlify, or similar)
- Serves pre‐rendered static pages or SSR responses
- Caches assets from public/
c. Build Pipeline
- next build & next export steps, using next.config.js, tsconfig.json, .prettierrc
- Emotion CSS-in-JS via createEmotionCache.ts & theme.ts
d. External Services
- Google Analytics 4 (ga4.ts, useGoogleAnalytics.ts)
- Discord (link out)
- Sitemap (public/sitemap.xml)
e. Development Tooling
- TypeScript (next-env.d.ts)
- ESLint/Prettier (.prettierrc)
- VSCode settings (.vscode/)

##### Relationships & Interactions
- Browser ←→ CDN/Hosting: Initial page requests (SSG or SSR), static assets fetch
- Browser → Google Analytics: Pageview & event tracking calls
- Browser → External links (Discord, About) via <Link> components
- CI/CD → Git repo & build pipeline → CDN/Hosting deploy

##### Architectural Patterns & Design Principles
- Component‐based React UI (src/ stand‐alone components)
- Static Site Generation (SSG) & Incremental Static Regeneration (ISR) via Next.js
- Separation of concerns:
- pages/ for routing
- src/ for reusable UI and logic
- public/ for assets
- CSS‐in‐JS with Emotion for theme consistency

##### Technologies, Frameworks & Libraries
- Next.js (React SSR/SSG framework)
- TypeScript
- Emotion (styled components & theming)
- Google Analytics 4
- Prettier / VSCode for code style

##### Final Advice
- Be thorough but not cluttered: group UI components together, group config/build tools together.
- Every folder’s role in the pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Browser["User Browser"]:::external

    subgraph "Frontend Application"
        subgraph "Routing Layer (Next.js Pages)"
            NextPages["pages/"]:::frontend
        end
        subgraph "UI Components (src)"
            UIComp["src/"]:::frontend
        end
        subgraph "Static Assets (public)"
            StaticAssets["public/"]:::frontend
        end
    end

    subgraph "Emotion Theming & Cache"
        EmotionCache["Emotion (createEmotionCache.ts, theme.ts)"]:::build
    end

    subgraph "Build Pipeline & Config"
        Build["Build Pipeline (next build, next export)"]:::build
        ConfigFiles["Config Files (next.config.js, tsconfig.json, next-env.d.ts, package.json, .prettierrc)"]:::build
    end

    subgraph "External Services"
        GA["Google Analytics (ga4.ts, useGoogleAnalytics.ts)"]:::service
        Discord["Discord Link"]:::service
        Sitemap["Sitemap (sitemap.xml)"]:::service
    end

    subgraph "CI/CD & Hosting"
        CI["CI/CD & Git Repo"]:::devtool
        Hosting["CDN/Hosting (Vercel/Netlify)"]:::devtool
    end

    subgraph "Development Tooling & Docs"
        DevTool[".vscode/"]:::devtool
        README["README.md"]:::devtool
    end

    %% Relationships
    Browser -->|"requests pages/static assets"| Hosting
    Hosting --> NextPages
    Hosting --> StaticAssets
    NextPages --> UIComp
    UIComp --> EmotionCache
    CI --> Build
    Build --> Hosting
    Build --> ConfigFiles
    Build --> EmotionCache
    Browser -->|"tracking calls"| GA
    Browser -->|"external link"| Discord
    Browser -->|"fetch sitemap"| Sitemap

    %% Click Events
    click NextPages "https://github.com/jeffkko/ticket-ninja-site/tree/master/pages/"
    click UIComp "https://github.com/jeffkko/ticket-ninja-site/tree/master/src/"
    click StaticAssets "https://github.com/jeffkko/ticket-ninja-site/tree/master/public/"
    click EmotionCache "https://github.com/jeffkko/ticket-ninja-site/blob/master/src/createEmotionCache.ts"
    click EmotionCache "https://github.com/jeffkko/ticket-ninja-site/blob/master/src/theme.ts"
    click GA "https://github.com/jeffkko/ticket-ninja-site/blob/master/src/ga4.ts"
    click GA "https://github.com/jeffkko/ticket-ninja-site/blob/master/src/useGoogleAnalytics.ts"
    click ConfigFiles "https://github.com/jeffkko/ticket-ninja-site/blob/master/next.config.js"
    click ConfigFiles "https://github.com/jeffkko/ticket-ninja-site/blob/master/tsconfig.json"
    click ConfigFiles "https://github.com/jeffkko/ticket-ninja-site/blob/master/next-env.d.ts"
    click ConfigFiles "https://github.com/jeffkko/ticket-ninja-site/blob/master/package.json"
    click ConfigFiles "https://github.com/jeffkko/ticket-ninja-site/blob/master/.prettierrc"
    click DevTool "https://github.com/jeffkko/ticket-ninja-site/tree/master/.vscode/"
    click README "https://github.com/jeffkko/ticket-ninja-site/blob/master/README.md"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#2196F3,color:#0D47A1;
    classDef build fill:#FFF3E0,stroke:#FB8C00,color:#E65100;
    classDef service fill:#E8F5E9,stroke:#43A047,color:#1B5E20;
    classDef devtool fill:#F3E5F5,stroke:#8E24AA,color:#4A148C;
    classDef external fill:#FFEBEE,stroke:#E53935,color:#B71C1C;
```
