# midudev/miduconf-website architecture

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

- Interactive diagram: https://gitdiagram.com/midudev/miduconf-website
- Repository: https://github.com/midudev/miduconf-website

## Overview

##### Project type and purpose
- This is a full-stack, content-driven website built with Next.js. Its purpose is to serve as the official site for “miduConf,” a one-day programming conference. It delivers static and server-rendered pages (speaker profiles, agenda, gifts), handles user interactions (ticket sharing), and integrates with third-party services (Supabase for data, Twitch for special-ticket OAuth).

##### File structure
- Top-level configuration files (.env, next.config.js, tailwind.config.js) signal a Next.js + Tailwind CSS setup.
- /public holds static assets (images, stickers).
- /src/pages is the routing layer:
- _app.js/_document.js: custom App and Document wrappers
- /api: Next.js API routes (authentication callbacks, ticket endpoints, Twitch signin)
- index.js, ticket.js: public pages
- /src/lib: client libraries (supabase.js, utils).
- /src/hooks & /src/store: client-side state management and hooks.
- /src/sections: page sections (agenda, sponsors, gifts).
- Deployment: .netlify folder and edge-functions config imply Netlify hosting with Edge Functions.

##### README for additional insights
- It confirms: Next.js, Node.js >=18, npm, local dev on port 3000, unit tests (npm run test).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Browser["User Browser"]:::client

    %% CDN / Static Assets
    subgraph "CDN / Static Assets"
        CDN["Netlify CDN / public"]:::cdn
    end

    %% Next.js Application
    subgraph "Next.js App" 
        direction TB
        subgraph "Pages Layer (SSR/SSG)" 
            direction TB
            Index["index.js"]:::pages
            TicketPage["ticket.js"]:::pages
            AppWrapper["_app.js"]:::pages
            DocumentWrapper["_document.js"]:::pages
        end

        subgraph "API Routes (Serverless)" 
            direction TB
            AuthCallback["auth/callback.js"]:::api
            NumberAPI["number.js"]:::api
            SpecialIndex["special-ticket/index.js"]:::api
            TwitchCallback["special-ticket/twitch.ts"]:::api
            TwitchSignin["twitch/signin.ts"]:::api
        end

        subgraph "Components Library" 
            direction TB
            Avatar["Avatar.jsx"]:::component
            Card["Card.jsx"]:::component
            Modal["Modal.tsx"]:::component
            ShareBtn["ShareTicketButton.jsx"]:::component
            TwitchBlock["TwitchBlock.jsx"]:::component
        end

        subgraph "Sections" 
            direction TB
            Agenda["agenda.tsx"]:::section
            Gifts["gifts.tsx"]:::section
            Sponsors["sponsors.tsx"]:::section
            TicketHome["ticket-home.tsx"]:::section
            LayoutSection["layout.tsx"]:::section
        end

        subgraph "Lib & Utils" 
            direction TB
            SupaLib["supabase.js"]:::lib
            Utils["utils.ts"]:::lib
        end

        subgraph "State & Hooks" 
            direction TB
            UseTime["useRemainingTime.ts"]:::hook
            Store["store/index.js"]:::hook
        end
    end

    %% Database / Auth
    SupabaseDB["Supabase (PostgreSQL + Auth)"]:::database

    %% External OAuth
    Twitch["Twitch OAuth"]:::external

    %% Edge Functions Config
    NetlifyConfig[".netlify/edge-functions-import-map.json"]:::config

    %% Connections
    Browser -->|"page request"| Index
    Browser -->|"page request"| TicketPage
    Browser -->|"static assets"| CDN
    Browser -->|"hydrates app"| AppWrapper

    Index -->|"imports sections/components"| Agenda
    Index -->|"imports lib/hooks"| SupaLib
    TicketPage -->|"imports sections/components"| TicketHome
    AppWrapper -->|"wraps pages"| DocumentWrapper

    Browser -->|"API call"| AuthCallback
    Browser -->|"API call"| NumberAPI
    Browser -->|"API call"| SpecialIndex
    Browser -->|"API call"| TwitchSignin

    AuthCallback -->|"uses lib"| SupaLib
    NumberAPI -->|"uses lib"| SupaLib
    SpecialIndex -->|"uses lib"| SupaLib
    TwitchSignin -->|"redirects to"| Twitch

    AuthCallback -->|"queries"| SupabaseDB
    NumberAPI -->|"queries"| SupabaseDB
    SpecialIndex -->|"queries"| SupabaseDB

    SupaLib -->|"connects to"| SupabaseDB

    Next.jsAppClick[ ]:::invisible

    NetlifyConfig -->|"configures"| CDN

    %% Click events
    click Index "https://github.com/midudev/miduconf-website/blob/main/src/pages/index.js"
    click TicketPage "https://github.com/midudev/miduconf-website/blob/main/src/pages/ticket.js"
    click AppWrapper "https://github.com/midudev/miduconf-website/blob/main/src/pages/_app.js"
    click DocumentWrapper "https://github.com/midudev/miduconf-website/blob/main/src/pages/_document.js"
    click AuthCallback "https://github.com/midudev/miduconf-website/blob/main/src/pages/api/auth/callback.js"
    click NumberAPI "https://github.com/midudev/miduconf-website/blob/main/src/pages/api/number.js"
    click SpecialIndex "https://github.com/midudev/miduconf-website/blob/main/src/pages/api/special-ticket/index.js"
    click TwitchCallback "https://github.com/midudev/miduconf-website/blob/main/src/pages/api/special-ticket/twitch.ts"
    click TwitchSignin "https://github.com/midudev/miduconf-website/blob/main/src/pages/api/twitch/signin.ts"
    click Avatar "https://github.com/midudev/miduconf-website/blob/main/src/components/Avatar.jsx"
    click Card "https://github.com/midudev/miduconf-website/blob/main/src/components/Card.jsx"
    click Modal "https://github.com/midudev/miduconf-website/blob/main/src/components/Modal.tsx"
    click ShareBtn "https://github.com/midudev/miduconf-website/blob/main/src/components/ShareTicketButton.jsx"
    click TwitchBlock "https://github.com/midudev/miduconf-website/blob/main/src/components/TwitchBlock.jsx"
    click Agenda "https://github.com/midudev/miduconf-website/blob/main/src/sections/agenda.tsx"
    click Gifts "https://github.com/midudev/miduconf-website/blob/main/src/sections/gifts.tsx"
    click Sponsors "https://github.com/midudev/miduconf-website/blob/main/src/sections/sponsors.tsx"
    click TicketHome "https://github.com/midudev/miduconf-website/blob/main/src/sections/ticket-home.tsx"
    click LayoutSection "https://github.com/midudev/miduconf-website/blob/main/src/sections/layout.tsx"
    click SupaLib "https://github.com/midudev/miduconf-website/blob/main/src/lib/supabase.js"
    click Utils "https://github.com/midudev/miduconf-website/blob/main/src/lib/utils.ts"
    click UseTime "https://github.com/midudev/miduconf-website/blob/main/src/hooks/useRemainingTime.ts"
    click Store "https://github.com/midudev/miduconf-website/blob/main/src/store/index.js"
    click NetlifyConfig "https://github.com/midudev/miduconf-website/blob/main/.netlify/edge-functions-import-map.json"

    %% Styles
    classDef client fill:#bbdefb,stroke:#1e88e5,color:#000
    classDef cdn fill:#bbdefb,stroke:#1e88e5,color:#000
    classDef pages fill:#ffcc80,stroke:#e65100,color:#000
    classDef api fill:#ffcc80,stroke:#e65100,color:#000
    classDef component fill:#ffe0b2,stroke:#fb8c00,color:#000
    classDef section fill:#ffe0b2,stroke:#fb8c00,color:#000
    classDef lib fill:#c8e6c9,stroke:#388e3c,color:#000
    classDef hook fill:#c8e6c9,stroke:#388e3c,color:#000
    classDef database fill:#a5d6a7,stroke:#2e7d32,color:#000
    classDef external fill:#e1bee7,stroke:#6a1b9a,color:#000
    classDef config fill:#cfd8dc,stroke:#455a64,color:#000
    classDef invisible fill-opacity:0,stroke-opacity:0,color-opacity:0
```
