# iamkiddy/event-tickets architecture

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

- Interactive diagram: https://gitdiagram.com/iamkiddy/event-tickets
- Repository: https://github.com/iamkiddy/event-tickets

## Overview

##### Project type and purpose
- This is a full-stack web application built with Next.js (App Router) and TypeScript.
- It provides a public-facing event discovery and ticket-purchasing site (app/(main), app/auth, app/event), plus an organizer/admin dashboard (app/(dashboard)).

##### File structure
- Top-level config & tooling: next.config.ts, tsconfig.json, tailwind.config.ts, postcss.config.mjs, ESLint, Prettier.
- app/ directory (Next.js App Router):
– app/(main): public marketing pages, blog, events, pricing, profile, refund flows.
– app/auth: sign-in, Google OAuth, code verification.
– app/(dashboard): organizer dashboard with events CRUD, finance, teams, settings, help.
– Shared layouts in app/layout.tsx, app/(main)/layout.tsx, app/(dashboard)/layout.tsx.
- components/ directory:
– components/ui: reusable design system primitives (buttons, tables, dialogs, etc.).
– components/custom: higher-level composite widgets (forms, error cards, search fields).
- lib/ directory:
– lib/actions: API client functions (events, orders, blog, auth, organizer, etc.).
– lib/models & lib/schemas: TypeScript interfaces & validation schemas.
– lib/context: React context providers (AuthContext, React Query provider, Toaster).
– lib/apiurls.ts & lib/apiController.tsx: centralize endpoints and request wrapper.
- Public assets in public/, global styles in globals.css.

