# eef-m/eventhub architecture

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

- Interactive diagram: https://gitdiagram.com/eef-m/eventhub
- Repository: https://github.com/eef-m/eventhub

## Overview

##### Project type and purpose
- This is a full-stack web application called “EventHub” for creating, managing, and registering users to events.
- Frontend: Single-Page Application built in Vue 3 serviced by Vite, Vue Router, Pinia, and styled with Tailwind CSS.
- Backend: REST API in Go using Gin for routing, GORM for ORM, and JWT for authentication.
- Database: PostgreSQL stores users, organizers, events, registrations, feedback, tickets.

##### File structure
- Top-level splits into two directories:
- backend/ – all Go code, organized by controllers, models, repositories, DTOs, middleware, routes, initializers, utils, and seeders.
- frontend/ – Vue 3 app organized by components (organizer vs participant vs shared UI), pages (views), services (API wrappers), stores (Pinia), router, assets, and configuration (Vite, tsconfig).
- Notice backend patterns:
- Initialization steps: load.env → connect.db → sync.db.
- Middleware for CORS, JWT-based authorization (“require”).
- Notice frontend layers:
- UI component library (./src/components/ui) for reusable primitives.
- Domain-specific components under organizer/ and participant/.
- Pages under src/pages map to views rendered by Vue Router.
- Services call backend endpoints.
- Stores manage application state.

##### README for additional insights
- Backend uses Gin, GORM, PostgreSQL, JWT.
- Frontend uses Vue Router for navigation and Pinia for state.
- No mention of additional external microservices—this is a monolithic API.

