# drop-oss/drop architecture

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

- Interactive diagram: https://gitdiagram.com/drop-oss/drop
- Repository: https://github.com/drop-oss/drop

## Overview

##### Main System Components

a) Frontend Layer:
- Vue.js/Nuxt.js application components (from /components directory)
- Client-side routes (from /pages directory)
- User interface elements (admin panel, store, authentication flows)

b) Backend Layer:
- API Routes (/server/api/v1)
- Internal Services (/server/internal)
- Authentication/Security
- Library Management
- Metadata Services
- Object Storage
- Task Management
- Notification System
- Client Management

c) Data Layer:
- PostgreSQL Database (via Prisma)
- File Storage System (for game files)

##### Key Interactions to Highlight

- Authentication flows (both admin and user)
- Game distribution pipeline
- Metadata synchronization
- Client-server communication
- WebSocket notifications
- File upload/download processes

##### Specific Implementation Details

- Blue: Core application services
- Green: External integrations (GiantBomb API)
- Orange: Security components
- Purple: Storage systems
- Gray: Supporting services

##### Component Breakdown

**┌─ Frontend Layer ─────────────────────┐**
- Admin Interface                    │
- Store Interface                    │
- User Dashboard                     │
- Documentation System               │
- ┘

**┌─ API Layer ────────────────────────┐**
- Admin API                        │
- Client API                       │
- Store API                        │
- Authentication API               │
- ┘

**┌─ Service Layer ──────────────────────┐**
- Library Management                 │
- Metadata Service                   │
- Object Storage                     │
- Task Coordinator                   │
- Notification System                │
- ┘

**┌─ Data Layer ───────────────────────┐**
- PostgreSQL Database              │
- File Storage                     │
- ┘

##### Integration Points

External connections:
- GiantBomb API integration
- Client application connections
- Authentication providers
- File storage backends

##### Deployment Context

Containerization boundary:
- Docker container scope
- Volume mounts for game storage
- Network interfaces

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#e1f5fe,stroke:#01579b
    classDef api fill:#fff3e0,stroke:#ff6f00
    classDef service fill:#e8f5e9,stroke:#2e7d32
    classDef data fill:#fce4ec,stroke:#880e4f
    classDef external fill:#f3e5f5,stroke:#4a148c
    classDef config fill:#eceff1,stroke:#263238

    %% Frontend Layer
    subgraph Frontend
        UI[User Interface]
        AdminPanel[Admin Panel]
        StoreInterface[Store Interface]
        UserDash[User Dashboard]
    end
    
    %% API Layer
    subgraph APILayer
        AdminAPI[Admin API]
        ClientAPI[Client API]
        StoreAPI[Store API]
        AuthAPI[Authentication API]
        WSNotif[WebSocket Notifications]
        CollectionAPI[Collection API]
    end
    
    %% Service Layer
    subgraph Services
        AuthService[Authentication Service]
        LibraryMgmt[Library Management]
        MetadataService[Metadata Service]
        ObjStorage[Object Storage]
        TaskMgmt[Task Management]
        NotifSystem[Notification System]
        ClientMgmt[Client Management]
        SessionMgmt[Session Management]
        DownloadCoord[Download Coordinator]
        Config[System Configuration]
    end
    
    %% Data Layer
    subgraph DataLayer
        DB[(PostgreSQL DB)]
        FileStorage[(File Storage)]
        DBSchema[Database Schema]
        DBMigrations[Database Migrations]
        DBInterface[Database Interface]
    end
    
    %% External Systems
    GiantBomb[GiantBomb API]:::external
    
    %% Relationships
    UI --> AdminPanel & StoreInterface & UserDash
    AdminPanel & StoreInterface & UserDash --> APILayer
    
    APILayer --> Services
    Services --> DataLayer
    MetadataService --> GiantBomb
    
    WSNotif --> NotifSystem
    ObjStorage --> FileStorage
    AuthService --> SessionMgmt
    LibraryMgmt --> DownloadCoord
    DownloadCoord --> FileStorage
    
    %% Apply Classes
    class UI,AdminPanel,StoreInterface,UserDash frontend
    class AdminAPI,ClientAPI,StoreAPI,AuthAPI,WSNotif,CollectionAPI api
    class AuthService,LibraryMgmt,MetadataService,ObjStorage,TaskMgmt,NotifSystem,ClientMgmt,SessionMgmt,DownloadCoord service
    class DB,FileStorage,DBSchema,DBMigrations,DBInterface data
    class Config config

    %% Click Events
    click AdminPanel "https://github.com/Drop-OSS/drop/tree/main/pages/admin"
    click StoreInterface "https://github.com/Drop-OSS/drop/tree/main/pages/store"
    click UserDash "https://github.com/Drop-OSS/drop/tree/main/components/UserHeader"
    click AdminAPI "https://github.com/Drop-OSS/drop/tree/main/server/api/v1/admin"
    click ClientAPI "https://github.com/Drop-OSS/drop/tree/main/server/api/v1/client"
    click StoreAPI "https://github.com/Drop-OSS/drop/tree/main/server/api/v1/store"
    click AuthAPI "https://github.com/Drop-OSS/drop/tree/main/server/api/v1/auth"
    click WSNotif "https://github.com/Drop-OSS/drop/blob/main/server/api/v1/notifications/ws.get.ts"
    click CollectionAPI "https://github.com/Drop-OSS/drop/tree/main/server/api/v1/collection"
    click AuthService "https://github.com/Drop-OSS/drop/tree/main/server/internal/security"
    click LibraryMgmt "https://github.com/Drop-OSS/drop/tree/main/server/internal/applibrary"
    click MetadataService "https://github.com/Drop-OSS/drop/tree/main/server/internal/metadata"
    click ObjStorage "https://github.com/Drop-OSS/drop/tree/main/server/internal/objects"
    click TaskMgmt "https://github.com/Drop-OSS/drop/tree/main/server/internal/tasks"
    click NotifSystem "https://github.com/Drop-OSS/drop/tree/main/server/internal/notifications"
    click ClientMgmt "https://github.com/Drop-OSS/drop/tree/main/server/internal/clients"
    click SessionMgmt "https://github.com/Drop-OSS/drop/tree/main/server/internal/session"
    click DownloadCoord "https://github.com/Drop-OSS/drop/tree/main/server/internal/downloads"
    click DBSchema "https://github.com/Drop-OSS/drop/tree/main/prisma/schema"
    click DBMigrations "https://github.com/Drop-OSS/drop/tree/main/prisma/migrations"
    click DBInterface "https://github.com/Drop-OSS/drop/blob/main/server/internal/db/database.ts"
    click Config "https://github.com/Drop-OSS/drop/blob/main/server/internal/config/application-configuration.ts"
```