##### Detail without overthinking
- The goal is to show all essential pieces and how data/requests flow through them.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    Browser["Client (Browser)"]:::frontend

    %% CDN / Assets
    PublicAssets["Public Static Assets\n(public/)"]:::asset
    Browser <-->|"GET /assets"| PublicAssets

    %% Next.js Runtime
    subgraph "Next.js Application" 
        direction TB
        Server["Node.js Server / App Router"]:::backend

        %% Routing & Layouts
        subgraph "Routing & Layouts"
            direction TB
            GlobalLayout["Global Layout\napp/layout.tsx"]:::frontend
            MainLayout["Main Site Layout\napp/(main)/layout.tsx"]:::frontend
            DashboardLayout["Dashboard Layout\napp/(dashboard)/layout.tsx"]:::frontend
            AuthLayout["Auth Pages\napp/auth/"]:::frontend
        end

        %% Presentation Layer
        subgraph "Presentation Layer" 
            direction TB
            MainSite["Public-Facing Site\napp/(main)/"]:::frontend
            AuthModule["Authentication Module\napp/auth/"]:::frontend
            Dashboard["Organizer/Admin Dashboard\napp/(dashboard)/"]:::frontend
            UIPrimitives["UI Primitives\ncomponents/ui/"]:::frontend
            CustomComps["Custom Components\ncomponents/custom/"]:::frontend
        end

        %% State & Data Layer
        subgraph "State & Data Layer"
            direction TB
            AuthContext["AuthContext\nlib/context/AuthContext.tsx"]:::backend
            QueryProvider["QueryProvider\nlib/context/QueryProvider.tsx"]:::backend
            Toaster["Toaster\nlib/context/toaster.tsx"]:::backend
        end

        %% Business / Integration Layer
        subgraph "Business / Integration Layer"
            direction TB
            APIController["Request Wrapper\nlib/apiController.tsx"]:::backend
            APIUrls["API Endpoints\nlib/apiurls.ts"]:::backend
            Actions["API Client Actions\nlib/actions/"]:::backend
        end

        %% Domain Models & Schemas
        subgraph "Domain Models & Schemas"
            direction TB
            Models["Domain Models\nlib/models/"]:::backend
            Schemas["Validation Schemas\nlib/schemas/"]:::backend
        end

        %% Config & Tooling
        subgraph "Configuration & Tooling"
            direction TB
            NextConfig["Next.js Config\nnext.config.ts"]:::config
            TSConfig["TypeScript Config\ntsconfig.json"]:::config
            TailwindConfig["Tailwind Config\ntailwind.config.ts"]:::config
            PostCSS["PostCSS Config\npostcss.config.mjs"]:::config
            ESLint["ESLint Config\n.eslintrc.json"]:::config
            README["README.md"]:::config
            Middleware["Middleware\nmiddleware.ts"]:::config
        end

        %% Connections within Next.js
        Server -->|"uses"| GlobalLayout
        GlobalLayout --> MainLayout
        GlobalLayout --> DashboardLayout
        GlobalLayout --> AuthLayout

        MainLayout --> MainSite
        AuthLayout --> AuthModule
        DashboardLayout --> Dashboard

        MainSite --> UIPrimitives
        MainSite --> CustomComps
        Dashboard --> UIPrimitives
        Dashboard --> CustomComps
        AuthModule --> UIPrimitives
        AuthModule --> CustomComps

        MainSite --> AuthContext
        AuthModule --> AuthContext
        Dashboard --> AuthContext
        MainSite --> QueryProvider
        Dashboard --> QueryProvider

        AuthContext --> APIController
        QueryProvider --> APIController

        APIController --> APIUrls
        APIController --> Actions
        Actions --> Models
        Actions --> Schemas

        %% External Services
    end

    subgraph "External Services"
        direction TB
        AuthAPI["Auth API"]:::external
        EventsAPI["Events API"]:::external
        OrdersAPI["Orders API"]:::external
        BlogAPI["Blog API"]:::external
        OrganizerAPI["Organizer API"]:::external
        GoogleOAuth["Google OAuth"]:::external
        PaymentGateway["Payment Gateway"]:::external
    end

    %% Data flow arrows
    Browser -->|"HTTP GET/POST"| Server
    Actions -->|"auth.ts POST /auth"| AuthAPI
    Actions -->|"events.ts GET /events"| EventsAPI
    Actions -->|"orders.ts POST /orders"| OrdersAPI
    Actions -->|"blog.ts GET /posts"| BlogAPI
    Actions -->|"organizer_actions.ts"| OrganizerAPI
    AuthModule -->|"OAuth flow"| GoogleOAuth
    AuthModule -->|"MomoOTPVerification"| PaymentGateway

    %% Click events
    click MainSite "https://github.com/iamkiddy/event-tickets/tree/main/app/(main)/"
    click AuthModule "https://github.com/iamkiddy/event-tickets/tree/main/app/auth/"
    click Dashboard "https://github.com/iamkiddy/event-tickets/tree/main/app/(dashboard)/"
    click GlobalLayout "https://github.com/iamkiddy/event-tickets/blob/main/app/layout.tsx"
    click MainLayout "https://github.com/iamkiddy/event-tickets/blob/main/app/(main)/layout.tsx"
    click DashboardLayout "https://github.com/iamkiddy/event-tickets/blob/main/app/(dashboard)/layout.tsx"
    click UIPrimitives "https://github.com/iamkiddy/event-tickets/tree/main/components/ui/"
    click CustomComps "https://github.com/iamkiddy/event-tickets/tree/main/components/custom/"
    click Actions "https://github.com/iamkiddy/event-tickets/tree/main/lib/actions/"
    click APIController "https://github.com/iamkiddy/event-tickets/blob/main/lib/apiController.tsx"
    click APIUrls "https://github.com/iamkiddy/event-tickets/blob/main/lib/apiurls.ts"
    click Models "https://github.com/iamkiddy/event-tickets/tree/main/lib/models/"
    click Schemas "https://github.com/iamkiddy/event-tickets/tree/main/lib/schemas/"
    click AuthContext "https://github.com/iamkiddy/event-tickets/blob/main/lib/context/AuthContext.tsx"
    click QueryProvider "https://github.com/iamkiddy/event-tickets/blob/main/lib/context/QueryProvider.tsx"
    click Toaster "https://github.com/iamkiddy/event-tickets/blob/main/lib/context/toaster.tsx"
    click PublicAssets "https://github.com/iamkiddy/event-tickets/tree/main/public/"
    click TailwindConfig "https://github.com/iamkiddy/event-tickets/blob/main/tailwind.config.ts"
    click PostCSS "https://github.com/iamkiddy/event-tickets/blob/main/postcss.config.mjs"
    click NextConfig "https://github.com/iamkiddy/event-tickets/blob/main/next.config.ts"
    click TSConfig "https://github.com/iamkiddy/event-tickets/blob/main/tsconfig.json"
    click ESLint "https://github.com/iamkiddy/event-tickets/blob/main/.eslintrc.json"
    click Middleware "https://github.com/iamkiddy/event-tickets/blob/main/middleware.ts"
    click README "https://github.com/iamkiddy/event-tickets/blob/main/README.md"

    %% Styles
    classDef frontend fill:#E3F2FD,stroke:#64B5F6,stroke-width:2px
    classDef backend fill:#E8F5E9,stroke:#66BB6A,stroke-width:2px
    classDef external fill:#FFEBEE,stroke:#E57373,stroke-width:2px
    classDef config fill:#F3E5F5,stroke:#BA68C8,stroke-width:2px
    classDef asset fill:#FFF3E0,stroke:#FFB74D,stroke-width:2px
```
