# yeboahd24/movie-reservation-system architecture

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

- Interactive diagram: https://gitdiagram.com/yeboahd24/movie-reservation-system
- Repository: https://github.com/yeboahd24/movie-reservation-system

## Overview

##### Main Components

A. External Layer (Client Interface)
- REST API Gateway
- Authentication Middleware
- JWT Token Handler

B. Core Application Layers
- Routes Layer
- Controllers Layer
- Services Layer
- Models Layer
- Database Layer

C. Supporting Components
- Configuration Management
- Utility Services

**[Client Applications] (External Systems)**
- ↓
**[API Gateway / Routes Layer]**
- ↓
**[Authentication & Middleware Layer]**
- ↓
**[Controllers Layer]**
- ↓
**[Services Layer]**
- ↓
**[Models Layer]**
- ↓
**[Database Layer]**

##### Component Details

A. API Gateway / Routes Layer (routes/routes.go)
- Connection to all main endpoints:
- Auth routes (/api/signup, /api/login)
- Movie routes (/api/admin/movies)
- Showtime routes (/api/admin/showtimes)
- Reservation routes (/api/reservations)

B. Controllers Layer (controllers/*)
- AuthController
- MovieController
- ShowtimeController
- ReservationController
- Their relationships with corresponding services

C. Services Layer (services/*)
- Create service components:
- AuthService
- MovieService
- ShowtimeService
- ReservationService
- Business logic separation

D. Models Layer (models/*)
- Data models:
- User
- Movie
- Showtime
- Reservation
- Relationships between models (e.g., Reservation relates to User and Showtime)

E. Utility Components (utils/*)
- Supporting utilities:
- JWT Handler
- Password Utils
- UUID Generator
- Middleware

##### Additional Elements

- Notes about scalability points
- Configuration management integration
- Error handling flow

##### Implementation Notes

Remember to:
- Use consistent naming conventions
- Provide a clear hierarchy of components
- Both synchronous and asynchronous flows
- Error handling paths
- Security boundaries clearly

This system design should effectively communicate the architecture of the Movie Reservation System while maintaining clarity and providing sufficient detail for implementation understanding.

## Diagram (Mermaid)

```mermaid
graph TD
    classDef external fill:#90EE90,stroke:#333,stroke-width:2px
    classDef auth fill:#FFE4B5,stroke:#333,stroke-width:2px
    classDef core fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef utility fill:#D3D3D3,stroke:#333,stroke-width:2px
    classDef database fill:#FFB6C6,stroke:#333,stroke-width:2px
    
    Client[Client Applications]:::external
    
    subgraph Gateway
        API["API Gateway"]:::core
        Auth["Authentication Middleware"]:::auth
        JWT["JWT Handler"]:::auth
    end
    
    subgraph Controllers
        AuthC["Auth Controller"]:::core
        MovieC["Movie Controller"]:::core
        ShowC["Showtime Controller"]:::core
        ResC["Reservation Controller"]:::core
    end
    
    subgraph Services
        AuthS["Auth Service"]:::core
        MovieS["Movie Service"]:::core
        ShowS["Showtime Service"]:::core
        ResS["Reservation Service"]:::core
    end
    
    subgraph Models
        User["User Model"]:::core
        Movie["Movie Model"]:::core
        Show["Showtime Model"]:::core
        Res["Reservation Model"]:::core
    end
    
    subgraph Utils
        Pass["Password Utils"]:::utility
        UUID["UUID Generator"]:::utility
        Config["Configuration Management"]:::utility
    end
    
    DB[(Database)]:::database
    
    Client --> API
    API --> Auth
    Auth --> JWT
    
    JWT --> AuthC & MovieC & ShowC & ResC
    
    AuthC --> AuthS
    MovieC --> MovieS
    ShowC --> ShowS
    ResC --> ResS
    
    AuthS --> User
    MovieS --> Movie
    ShowS --> Show
    ResS --> Res
    
    User & Movie & Show & Res --> DB
    
    AuthS --> Pass
    AuthS & MovieS & ShowS & ResS --> UUID
    AuthS & MovieS & ShowS & ResS --> Config
    
    %% Click events for component mapping
    click API "https://github.com/yeboahd24/movie-reservation-system/blob/main/routes/routes.go"
    click Auth "https://github.com/yeboahd24/movie-reservation-system/blob/main/utils/middleware.go"
    click JWT "https://github.com/yeboahd24/movie-reservation-system/blob/main/utils/jwt.go"
    click DB "https://github.com/yeboahd24/movie-reservation-system/blob/main/config/db.go"
    click Config "https://github.com/yeboahd24/movie-reservation-system/blob/main/config/config.go"
    
    click AuthC "https://github.com/yeboahd24/movie-reservation-system/blob/main/controllers/auth_controller.go"
    click MovieC "https://github.com/yeboahd24/movie-reservation-system/blob/main/controllers/movie_controller.go"
    click ShowC "https://github.com/yeboahd24/movie-reservation-system/blob/main/controllers/showtime_controller.go"
    click ResC "https://github.com/yeboahd24/movie-reservation-system/blob/main/controllers/reservation_controller.go"
    
    click AuthS "https://github.com/yeboahd24/movie-reservation-system/blob/main/services/auth_service.go"
    click MovieS "https://github.com/yeboahd24/movie-reservation-system/blob/main/services/movie_service.go"
    click ShowS "https://github.com/yeboahd24/movie-reservation-system/blob/main/services/showtime_service.go"
    click ResS "https://github.com/yeboahd24/movie-reservation-system/blob/main/services/reservation_service.go"
    
    click User "https://github.com/yeboahd24/movie-reservation-system/blob/main/models/user.go"
    click Movie "https://github.com/yeboahd24/movie-reservation-system/blob/main/models/movie.go"
    click Show "https://github.com/yeboahd24/movie-reservation-system/blob/main/models/showtime.go"
    click Res "https://github.com/yeboahd24/movie-reservation-system/blob/main/models/reservation.go"
    
    click Pass "https://github.com/yeboahd24/movie-reservation-system/blob/main/utils/password.go"
    click UUID "https://github.com/yeboahd24/movie-reservation-system/blob/main/utils/uuid.go"
    
    %% Legend
    subgraph Legend
        E[External Interface]:::external
        A[Authentication Component]:::auth
        C[Core Component]:::core
        U[Utility Component]:::utility
        D[(Database)]:::database
    end
```
