# mkotik/deangoldsteen architecture

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

- Interactive diagram: https://gitdiagram.com/mkotik/deangoldsteen
- Repository: https://github.com/mkotik/deangoldsteen

## Overview

##### Main System Components

A. Frontend Layer (Next.js Application)
- Client-side Components
- Server-side Components
- Redux State Management
- UI Components Library

B. Backend Layer (Server Directory)
- API Routes
- Event Scraping Services
- Prisma ORM Layer

C. Database Layer
- PostgreSQL (implied by Prisma usage)

##### Detailed Component Breakdown

Frontend Components:
- Page Components (/app directory structure)
- Shared Components (header, footer, map, etc.)
- UI Component Library (shadcn/ui components)
- Redux Store (with slices)

Backend Services:
- Event Routes (/server/src/routes)
- Scraping Scripts (comedy events)
- Data Processing Services (coordinates updates)
- Prisma Client Interface

##### Data Flow Representation

- Client-Server Communication
- Database Operations
- External Service Interactions (if any)
- State Management Flow

##### Specific Implementation Details

- Next.js App Router (based on [location] dynamic routing)
- Redux State Management
- Event Processing Pipeline
- Location-based Features
- Database Schema (from Prisma)

##### Key Architectural Patterns to Highlight

- Next.js App Router Architecture
- Server-Client Component separation
- Redux State Management Flow
- Event Processing Pipeline
- Location-based Feature Integration

**[Client Layer]**

- [Next.js App Router]
- Pages (/, /[location], /privacy, /terms)
- Components (Map, EventDetails, LocationSearch)
- UI Components (shadcn/ui)

- [State Management]
- Redux Store

**[Server Layer]**

- [API Routes]
- Event Endpoints

- [Services]
- Event Scraping
- Coordinate Processing

- [Data Layer]
- Prisma ORM

**[Database Layer]**
- [PostgreSQL]
- Events Table

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        NextRouter["Next.js App Router"]
        Pages["Page Components"]
        Components["Frontend Components"]
        UI["UI Component Library"]
        State["State Management"]
        
        Pages --> |uses| Components
        Components --> |uses| UI
        Pages --> |uses| State
        Components --> |uses| State
    end

    subgraph Server
        API["API Routes"]
        Services["Backend Services"]
        PrismaORM["Prisma ORM Layer"]
        
        API --> Services
        Services --> PrismaORM
    end

    subgraph Database
        PostgreSQL[(PostgreSQL DB)]
    end

    Client --> |API Requests| Server
    PrismaORM --> |CRUD Operations| PostgreSQL

    %% Frontend Component Details
    Components --> Map["Map Component"]:::component
    Components --> EventModal["Event Details Modal"]:::component
    Components --> LocationSearch["Location Search"]:::component
    Components --> Header["Header"]:::component
    Components --> Footer["Footer"]:::component

    %% UI Library Details
    UI --> Button["Button"]:::ui
    UI --> Dialog["Dialog"]:::ui
    UI --> Calendar["Calendar"]:::ui
    UI --> NavMenu["Navigation Menu"]:::ui

    %% Pages Details
    Pages --> HomePage["Home Page"]:::page
    Pages --> LocationPage["Location Page"]:::page
    Pages --> PrivacyPage["Privacy Page"]:::page
    Pages --> TermsPage["Terms Page"]:::page

    %% State Management Details
    State --> Store["Redux Store"]:::redux
    State --> RootReducer["Root Reducer"]:::redux
    State --> Slices["Redux Slices"]:::redux

    %% Backend Services Details
    Services --> EventRoutes["Event Routes"]:::service
    Services --> ScrapingScripts["Scraping Scripts"]:::service
    Services --> CoordUpdates["Coordinate Updates"]:::service
    Services --> EventUpload["Event Upload"]:::service

    %% Database Layer Details
    PrismaORM --> Schema["Prisma Schema"]:::db
    PrismaORM --> Migrations["Database Migrations"]:::db

    %% Click Events
    click Map "https://github.com/mkotik/deangoldsteen/blob/main/app/components/map.tsx"
    click EventModal "https://github.com/mkotik/deangoldsteen/blob/main/app/components/EventDetailsModal.tsx"
    click LocationSearch "https://github.com/mkotik/deangoldsteen/blob/main/app/components/LocationSearch.tsx"
    click Header "https://github.com/mkotik/deangoldsteen/blob/main/app/components/header.tsx"
    click Footer "https://github.com/mkotik/deangoldsteen/blob/main/app/components/footer.tsx"
    click Button "https://github.com/mkotik/deangoldsteen/blob/main/app/components/ui/button.tsx"
    click Dialog "https://github.com/mkotik/deangoldsteen/blob/main/app/components/ui/dialog.tsx"
    click Calendar "https://github.com/mkotik/deangoldsteen/blob/main/app/components/ui/calendar.tsx"
    click NavMenu "https://github.com/mkotik/deangoldsteen/blob/main/app/components/ui/navigation-menu.tsx"
    click Store "https://github.com/mkotik/deangoldsteen/blob/main/app/redux/store.ts"
    click RootReducer "https://github.com/mkotik/deangoldsteen/blob/main/app/redux/rootReducer.ts"
    click Slices "https://github.com/mkotik/deangoldsteen/blob/main/app/redux/slices/yourSlice.ts"
    click EventRoutes "https://github.com/mkotik/deangoldsteen/blob/main/server/src/routes/events.ts"
    click ScrapingScripts "https://github.com/mkotik/deangoldsteen/blob/main/server/scripts/scrape-comedy.ts"
    click CoordUpdates "https://github.com/mkotik/deangoldsteen/blob/main/server/scripts/update-coordinates.ts"
    click EventUpload "https://github.com/mkotik/deangoldsteen/blob/main/server/scripts/upload-events.ts"
    click Schema "https://github.com/mkotik/deangoldsteen/blob/main/server/prisma/schema.prisma"
    click Migrations "https://github.com/mkotik/deangoldsteen/tree/main/server/prisma/migrations/"
    click HomePage "https://github.com/mkotik/deangoldsteen/blob/main/app/page.tsx"
    click LocationPage "https://github.com/mkotik/deangoldsteen/blob/main/app/[location]/page.tsx"
    click PrivacyPage "https://github.com/mkotik/deangoldsteen/blob/main/app/privacy/page.tsx"
    click TermsPage "https://github.com/mkotik/deangoldsteen/blob/main/app/terms/page.tsx"

    %% Styling
    classDef component fill:#a8d1ff,stroke:#333
    classDef ui fill:#ffccd5,stroke:#333
    classDef page fill:#c1e1c1,stroke:#333
    classDef redux fill:#ffd700,stroke:#333
    classDef service fill:#c39bd3,stroke:#333
    classDef db fill:#f5b041,stroke:#333

    %% Legend
    subgraph Legend
        L1["Frontend Component"]:::component
        L2["UI Component"]:::ui
        L3["Page Component"]:::page
        L4["Redux Component"]:::redux
        L5["Backend Service"]:::service
        L6["Database Component"]:::db
    end
```
