# kpcreative/event-organiser architecture

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

- Interactive diagram: https://gitdiagram.com/kpcreative/event-organiser
- Repository: https://github.com/kpcreative/event-organiser

## Overview

##### Project type and purpose
- This is a Next.js full-stack web application using the App Router (v13+) for server-side rendering (SSR), static generation (SSG), nested layouts, and middleware (authentication gating). It’s bootstrapped via create-next-app and styled with Tailwind CSS.

##### File structure
- Top-level directories/files:
- `app/` – The App Router, containing nested route segments: `(auth)` (sign-in, sign-up) and `(root)` (main pages).
- `components/` – Shared UI components (Header, Footer, MobileNav, NavItems) and lower-level UI primitives (`ui/button.tsx`, `ui/separator.tsx`, `ui/sheet.tsx`).
- `lib/` – Utility functions (`utils.ts`).
- `constants/` – Shared constants, e.g. configuration values.
- `middleware.ts` – Next.js middleware for request interception (e.g. auth checks).
- Config files: `next.config.ts`, `postcss.config.js`, `tailwind.config.ts`, `tsconfig.json`.
- Global styling: `app/globals.css`.

##### README for additional insights
- Confirms Next.js, use of next/font, Vercel deployment. No backend API routes defined, so backend logic lives in server components and middleware.

a. Main components
- Client (Browser)
- Next.js Server (App Router + Middleware)
- React Server Components (pages under `app/`)
- React Client Components (UI primitives and shared components)
- Build & Styling Pipeline (Tailwind CSS, PostCSS)
- External Services (e.g. Vercel for fonts & hosting)

b. Relationships and interactions
1. User’s browser sends HTTP request → Next.js Server
2. Request passes through `middleware.ts` (e.g. auth guard)
3. Routing via `app/` segments:
- Auth routes under `(auth)` → Sign-in / Sign-up pages
- Root layout under `(root)` → Primary pages
4. Server components render markup (SSR/SSG), fetching any server-side data (if any).
5. React client components hydrate on the browser, using shared UI primitives.
6. CSS pipeline (Tailwind → PostCSS → final CSS) applies styles.
7. Static assets served from `/public`.
8. External calls (e.g. font optimization via next/font on Vercel).

c. Architectural patterns & design principles
- Next.js App Router with nested layouts & server components
- Separation of concerns: layouts, pages, shared UI, low-level UI primitives
- Utility and constants layers for business logic and config
- Middleware for cross-cutting concerns (authentication)
- Tailwind + PostCSS for design system consistency

