# tfhuneck/event-response-app architecture

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

- Interactive diagram: https://gitdiagram.com/tfhuneck/event-response-app
- Repository: https://github.com/tfhuneck/event-response-app

## Overview

##### Project type and purpose
- This is a full-stack Next.js application using the App Router (src/app) to serve both UI pages and REST-style API endpoints.
- It provides event management: admins can create/edit events and slots; guests receive invites and confirm or submit alternative responses.
- Key technologies: React, Next.js, NextAuth.js for authentication, Prisma ORM for database access, Tailwind CSS for styling.

##### File structure
- Top-level:
- next.config.mjs, postcss.config.mjs, tailwind.config.ts – framework and styling configs
- prisma/schema.prisma – data model and database schema
- package.json, package-lock.json – dependencies and scripts
- src/app – Next.js pages and API routes:
- /admin – admin UI pages (dashboard, create event, view/edit event, view responses)
- /api – route handlers (auth, create/edit/delete event, create/delete slot, submit response, check-in)
- /invite, /confirm – nested routes for invite flows and confirmation UI
- layout.tsx, middleware.ts – global UI layout and request middleware (auth guard, redirects)
- src/components – reusable React components (forms, lists, date/time pickers, UI primitives in components/ui)
- src/lib – shared utilities (auth wrappers, axiosInstance, Prisma client, session helpers)

