# sachinthax/eventease architecture

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

- Interactive diagram: https://gitdiagram.com/sachinthax/eventease
- Repository: https://github.com/sachinthax/eventease

## Overview

##### Project type and purpose
- This is a full-stack MERN (MongoDB, Express, React, Node.js) application called EventEase. It provides event management, ticket sales, waitlist handling, secure wallet transactions, and an AI assistant for ticket resale workflows.

##### File structure
- Top-level directories:
- backend – Node/Express API server (MVC pattern with config, controllers, models, routes, middleware, utility functions).
- frontend – React/Vite SPA (components, pages, context, services, utils).
- Configuration and build artifacts: .env, package.json, gitignore files, Vite config in frontend.
- Patterns:
- Backend uses REST routes tied to controllers and Mongoose models.
- Frontend separates UI components, pages, and services that call backend APIs.
- Shared services layer in frontend (authService, eventService, ticketService).
- External integrations in code:
- MongoDB (via backend/config/db.js)
- JWT authentication (generateToken utility)
- Passport Google OAuth (config/passport.js, googleController)
- Email (sendEmail utility)
- Firebase for asset uploads (frontend/utils/firebaseConfig.js, uploadToFirebase.js)
- AI assistant calls in aiController/aiRoutes

##### README for additional insights
- Confirms: real-time seat allocation, waitlist repurchasing, secure wallet, AI assistant.
- Highlights core user types: Organizers and Attendees.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Frontend Layer
    subgraph "Frontend (React SPA)" 
        direction TB
        Browser["User’s Browser"]:::frontend
        App["App.jsx / main.jsx"]:::frontend
        UI_Components["UI Components & Routing"]:::frontend
        Services["Services Layer"]:::frontend
        FirebaseUtils["Firebase Asset Integration"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend (Express API)" 
        direction TB
        APIGateway["API Gateway (server.js)"]:::backend
        subgraph "Config & Utils"
            DBConfig["MongoDB Config (db.js / .env)"]:::backend
            JWTUtil["JWT Utility"]:::backend
            EmailUtil["Email Service Utility"]:::backend
            PassportConfig["Passport Google OAuth"]:::backend
        end
        subgraph "Features & Modules"
            direction TB
            subgraph "Authentication"
                AuthController["authController.js"]:::backend
                GoogleController["googleController.js"]:::backend
                AuthRoutes["authRoutes.js"]:::backend
            end
            subgraph "Events"
                EventController["EventController.js"]:::backend
                EventModel["EventModel.js"]:::backend
                EventRoutes["EventRoutes.js"]:::backend
            end
            subgraph "Tickets & Wallet"
                TicketController["TicketController.js"]:::backend
                TicketModel["TicketModel.js"]:::backend
                WalletModel["WalletModel.js"]:::backend
                TicketRoutes["TicketRoutes.js"]:::backend
            end
            subgraph "Waitlist"
                WaitlistController["WaitlistController.js"]:::backend
                WaitlistModel["WaitlistModel.js"]:::backend
                WaitlistRoutes["WaitlistRoutes.js"]:::backend
            end
            subgraph "AI Assistant"
                AIController["aiController.js"]:::backend
                AIRoutes["aiRoutes.js"]:::backend
            end
            subgraph "Feedback & Reporting"
                FeedbackController["feedbackController.js"]:::backend
                FeedbackModel["Feedback.js"]:::backend
                FeedbackRoutes["feedbackRoutes.js"]:::backend
            end
            subgraph "User Management"
                UserController["userController.js"]:::backend
                UserModel["User.js"]:::backend
                UserRoutes["userRoutes.js"]:::backend
            end
            subgraph "Middleware"
                ErrorMiddleware["errorMiddleware.js"]:::backend
                AuthMiddleware["authMiddleware.js"]:::backend
            end
        end
    end

    %% Databases & Storage
    MongoDB[(MongoDB)]:::database
    FirebaseStorage[(Firebase Storage)]:::database

    %% External Services
    GoogleOAuth((Google OAuth)):::cloud
    EmailService((Email Service)):::cloud
    AIService((AI Service)):::cloud

    %% Connections Frontend to Backend
    Browser -->|"renders"| App
    App --> UI_Components
    UI_Components --> Services
    Services -->|HTTP Calls| APIGateway

    %% Backend flows
    APIGateway --> DBConfig
    APIGateway --> JWTUtil
    APIGateway --> EmailUtil
    APIGateway --> PassportConfig

    APIGateway -->|routes requests| AuthRoutes
    AuthRoutes --> AuthController
    AuthRoutes --> GoogleController
    AuthController --> JWTUtil
    GoogleController --> PassportConfig
    AuthController --> DBConfig

    APIGateway -->|routes requests| EventRoutes
    EventRoutes --> EventController
    EventController --> EventModel
    EventModel --> MongoDB

    APIGateway -->|routes requests| TicketRoutes
    TicketRoutes --> TicketController
    TicketController --> TicketModel
    TicketController --> WalletModel
    TicketModel --> MongoDB
    WalletModel --> MongoDB

    APIGateway -->|routes requests| WaitlistRoutes
    WaitlistRoutes --> WaitlistController
    WaitlistController --> WaitlistModel
    WaitlistModel --> MongoDB

    APIGateway -->|routes requests| AIRoutes
    AIRoutes --> AIController
    AIController -->|prompt/response| AIService

    APIGateway -->|routes requests| FeedbackRoutes
    FeedbackRoutes --> FeedbackController
    FeedbackController --> FeedbackModel
    FeedbackModel --> MongoDB

    APIGateway -->|routes requests| UserRoutes
    UserRoutes --> UserController
    UserController --> UserModel
    UserModel --> MongoDB

    %% Middleware
    APIGateway --> ErrorMiddleware
    APIGateway --> AuthMiddleware

    %% External Services
    AuthController -->|OAuth handshake| GoogleOAuth
    AuthController -->|send email| EmailService
    EmailUtil --> EmailService
    AIController --> AIService

    %% Frontend Firebase upload
    Services --> FirebaseUtils
    FirebaseUtils --> FirebaseStorage

    %% Click Events Frontend
    click App "https://github.com/sachinthax/eventease/blob/main/frontend/src/App.jsx"
    click App "https://github.com/sachinthax/eventease/blob/main/frontend/src/main.jsx"
    click UI_Components "https://github.com/sachinthax/eventease/tree/main/frontend/src/components"
    click UI_Components "https://github.com/sachinthax/eventease/tree/main/frontend/src/pages"
    click Services "https://github.com/sachinthax/eventease/blob/main/frontend/src/services/authService.js"
    click Services "https://github.com/sachinthax/eventease/blob/main/frontend/src/services/eventService.js"
    click Services "https://github.com/sachinthax/eventease/blob/main/frontend/src/services/ticketService.js"
    click Services "https://github.com/sachinthax/eventease/blob/main/frontend/src/services/axios.js"
    click FirebaseUtils "https://github.com/sachinthax/eventease/blob/main/frontend/src/utils/firebaseConfig.js"
    click FirebaseUtils "https://github.com/sachinthax/eventease/blob/main/frontend/src/utils/uploadToFirebase.js"

    %% Click Events Backend
    click APIGateway "https://github.com/sachinthax/eventease/blob/main/backend/server.js"
    click DBConfig "https://github.com/sachinthax/eventease/blob/main/backend/config/db.js"
    click JWTUtil "https://github.com/sachinthax/eventease/blob/main/backend/utils/generateToken.js"
    click EmailUtil "https://github.com/sachinthax/eventease/blob/main/backend/utils/sendEmail.js"
    click PassportConfig "https://github.com/sachinthax/eventease/blob/main/backend/config/passport.js"
    click AuthController "https://github.com/sachinthax/eventease/blob/main/backend/controllers/authController.js"
    click GoogleController "https://github.com/sachinthax/eventease/blob/main/backend/controllers/googleController.js"
    click AuthRoutes "https://github.com/sachinthax/eventease/blob/main/backend/routes/authRoutes.js"
    click EventController "https://github.com/sachinthax/eventease/blob/main/backend/controllers/EventController.js"
    click EventModel "https://github.com/sachinthax/eventease/blob/main/backend/models/EventModel.js"
    click EventRoutes "https://github.com/sachinthax/eventease/blob/main/backend/routes/EventRoutes.js"
    click TicketController "https://github.com/sachinthax/eventease/blob/main/backend/controllers/TicketController.js"
    click TicketModel "https://github.com/sachinthax/eventease/blob/main/backend/models/TicketModel.js"
    click WalletModel "https://github.com/sachinthax/eventease/blob/main/backend/models/WalletModel.js"
    click TicketRoutes "https://github.com/sachinthax/eventease/blob/main/backend/routes/TicketRoutes.js"
    click WaitlistController "https://github.com/sachinthax/eventease/blob/main/backend/controllers/WaitlistController.js"
    click WaitlistModel "https://github.com/sachinthax/eventease/blob/main/backend/models/WaitlistModel.js"
    click WaitlistRoutes "https://github.com/sachinthax/eventease/blob/main/backend/routes/WaitlistRoutes.js"
    click AIController "https://github.com/sachinthax/eventease/blob/main/backend/controllers/aiController.js"
    click AIRoutes "https://github.com/sachinthax/eventease/blob/main/backend/routes/aiRoutes.js"
    click FeedbackController "https://github.com/sachinthax/eventease/blob/main/backend/controllers/feedbackController.js"
    click FeedbackModel "https://github.com/sachinthax/eventease/blob/main/backend/models/Feedback.js"
    click FeedbackRoutes "https://github.com/sachinthax/eventease/blob/main/backend/routes/feedbackRoutes.js"
    click UserController "https://github.com/sachinthax/eventease/blob/main/backend/controllers/userController.js"
    click UserModel "https://github.com/sachinthax/eventease/blob/main/backend/models/User.js"
    click UserRoutes "https://github.com/sachinthax/eventease/blob/main/backend/routes/userRoutes.js"
    click ErrorMiddleware "https://github.com/sachinthax/eventease/blob/main/backend/middleware/errorMiddleware.js"
    click AuthMiddleware "https://github.com/sachinthax/eventease/blob/main/backend/middleware/authMiddleware.js"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#0B47A1,stroke-width:1px
    classDef backend fill:#DFFFE0,stroke:#1F7A1F,stroke-width:1px
    classDef database fill:#FFF4D0,stroke:#A67C00,stroke-width:1px,stroke-dasharray: 5 5
    classDef cloud fill:#F0F0F0,stroke:#888888,stroke-width:1px,stroke-dasharray: 2 2
```
