# rachitbhatta/dev-event architecture

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

- Interactive diagram: https://gitdiagram.com/rachitbhatta/dev-event
- Repository: https://github.com/rachitbhatta/dev-event

## Overview

##### Project type and purpose
- This is a Next.js full-stack web application (using the App Router) for browsing and booking events.
- It offers both UI pages (React components under app/ and components/) and serverless API endpoints (app/api/) backed by MongoDB (database/ and lib/mongodb.ts).

##### File structure
Top-level folders:
- app/ – Next.js pages, layouts, server & client components, plus API routes under app/api/events.
- components/ – Reusable React UI components (EventCard, BookEvent, NavBar, etc.).
- database/ – Mongoose-style models (event.model.ts, booking.model.ts) and index.ts to register schemas.
- lib/ – Business logic (actions for events and bookings), MongoDB connection helper, constants, utilities.
Config files: next.config.ts, tsconfig.json, eslint.config.mjs, postcss.config.mjs.
Instrumentation: instrumentation-client.ts (likely telemetry).

##### Extract insights from the README
- Bootstrapped with create-next-app using Next.js App Router.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Layer
    subgraph "Client Layer"
        direction TB
        HomePage["HomePage<br/>(app/page.tsx)"]:::ui
        EventPage["EventPage<br/>(app/events/[slug]/page.tsx)"]:::ui
        ComponentsDir["Components<br/>(components/)"]:::ui
        Layout["Layout Component<br/>(app/layout.tsx)"]:::ui
        HomePage -->|renders via| Layout
        EventPage -->|renders via| Layout
    end

    %% Server Layer
    subgraph "Server Layer"
        direction TB
        APIList["Event List API<br/>(app/api/events/route.ts)"]:::api
        APIDetail["Event Detail API<br/>(app/api/events/[slug]/route.ts)"]:::api
        GlobalsCSS["Global Styles<br/>(app/globals.css)"]:::api
        HomePage -->|requests| APIList
        EventPage -->|requests| APIDetail
    end

    %% Business Logic
    subgraph "Business Logic Layer"
        direction TB
        EventAction["Event Actions<br/>(lib/actions/event.action.ts)"]:::logic
        BookingAction["Booking Actions<br/>(lib/actions/booking.action.ts)"]:::logic
        APIList -->|calls| EventAction
        APIDetail -->|calls| EventAction
    end

    %% Database Layer
    subgraph "Database Layer"
        direction TB
        MongoHelper["MongoDB Helper<br/>(lib/mongodb.ts)"]:::db
        EventModel["Event Model<br/>(database/event.model.ts)"]:::db
        BookingModel["Booking Model<br/>(database/booking.model.ts)"]:::db
        DBIndex["Schema Registration<br/>(database/index.ts)"]:::db
        EventAction -->|uses| MongoHelper
        BookingAction -->|uses| MongoHelper
        MongoHelper -->|registers| DBIndex
        DBIndex -->|defines| EventModel
        DBIndex -->|defines| BookingModel
        MongoHelper -->|connects to| MongoCluster["MongoDB Atlas<br/>(External)"]:::external
    end

    %% External Services
    subgraph "External Services"
        direction TB
        Instrumentation["Telemetry Service<br/>(instrumentation-client.ts)"]:::external
        StaticAssets["Static Asset Store<br/>(public/icons/, public/images/)"]:::external
        LightRays["LightRays Styles<br/>(components/LightRays.css & .jsx)"]:::external
        APIList -->|logs to| Instrumentation
        APIDetail -->|logs to| Instrumentation
        Layout -->|serves| StaticAssets
        ComponentsDir -->|imports| LightRays
    end

    %% Browser interactions
    HomePage -->|"user navigates"| Browser["User Browser"]:::external
    EventPage -->|"user navigates"| Browser

    %% Click Events
    click HomePage "https://github.com/rachitbhatta/dev-event/blob/main/app/page.tsx"
    click EventPage "https://github.com/rachitbhatta/dev-event/blob/main/app/events/[slug]/page.tsx"
    click ComponentsDir "https://github.com/rachitbhatta/dev-event/tree/main/components/"
    click Layout "https://github.com/rachitbhatta/dev-event/blob/main/app/layout.tsx"
    click APIList "https://github.com/rachitbhatta/dev-event/blob/main/app/api/events/route.ts"
    click APIDetail "https://github.com/rachitbhatta/dev-event/blob/main/app/api/events/[slug]/route.ts"
    click GlobalsCSS "https://github.com/rachitbhatta/dev-event/blob/main/app/globals.css"
    click EventAction "https://github.com/rachitbhatta/dev-event/blob/main/lib/actions/event.action.ts"
    click BookingAction "https://github.com/rachitbhatta/dev-event/blob/main/lib/actions/booking.action.ts"
    click MongoHelper "https://github.com/rachitbhatta/dev-event/blob/main/lib/mongodb.ts"
    click EventModel "https://github.com/rachitbhatta/dev-event/blob/main/database/event.model.ts"
    click BookingModel "https://github.com/rachitbhatta/dev-event/blob/main/database/booking.model.ts"
    click DBIndex "https://github.com/rachitbhatta/dev-event/blob/main/database/index.ts"
    click Instrumentation "https://github.com/rachitbhatta/dev-event/blob/main/instrumentation-client.ts"
    click StaticAssets "https://github.com/rachitbhatta/dev-event/tree/main/public/icons/"
    click LightRays "https://github.com/rachitbhatta/dev-event/blob/main/components/LightRays.css"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366d6,color:#0366d6;
    classDef api fill:#E6FFED,stroke:#28a745,color:#28a745;
    classDef logic fill:#FFF5CC,stroke:#dbab09,color:#b08800;
    classDef db fill:#FFEFEF,stroke:#d73a49,color:#d73a49;
    classDef external fill:#F3F4F6,stroke:#6a737d,color:#6a737d;
```