##### README
- Confirms a standard Next.js project scaffold.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Browser
    Browser["User's Browser"]:::user
    Browser -->|"HTTP GET/POST"| Frontend

    %% Frontend UI
    subgraph "Frontend UI (Next.js Pages)" 
        direction TB
        Layout["layout.tsx"]:::frontend
        Home["page.tsx"]:::frontend
        Login["login/page.tsx"]:::frontend
        AdminDashPage["admin/page.tsx"]:::frontend
        AdminCreate["admin/create/page.tsx"]:::frontend
        EventView["admin/event/[id]/page.tsx"]:::frontend
        EventEdit["admin/event/[id]/edit/page.tsx"]:::frontend
        ResponsesView["admin/event/[id]/responses/page.tsx"]:::frontend
        AltResponses["admin/altresponses/page.tsx"]:::frontend
        InviteFlow["invite/[id]/[firstname]/[lastname]/[email]/[responseid]/page.tsx"]:::frontend
        Confirm["confirm/[responseid]/page.tsx"]:::frontend
        ConfirmAlt["confirm/alt/[responseid]/page.tsx"]:::frontend
    end

    Frontend[/"Frontend UI"/]:::frontend
    Frontend --> Layout
    Layout --> Home
    Layout --> Login
    Layout --> AdminDashPage
    Layout --> AdminCreate
    Layout --> EventView
    Layout --> EventEdit
    Layout --> ResponsesView
    Layout --> AltResponses
    Layout --> InviteFlow
    Layout --> Confirm
    Layout --> ConfirmAlt

    %% API Layer
    subgraph "API Layer (Next.js Route Handlers)"
        direction TB
        AuthRoute["api/auth/[...nextauth]/route.ts"]:::api
        CreateEvent["api/create-event/route.ts"]:::api
        EditEvent["api/edit-event/route.ts"]:::api
        DeleteEvent["api/delete-event/route.ts"]:::api
        CreateSlot["api/create-slot/route.ts"]:::api
        DeleteSlot["api/delete-slot/route.ts"]:::api
        CreateAltSlot["api/create-altslot/route.ts"]:::api
        DeleteAltSlot["api/delete-altslot/route.ts"]:::api
        SubmitResponse["api/submit-response/route.ts"]:::api
        SubmitAltResponse["api/submit-altresponse/route.ts"]:::api
        CheckIn["api/checkin/route.ts"]:::api
    end

    Home -->|"fetch data"| AuthRoute
    AdminDashPage -->|"CRUD events/slots"| CreateEvent
    AdminDashPage --> EditEvent
    AdminDashPage --> DeleteEvent
    AdminDashPage --> CreateSlot
    AdminDashPage --> DeleteSlot
    AdminDashPage --> CreateAltSlot
    AdminDashPage --> DeleteAltSlot
    InviteFlow --> SubmitResponse
    ConfirmAlt --> SubmitAltResponse
    Confirm --> CheckIn

    %% Auth Service & Middleware
    subgraph "Authentication Service"
        direction TB
        NextAuth["NextAuth.js (api/auth)"]:::auth
        Middleware["middleware.ts"]:::auth
        SessionUtil["src/lib/session.ts"]:::auth
        AuthUtil["src/lib/auth.ts"]:::auth
    end
    AuthRoute --> NextAuth
    Frontend -->|"uses session"| NextAuth
    Middleware --> AuthRoute

    %% Business Logic & Utilities
    subgraph "Shared Utilities & HTTP Client"
        direction TB
        AxiosClient["src/lib/axiosInstance.ts"]:::util
        Utils["src/lib/utils.ts"]:::util
    end
    Frontend --> AxiosClient
    API --> Utils

    %% Database Layer
    subgraph "Database & ORM"
        direction TB
        PrismaClient["src/lib/prisma.ts"]:::db
        Schema["prisma/schema.prisma"]:::db
        Database[(Database)]:::db
    end
    API --> PrismaClient
    PrismaClient --> Schema
    PrismaClient --> Database

    %% External Services
    ExternalEmail["Email Service"]:::external
    CreateEvent --> ExternalEmail
    CreateAltSlot --> ExternalEmail

    %% Click Events - Frontend
    click Layout "https://github.com/tfhuneck/event-response-app/blob/main/src/app/layout.tsx"
    click Home "https://github.com/tfhuneck/event-response-app/blob/main/src/app/page.tsx"
    click Login "https://github.com/tfhuneck/event-response-app/blob/main/src/app/login/page.tsx"
    click AdminDashPage "https://github.com/tfhuneck/event-response-app/blob/main/src/app/admin/page.tsx"
    click AdminCreate "https://github.com/tfhuneck/event-response-app/blob/main/src/app/admin/create/page.tsx"
    click EventView "https://github.com/tfhuneck/event-response-app/blob/main/src/app/admin/event/[id]/page.tsx"
    click EventEdit "https://github.com/tfhuneck/event-response-app/blob/main/src/app/admin/event/[id]/edit/page.tsx"
    click ResponsesView "https://github.com/tfhuneck/event-response-app/blob/main/src/app/admin/event/[id]/responses/page.tsx"
    click AltResponses "https://github.com/tfhuneck/event-response-app/blob/main/src/app/admin/altresponses/page.tsx"
    click InviteFlow "https://github.com/tfhuneck/event-response-app/blob/main/src/app/invite/[id]/[firstname]/[lastname]/[email]/[responseid]/page.tsx"
    click Confirm "https://github.com/tfhuneck/event-response-app/blob/main/src/app/confirm/[responseid]/page.tsx"
    click ConfirmAlt "https://github.com/tfhuneck/event-response-app/blob/main/src/app/confirm/alt/[responseid]/page.tsx"

    %% Click Events - API Layer
    click AuthRoute "https://github.com/tfhuneck/event-response-app/blob/main/src/app/api/auth/[...nextauth]/route.ts"
    click CreateEvent "https://github.com/tfhuneck/event-response-app/blob/main/src/app/api/create-event/route.ts"
    click EditEvent "https://github.com/tfhuneck/event-response-app/blob/main/src/app/api/edit-event/route.ts"
    click DeleteEvent "https://github.com/tfhuneck/event-response-app/blob/main/src/app/api/delete-event/route.ts"
    click CreateSlot "https://github.com/tfhuneck/event-response-app/blob/main/src/app/api/create-slot/route.ts"
    click DeleteSlot "https://github.com/tfhuneck/event-response-app/blob/main/src/app/api/delete-slot/route.ts"
    click CreateAltSlot "https://github.com/tfhuneck/event-response-app/blob/main/src/app/api/create-altslot/route.ts"
    click DeleteAltSlot "https://github.com/tfhuneck/event-response-app/blob/main/src/app/api/delete-altslot/route.ts"
    click SubmitResponse "https://github.com/tfhuneck/event-response-app/blob/main/src/app/api/submit-response/route.ts"
    click SubmitAltResponse "https://github.com/tfhuneck/event-response-app/blob/main/src/app/api/submit-altresponse/route.ts"
    click CheckIn "https://github.com/tfhuneck/event-response-app/blob/main/src/app/api/checkin/route.ts"

    %% Click Events - Auth & Middleware
    click NextAuth "https://github.com/tfhuneck/event-response-app/blob/main/src/app/api/auth/[...nextauth]/route.ts"
    click Middleware "https://github.com/tfhuneck/event-response-app/blob/main/src/app/middleware.ts"
    click AuthUtil "https://github.com/tfhuneck/event-response-app/blob/main/src/lib/auth.ts"
    click SessionUtil "https://github.com/tfhuneck/event-response-app/blob/main/src/lib/session.ts"

    %% Click Events - DB & ORM
    click PrismaClient "https://github.com/tfhuneck/event-response-app/blob/main/src/lib/prisma.ts"
    click Schema "https://github.com/tfhuneck/event-response-app/blob/main/prisma/schema.prisma"

    %% Click Events - Utilities
    click AxiosClient "https://github.com/tfhuneck/event-response-app/blob/main/src/lib/axiosInstance.ts"
    click Utils "https://github.com/tfhuneck/event-response-app/blob/main/src/lib/utils.ts"

    %% Styles
    classDef user fill:#B3E5FC,stroke:#0288D1,color:#000
    classDef frontend fill:#BBDEFB,stroke:#1976D2,color:#000
    classDef api fill:#C8E6C9,stroke:#388E3C,color:#000
    classDef auth fill:#FFECB3,stroke:#FFA000,color:#000
    classDef util fill:#E1BEE7,stroke:#8E24AA,color:#000
    classDef db fill:#FFE0B2,stroke:#F57C00,color:#000
    classDef external fill:#F3E5F5,stroke:#7B1FA2,color:#000
```