d. Relevant technologies
- Next.js (App Router, SSR/SSG)
- React Server & Client Components
- Tailwind CSS, PostCSS
- TypeScript
- Vercel (font optimization, hosting)

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Client Layer"
        Browser["Browser"]:::client
    end

    Browser -->|HTTP Request| Middleware["Middleware (Auth Guard)"]:::server
    click Middleware "https://github.com/kpcreative/event-organiser/blob/main/middleware.ts"

    subgraph "Next.js Server"
        Router["App Router"]:::server
    end

    Middleware --> Router

    Router --> GlobalLayout["Global App Layout"]:::server
    click GlobalLayout "https://github.com/kpcreative/event-organiser/blob/main/app/layout.tsx"

    Router --> GlobalsCSS["Global Stylesheet"]:::build
    click GlobalsCSS "https://github.com/kpcreative/event-organiser/blob/main/app/globals.css"

    subgraph "Routing Segments"
        subgraph "(auth) Authentication"
            AuthLayout["Auth Layout"]:::server
            click AuthLayout "https://github.com/kpcreative/event-organiser/blob/main/app/(auth)/layout.tsx"
            SignIn["Sign-In Page"]:::server
            click SignIn "https://github.com/kpcreative/event-organiser/blob/main/app/(auth)/sign-in/[[...sign-in]]/page.tsx"
            SignUp["Sign-Up Page"]:::server
            click SignUp "https://github.com/kpcreative/event-organiser/blob/main/app/(auth)/sign-up/[[...sign-up]]/page.tsx"
        end

        subgraph "(root) Main App"
            RootLayout["Main Layout"]:::server
            click RootLayout "https://github.com/kpcreative/event-organiser/blob/main/app/(root)/layout.tsx"
            RootPage["Main Root Page"]:::server
            click RootPage "https://github.com/kpcreative/event-organiser/blob/main/app/(root)/page.tsx"
        end
    end

    GlobalLayout --> AuthLayout
    AuthLayout --> SignIn
    AuthLayout --> SignUp

    GlobalLayout --> RootLayout
    RootLayout --> RootPage

    Router --> Utilities["Utility Functions"]:::server
    click Utilities "https://github.com/kpcreative/event-organiser/blob/main/lib/utils.ts"
    Router --> ConfigConstants["Shared Constants"]:::server
    click ConfigConstants "https://github.com/kpcreative/event-organiser/blob/main/constants/index.ts"

    Router --> ServerComponents["Server Components"]:::server

    ServerComponents --> ClientComponentsGroup
    subgraph "Shared UI Components"
        Header["Header"]:::clientcomp
        click Header "https://github.com/kpcreative/event-organiser/blob/main/components/shared/Header.tsx"
        Footer["Footer"]:::clientcomp
        click Footer "https://github.com/kpcreative/event-organiser/blob/main/components/shared/Footer.tsx"
        MobileNav["MobileNav"]:::clientcomp
        click MobileNav "https://github.com/kpcreative/event-organiser/blob/main/components/shared/MobileNav.tsx"
        NavItems["NavItems"]:::clientcomp
        click NavItems "https://github.com/kpcreative/event-organiser/blob/main/components/shared/NavItems.tsx"
    end

    ServerComponents --> UIPrimitivesGroup
    subgraph "Low-Level UI Primitives"
        Button["Button"]:::clientcomp
        click Button "https://github.com/kpcreative/event-organiser/blob/main/components/ui/button.tsx"
        Separator["Separator"]:::clientcomp
        click Separator "https://github.com/kpcreative/event-organiser/blob/main/components/ui/separator.tsx"
        Sheet["Sheet"]:::clientcomp
        click Sheet "https://github.com/kpcreative/event-organiser/blob/main/components/ui/sheet.tsx"
    end

    Browser -->|Asset Request| StaticAssets["Static Assets"]:::static
    click StaticAssets "https://github.com/kpcreative/event-organiser/tree/main/public/assets/"

    subgraph "Build & Styling Pipeline"
        Tailwind["Tailwind CSS Config"]:::build
        click Tailwind "https://github.com/kpcreative/event-organiser/blob/main/tailwind.config.ts"
        PostCSS["PostCSS Config"]:::build
        click PostCSS "https://github.com/kpcreative/event-organiser/blob/main/postcss.config.js"
        NextConfig["Next.js Config"]:::build
        click NextConfig "https://github.com/kpcreative/event-organiser/blob/main/next.config.ts"
        TSConfig["TS Config"]:::build
        click TSConfig "https://github.com/kpcreative/event-organiser/blob/main/tsconfig.json"
        PackageJSON["package.json"]:::build
        click PackageJSON "https://github.com/kpcreative/event-organiser/blob/main/package.json"
        PackageLock["package-lock.json"]:::build
        click PackageLock "https://github.com/kpcreative/event-organiser/blob/main/package-lock.json"
    end

    Browser -->|Loads Styles & Scripts| BuildPipelineGroup
    subgraph "BuildPipelineGroup"
        Tailwind
        PostCSS
        NextConfig
        TSConfig
        PackageJSON
        PackageLock
    end

    BuildPipelineGroup --> ExternalServices["External Services (Vercel & Fonts)"]:::external

    classDef client fill:#BBDEFB,stroke:#333,stroke-width:1px;
    classDef server fill:#FFE082,stroke:#333,stroke-width:1px;
    classDef clientcomp fill:#90CAF9,stroke:#333,stroke-width:1px;
    classDef static fill:#C8E6C9,stroke:#333,stroke-width:1px;
    classDef build fill:#E1BEE7,stroke:#333,stroke-width:1px;
    classDef external fill:#E0E0E0,stroke:#333,stroke-width:1px;
```
