# event-ticketing-devs/event-ticketing-platform architecture

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

- Interactive diagram: https://gitdiagram.com/event-ticketing-devs/event-ticketing-platform
- Repository: https://github.com/event-ticketing-devs/event-ticketing-platform

## Overview

##### Project type and purpose
- This is a full-stack event ticketing and management platform.
- Frontend built with React and Vite; backend with Node.js, Express, MongoDB and Redis.
- Purpose: let attendees browse and book events, organizers manage events and contacts, admins oversee the system.

##### File structure
- Top-level: folders “backend” and “frontend.”
- backend/src contains:
- app.js and server.js for Express setup and entry point
- controllers (auth, booking, category, contact, event, payment, report, user)
- models for MongoDB schemas (User, Event, Booking, Category, Contact, Report)
- routes mapping HTTP endpoints to controllers
- middleware for authentication, rate limiting, error handling, roles
- utils (mailer, QR code generator, Cloudinary, refund logic)
- redis client and helpers for caching and rate limits
- constants and environment-based configuration
- frontend/src contains:
- main.jsx and App.jsx
- pages directory for route-based pages (Home, Events, BookingFlow, AdminDashboard, OrganizerDashboard, Profile, etc.)
- components directory for reusable UI pieces (Navbar, Footer, QRScanner, StripeCheckout, modals, route guards)
- api client wrapper and services for HTTP calls (authService, apiClient)
- context for global state (AuthContext)
- utilities for route protection and tests
- Configuration files: package.json, tsconfig/vite.config, ESLint rules.

##### README for additional insights
- Tech stack: React, TailwindCSS, Axios, React Router, Node.js, Express, Mongoose, Redis, Stripe, Google OAuth, Cloudinary.
- Key features: role-based auth, Google OAuth, Stripe payments, QR code tickets, contact management, rate limiting, refund policy.
- Contains API endpoints by resource and method.
- Describes environment variables and external integrations (MongoDB URI, Redis, Stripe keys, Google Maps, Cloudinary).

##### Elements
- API server modules in another (green).
- Data stores in a third (orange).
- External services in gray.

##### Detail without over-thinking
- Every major folder or integration in your file tree has a corresponding block.
- Middleware chain and where rate limiting and error handling plug in.
- Flow of booking from search → payment → QR generation → verification.
- Role-based routes: public vs. admin vs. organizer.
- Timeouts or caching strategies (Redis TTL for rate limits).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend (React Client)" 
        direction TB
        Browser["User Browser"]:::frontend
        Main["main.jsx"]:::frontend
        App["App.jsx"]:::frontend
        Pages["Pages"]:::frontend
        Components["Components"]:::frontend
        APIClient["apiClient.js"]:::frontend
        AuthService["authService.js"]:::frontend
        AuthContext["AuthContext.jsx"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend (Express API)"
        direction TB
        API_Gateway["Express API"]:::backend
        AppJS["app.js"]:::backend
        ServerJS["server.js"]:::backend
        subgraph "Modules"
            direction TB
            Controllers["Controllers"]:::backend
            Routes["Routes"]:::backend
            Models["Models"]:::backend
            Middleware["Middleware"]:::backend
            Utils["Utils"]:::backend
            RedisModule["Redis Client & Helpers"]:::backend
            DBConn["DB Connection"]:::backend
        end
    end

    %% Data Stores
    subgraph "Data Stores"
        direction TB
        MongoDB["MongoDB"]:::datastore
        Redis["Redis"]:::datastore
    end

    %% External Services
    subgraph "External Integrations"
        direction TB
        Stripe["Stripe (Payments)"]:::external
        GoogleOAuth["Google OAuth / Maps"]:::external
        Cloudinary["Cloudinary"]:::external
        EmailService["Email Service"]:::external
    end

    %% Flows
    Browser -->|HTTP/HTTPS| API_Gateway
    API_Gateway -->|uses| Controllers
    API_Gateway -->|routes| Routes
    Controllers -->|CRUD| Models
    Controllers -->|validate| Middleware
    Controllers -->|calls| Utils
    API_Gateway -->|cache & rate-limit| RedisModule
    API_Gateway -->|connects| DBConn
    DBConn -->|connects to| MongoDB
    RedisModule -->|connects to| Redis
    Controllers -->|paymentIntent| Stripe
    Controllers -->|oauth| GoogleOAuth
    Controllers -->|upload| Cloudinary
    Controllers -->|send| EmailService

    %% Click Events
    click Browser "https://github.com/event-ticketing-devs/event-ticketing-platform/tree/main/frontend/src"
    click Main "https://github.com/event-ticketing-devs/event-ticketing-platform/blob/main/frontend/src/main.jsx"
    click App "https://github.com/event-ticketing-devs/event-ticketing-platform/blob/main/frontend/src/App.jsx"
    click Pages "https://github.com/event-ticketing-devs/event-ticketing-platform/tree/main/frontend/src/pages"
    click Components "https://github.com/event-ticketing-devs/event-ticketing-platform/tree/main/frontend/src/components"
    click APIClient "https://github.com/event-ticketing-devs/event-ticketing-platform/blob/main/frontend/src/api/apiClient.js"
    click AuthService "https://github.com/event-ticketing-devs/event-ticketing-platform/blob/main/frontend/src/services/authService.js"
    click AuthContext "https://github.com/event-ticketing-devs/event-ticketing-platform/blob/main/frontend/src/context/AuthContext.jsx"

    click API_Gateway "https://github.com/event-ticketing-devs/event-ticketing-platform/tree/main/backend/src"
    click AppJS "https://github.com/event-ticketing-devs/event-ticketing-platform/blob/main/backend/src/app.js"
    click ServerJS "https://github.com/event-ticketing-devs/event-ticketing-platform/blob/main/backend/src/server.js"
    click Controllers "https://github.com/event-ticketing-devs/event-ticketing-platform/tree/main/backend/src/controllers"
    click Routes "https://github.com/event-ticketing-devs/event-ticketing-platform/tree/main/backend/src/routes"
    click Models "https://github.com/event-ticketing-devs/event-ticketing-platform/tree/main/backend/src/models"
    click Middleware "https://github.com/event-ticketing-devs/event-ticketing-platform/tree/main/backend/src/middleware"
    click Utils "https://github.com/event-ticketing-devs/event-ticketing-platform/tree/main/backend/src/utils"
    click RedisModule "https://github.com/event-ticketing-devs/event-ticketing-platform/tree/main/backend/src/redis"
    click DBConn "https://github.com/event-ticketing-devs/event-ticketing-platform/blob/main/backend/src/db/index.js"

    %% Styles
    classDef frontend fill:#E0F7FA,stroke:#006064,color:#004D40;
    classDef backend fill:#E8F5E9,stroke:#1B5E20,color:#2E7D32;
    classDef datastore fill:#FFF3E0,stroke:#EF6C00,color:#BF360C;
    classDef external fill:#ECEFF1,stroke:#546E7A,color:#37474F;
```