##### Elements
- Clear labels: “Vue SPA”, “Gin REST API”, “PostgreSQL”.
- Browser → API (HTTP request)
- API → DB (SQL queries)
- DB → API (query results)
- API → Browser (JSON responses)
- Blue rectangles for frontend components
- Green for backend services

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client: Vue SPA"
        direction TB
        main_ts["Entry Point\nmain.ts"]:::frontend
        App_vue["Root Component\nApp.vue"]:::frontend
        router_ts["Vue Router\nindex.ts"]:::frontend
        stores_ts["Pinia Stores\n*.ts"]:::frontend
        services_ts["API Service Wrappers\n*.ts"]:::frontend
        ui_organizer["UI Components\norganizer"]:::frontend
        ui_participant["UI Components\nparticipant"]:::frontend
        ui_shared["Shared UI Primitives"]:::frontend
        pages_auth["Page Views\nAuth"]:::frontend
        pages_org["Page Views\nOrganizer"]:::frontend
        pages_part["Page Views\nParticipant"]:::frontend
        layouts["Application Layouts"]:::frontend
        assets["Assets & Styles"]:::frontend
    end

    %% API Layer
    subgraph "API: Gin REST API"
        direction TB
        main_go["Entry Point\nmain.go"]:::backend
        load_env["Env Loader"]:::backend
        connect_db["Database Connector"]:::backend
        sync_db["DB Synchronizer"]:::backend
        seeders["Database Seeders\n*.go"]:::backend
        go_mod["Go Module\ngo.mod"]:::backend
        router_setup["HTTP Routing\nv1.route.go"]:::backend
        cors_mw["CORS Middleware"]:::middleware
        jwt_mw["JWT Authorization"]:::middleware
        controllers["REST Controllers\n*.go"]:::backend
        dto["Data Transfer Objects\n*.go"]:::backend
        repository["Repository Layer\n*.go"]:::backend
        models["GORM Models\n*.go"]:::backend
        utils["Utility Helpers\n*.go"]:::backend
    end

    %% Database
    DB["PostgreSQL Database"]:::db

    %% Client to API
    services_ts -->|"HTTP Requests"| router_setup

    %% Frontend flow
    main_ts --> App_vue --> router_ts --> stores_ts
    router_ts --> pages_auth
    router_ts --> pages_org
    router_ts --> pages_part
    App_vue --> layouts
    App_vue --> assets
    App_vue --> ui_shared
    App_vue --> ui_organizer
    App_vue --> ui_participant
    stores_ts --> services_ts

    %% Backend initialization
    main_go --> load_env --> connect_db --> sync_db --> seeders
    main_go --> router_setup
    main_go --> go_mod

    %% Routing and middleware
    router_setup --> cors_mw
    router_setup --> jwt_mw
    cors_mw --> controllers
    jwt_mw --> controllers

    %% Controller to persistence
    controllers --> dto
    controllers --> repository
    repository --> models
    models --> DB
    repository --> DB
    utils --> controllers

    %% Responses flow
    DB --> models --> controllers --> services_ts

    %% Click Events
    click main_ts "https://github.com/eef-m/eventhub/blob/main/frontend/src/main.ts"
    click App_vue "https://github.com/eef-m/eventhub/blob/main/frontend/src/App.vue"
    click router_ts "https://github.com/eef-m/eventhub/blob/main/frontend/src/router/index.ts"
    click stores_ts "https://github.com/eef-m/eventhub/tree/main/frontend/src/stores"
    click services_ts "https://github.com/eef-m/eventhub/tree/main/frontend/src/services"
    click ui_organizer "https://github.com/eef-m/eventhub/tree/main/frontend/src/components/organizer"
    click ui_participant "https://github.com/eef-m/eventhub/tree/main/frontend/src/components/participant"
    click ui_shared "https://github.com/eef-m/eventhub/tree/main/frontend/src/components/ui"
    click pages_auth "https://github.com/eef-m/eventhub/tree/main/frontend/src/pages/auth"
    click pages_org "https://github.com/eef-m/eventhub/tree/main/frontend/src/pages/organizer"
    click pages_part "https://github.com/eef-m/eventhub/tree/main/frontend/src/pages/participant"
    click layouts "https://github.com/eef-m/eventhub/tree/main/frontend/src/layouts"
    click assets "https://github.com/eef-m/eventhub/tree/main/frontend/src/assets"
    click main_go "https://github.com/eef-m/eventhub/blob/main/backend/main.go"
    click load_env "https://github.com/eef-m/eventhub/blob/main/backend/initializers/load.env.variables.go"
    click connect_db "https://github.com/eef-m/eventhub/blob/main/backend/initializers/connect.db.go"
    click sync_db "https://github.com/eef-m/eventhub/blob/main/backend/initializers/sync.db.go"
    click router_setup "https://github.com/eef-m/eventhub/blob/main/backend/routes/v1.route.go"
    click cors_mw "https://github.com/eef-m/eventhub/blob/main/backend/middleware/cors.go"
    click jwt_mw "https://github.com/eef-m/eventhub/blob/main/backend/middleware/require.go"
    click controllers "https://github.com/eef-m/eventhub/tree/main/backend/controllers"
    click dto "https://github.com/eef-m/eventhub/tree/main/backend/dto"
    click repository "https://github.com/eef-m/eventhub/tree/main/backend/repository"
    click models "https://github.com/eef-m/eventhub/tree/main/backend/models"
    click seeders "https://github.com/eef-m/eventhub/tree/main/backend/seeders"
    click utils "https://github.com/eef-m/eventhub/tree/main/backend/utils"
    click go_mod "https://github.com/eef-m/eventhub/blob/main/backend/go.mod"

    %% Styles
    classDef frontend fill:#CEF5FF,stroke:#0366d6,stroke-width:1px
    classDef backend fill:#DFFFD6,stroke:#28a745,stroke-width:1px
    classDef db fill:#FFDCDC,stroke:#d73a49,stroke-width:1px
    classDef middleware fill:#FDF5CE,stroke:#dcae00,stroke-width:1px
    class main_ts,App_vue,router_ts,stores_ts,services_ts,ui_organizer,ui_participant,ui_shared,pages_auth,pages_org,pages_part,layouts,assets frontend
    class main_go,load_env,connect_db,sync_db,seeders,go_mod,router_setup,controllers,dto,repository,models,utils backend
    class cors_mw,jwt_mw middleware
    class DB db
```
