# neel-shetty/colosseum architecture

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

- Interactive diagram: https://gitdiagram.com/neel-shetty/colosseum
- Repository: https://github.com/neel-shetty/colosseum

## Overview

##### Main Components
- Frontend (Client): Represent the Next.js application housed in the client folder. Emphasize pages (login, signup, profile, leaderboard, instructions), components, and utility functions. Note the use of Tailwind CSS and configuration files.
- Backend (Server): Represent the Go application using Fiber. Inside the backend folder you have organized routes/handlers (for auth, leaderboard, scores, etc.), middlewares (authentication), models (user, stats, etc.), initializers (database, GraphQL, environment loading), and routines. This component also includes Swagger documentation and API specs.
- Database: Although database configuration details are not directly visible in the file tree, the existence of “backend/initializers/db.go” clearly indicates that the backend interacts with a database. Include a database component (possibly SQL) that the backend communicates with.
- API Documentation & External Tools: Mention the API documentation available via Postman and the swagger files located in backend/docs. This helps in understanding API endpoints and integrations.
- Containerization & Deployment: Note Dockerfiles, docker-compose files, and GitHub workflows indicating containerized development and CI/CD practices. These should be represented as a deployment or infrastructure layer that deploys both the frontend and backend services.

##### Relationships and Interactions
- Optionally, represent external documentation tools or API gateways if relevant.

##### Architectural Patterns & Design Principles
- Separation of Concerns: The project clearly differentiates between the client (UI/UX with Next.js) and the server (API handling and business logic).
- Containerization: Use of Docker and docker-compose suggests the design emphasizes environment consistency and ease of deployment.
- API Versioning and Documentation: The existence of swagger & Postman documentation indicates a focus on clear API design and versioning.

##### Relevant Technologies
- Frontend: Next.js, Tailwind CSS, Typescript (as seen in the tsconfig), and ESLint.
- Backend: Go, Fiber web framework, and supporting libraries (authentication, hashing utilities, etc.). Also mention the use of GraphQL as part of the initialization.
- Deployment: Docker, docker-compose, GitHub Actions (workflows).
- API Documentation: Swagger and Postman documentation to clearly define API endpoints.

##### Final Checklist
- Modularity by differentiating between routes/handlers, business logic, and deployment/infrastructure.

## Diagram (Mermaid)

```mermaid
graph TB

  %% Frontend Layer
  subgraph "Frontend Layer"
    F_main["Frontend (Next.js)"]:::frontend
    F_pages["Pages (client/src/app)"]:::frontendDetail
    F_components["Components (client/src/components)"]:::frontendDetail
    F_main --> F_pages
    F_main --> F_components
  end

  %% Backend Layer
  subgraph "Backend Layer"
    B_main["Backend (Go + Fiber)"]:::backend
    B_handlers["Handlers (backend/handlers)"]:::backendDetail
    B_models["Models (backend/models)"]:::backendDetail
    B_initializers["Initializers (backend/initializers)"]:::backendDetail
    B_middlewares["Middlewares (backend/middlerwares)"]:::backendDetail
    B_routines["Routines (backend/routines)"]:::backendDetail
    B_dbinit["DB Init (db.go)"]:::backendDetail
    B_main --> B_handlers
    B_main --> B_models
    B_main --> B_initializers
    B_main --> B_middlewares
    B_main --> B_routines
    B_initializers --> B_dbinit
  end

  %% Database Component
  subgraph "Database"
    DB["Database (SQL)"]:::database
  end

  %% DevOps and Deployment
  subgraph "DevOps & Deployment"
    CI["CI/CD Pipeline (GitHub Actions)"]:::deployment
    subgraph "Containerization"
      BD["Backend Dockerfile"]:::deployment
      BD_dev["Backend Dockerfile Dev"]:::deployment
      FD["Frontend Dockerfile"]:::deployment
      DC["Docker Compose (backend/docker-compose.yml)"]:::deployment
      DC_dev["Docker Compose Dev (backend/docker-compose.dev.yml)"]:::deployment
    end
  end

  %% API Documentation Component
  API_docs["API Documentation (Swagger/Postman)"]:::apiDocs

  %% Interactions
  F_main -->|"REST/GraphQL_API_Calls"| B_main
  B_main -->|"Database_Query"| DB
  API_docs -->|"API_Specs"| B_main
  CI -->|"Build&Deploy"| F_main
  CI -->|"Build&Deploy"| B_main

  %% Click Events
  click F_main "https://github.com/neel-shetty/colosseum/tree/main/client"
  click F_pages "https://github.com/neel-shetty/colosseum/tree/main/client/src/app"
  click F_components "https://github.com/neel-shetty/colosseum/tree/main/client/src/components"
  click B_main "https://github.com/neel-shetty/colosseum/tree/main/backend"
  click B_handlers "https://github.com/neel-shetty/colosseum/tree/main/backend/handlers"
  click B_models "https://github.com/neel-shetty/colosseum/tree/main/backend/models"
  click B_initializers "https://github.com/neel-shetty/colosseum/tree/main/backend/initializers"
  click B_middlewares "https://github.com/neel-shetty/colosseum/tree/main/backend/middlerwares"
  click B_routines "https://github.com/neel-shetty/colosseum/tree/main/backend/routines"
  click B_dbinit "https://github.com/neel-shetty/colosseum/blob/main/backend/initializers/db.go"
  click API_docs "https://github.com/neel-shetty/colosseum/tree/main/backend/docs"
  click BD "https://github.com/neel-shetty/colosseum/tree/main/backend/Dockerfile"
  click BD_dev "https://github.com/neel-shetty/colosseum/tree/main/backend/Dockerfile-dev"
  click FD "https://github.com/neel-shetty/colosseum/tree/main/client/Dockerfile"
  click DC "https://github.com/neel-shetty/colosseum/blob/main/backend/docker-compose.yml"
  click DC_dev "https://github.com/neel-shetty/colosseum/blob/main/backend/docker-compose.dev.yml"
  click CI "https://github.com/neel-shetty/colosseum/blob/main/.github/workflows/backend.yml"

  %% Styles
  classDef frontend fill:#aaf,stroke:#000,stroke-width:2px;
  classDef frontendDetail fill:#ddf,stroke:#000,stroke-width:1px;
  classDef backend fill:#afa,stroke:#000,stroke-width:2px;
  classDef backendDetail fill:#dfd,stroke:#000,stroke-width:1px;
  classDef database fill:#ffd,stroke:#000,stroke-width:2px;
  classDef deployment fill:#fdd,stroke:#000,stroke-width:2px;
  classDef apiDocs fill:#dff,stroke:#000,stroke-width:2px;
```
