# ptlc8/events architecture

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

- Interactive diagram: https://gitdiagram.com/ptlc8/events
- Repository: https://github.com/ptlc8/events

## Overview

##### Main Components

a. Client Layer:
- Web Frontend (Vue.js PWA)
- Mobile App (Android/Capacitor)

b. API Layer:
- PHP Backend API
- Event-related endpoints (/events/*)
- User-related endpoints (/users/*)
- Image handling endpoints (/images/*)

c. Data Layer:
- MariaDB Database
- Event data storage
- User data storage

d. External Services:
- Mapbox (for maps)
- Portal Authentication System
- SeatGeek API
- Ticketmaster API
- OpenAgenda
- DataTourisme

##### Component Relationships

- Frontend → API (REST calls)
- API → Database (data persistence)
- API → External Services (third-party integrations)
- Aggregation Service → Database (event data population)

##### Key Architectural Elements

a. Frontend Architecture:
- Vue.js Components
- Stores (Vuex/Pinia)
- Router
- PWA capabilities

b. Backend Architecture:
- PHP API endpoints
- Authentication middleware
- Event aggregation system
Clear separation between these components

##### Deployment View

Docker containers for:
- Frontend container
- API container
- Database container
- Aggregation container

##### External Services Layer

Important Notes:
- Data flow for key operations (event search, user authentication, etc.)
- Aggregation system as it's a crucial component
- Which components are containerized
- Environment variable dependencies
- Version information for key components (PHP 8, MariaDB)

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#3498db,color:white
    classDef backend fill:#2ecc71,color:white
    classDef database fill:#95a5a6,color:white
    classDef external fill:#f1c40f,color:black
    classDef container fill:#e74c3c,color:white

    %% Client Layer
    subgraph ClientLayer
        WebFront["Web Frontend (Vue.js PWA)"]:::frontend
        MobileApp["Mobile App (Android/Capacitor)"]:::frontend
        
        subgraph FrontendComponents
            Components["Vue Components"]:::frontend
            Store["Vuex/Pinia Store"]:::frontend
            Router["Vue Router"]:::frontend
            Views["Vue Views"]:::frontend
        end
    end

    %% API Layer
    subgraph APILayer
        API["PHP Backend API"]:::backend
        EventAPI["Event Endpoints"]:::backend
        UserAPI["User Endpoints"]:::backend
        ImageAPI["Image Endpoints"]:::backend
        AuthSystem["Authentication System"]:::backend
    end

    %% Data Layer
    subgraph DataLayer
        DB[(MariaDB Database)]:::database
        DBEvents[("Event Storage")]:::database
        DBUsers[("User Storage")]:::database
    end

    %% External Services
    subgraph ExternalServices
        Mapbox["Mapbox"]:::external
        Portal["Portal Auth"]:::external
        SeatGeek["SeatGeek API"]:::external
        Ticketmaster["Ticketmaster API"]:::external
        OpenAgenda["OpenAgenda"]:::external
        DataTourisme["DataTourisme"]:::external
    end

    %% Aggregation System
    subgraph AggregationSystem
        Aggregator["Event Aggregator"]:::backend
        Providers["Provider Integrations"]:::backend
        DBInterface["Database Interface"]:::backend
    end

    %% Relationships
    WebFront --> API
    MobileApp --> API
    API --> DB
    Aggregator --> DB
    API --> ExternalServices
    AuthSystem --> Portal

    %% Component Connections
    Components --> Store
    Store --> Router
    Router --> Views

    %% Click Events
    click WebFront "https://github.com/ptlc8/events/tree/master/front"
    click Components "https://github.com/ptlc8/events/tree/master/front/src/components"
    click Store "https://github.com/ptlc8/events/tree/master/front/src/stores"
    click Router "https://github.com/ptlc8/events/tree/master/front/src/router"
    click Views "https://github.com/ptlc8/events/tree/master/front/src/views"
    click MobileApp "https://github.com/ptlc8/events/tree/master/app"
    click API "https://github.com/ptlc8/events/tree/master/api"
    click EventAPI "https://github.com/ptlc8/events/tree/master/api/src/events"
    click UserAPI "https://github.com/ptlc8/events/tree/master/api/src/users"
    click ImageAPI "https://github.com/ptlc8/events/tree/master/api/src/images"
    click DB "https://github.com/ptlc8/events/tree/master/database"
    click Aggregator "https://github.com/ptlc8/events/tree/master/aggregation"
    click Providers "https://github.com/ptlc8/events/tree/master/aggregation/providers"
    click DBInterface "https://github.com/ptlc8/events/blob/master/aggregation/database.js"
    click AuthSystem "https://github.com/ptlc8/events/blob/master/api/src/users/login.php"

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        DatabaseComp["Database Component"]:::database
        ExternalComp["External Service"]:::external
    end
```
