# netsbump/dropit architecture

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

- Interactive diagram: https://gitdiagram.com/netsbump/dropit
- Repository: https://github.com/netsbump/dropit

## Overview

##### High-Level Architecture Overview

a) Client Layer (Frontend):
- React/TypeScript web application
- Feature modules (Athletes, Programs, Exercises, Workouts)
- TanStack Query for state management
- Shadcn/Tailwind UI components

b) API Layer (Backend):
- NestJS application structure
- Modular architecture (Complex, Exercise, Video modules)
- MikroORM integration

c) Data Layer:
- PostgreSQL database
- Redis cache
- Typesense search engine

##### Component Breakdown

Frontend Components (apps/web):
- Exercise management
- Complex management
- Program management
- Athlete management
- Routing structure using TanStack Router
- Shared UI components

Backend Components (apps/api):
- Modular structure:
- Exercise module
- Complex module
- Video module
- Category management
- Entity relationships
- Migration handling

##### Integration Layer
- Contract package (packages/contract) as the interface between frontend and backend
- Schema validation (packages/schemas)
- API communication flow

##### Infrastructure Components
- Docker containers
- CI/CD pipeline (GitHub Actions)
- Development tools (Biome, Turborepo)

##### Data Flow Visualization

- Client-server communication
- Database interactions
- Cache operations
- Search functionality
- Authentication flow

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Layer"]
        direction TB
        Web["Web Application"]:::frontend
        subgraph Features["Feature Modules"]
            direction TB
            ExerciseUI["Exercise Management"]:::frontend
            ComplexUI["Complex Management"]:::frontend
            ProgramUI["Program Management"]:::frontend
            AthleteUI["Athlete Management"]:::frontend
        end
        UI["UI Components"]:::frontend
        Router["TanStack Router"]:::frontend
        Query["TanStack Query"]:::frontend
    end

    subgraph API["API Layer"]
        direction TB
        NestJS["NestJS Application"]:::backend
        subgraph Modules["API Modules"]
            direction TB
            ExerciseAPI["Exercise Module"]:::backend
            ComplexAPI["Complex Module"]:::backend
            VideoAPI["Video Module"]:::backend
            CategoryAPI["Category Management"]:::backend
        end
        MikroORM["MikroORM"]:::backend
        Entities["Entities"]:::backend
        Migrations["Migrations"]:::backend
    end

    subgraph Data["Data Layer"]
        direction TB
        Postgres[(PostgreSQL)]:::database
        Redis[(Redis Cache)]:::database
        Typesense["Typesense Search"]:::database
    end

    subgraph Integration["Integration Layer"]
        direction TB
        Contract["API Contracts"]:::integration
        Schemas["Schema Validation"]:::integration
    end

    subgraph Infrastructure["Infrastructure"]
        direction TB
        Docker["Docker Containers"]:::infra
        GitHub["GitHub Actions"]:::infra
        Turbo["Turborepo"]:::infra
        Biome["Biome"]:::infra
    end

    %% Connections
    Web --> Features
    Features --> UI
    Features --> Router
    Features --> Query
    Query --> Contract
    Contract --> NestJS
    NestJS --> Modules
    Modules --> MikroORM
    MikroORM --> Entities
    MikroORM --> Migrations
    Entities --> Postgres
    API --> Redis
    API --> Typesense
    Contract --> Schemas

    %% Click Events
    click Web "https://github.com/Netsbump/dropit/tree/main/apps/web"
    click UI "https://github.com/Netsbump/dropit/tree/main/apps/web/src/components/ui"
    click ExerciseUI "https://github.com/Netsbump/dropit/tree/main/apps/web/src/components/exercises"
    click ComplexUI "https://github.com/Netsbump/dropit/tree/main/apps/web/src/components/complex"
    click Router "https://github.com/Netsbump/dropit/tree/main/apps/web/src/routes"
    click ExerciseAPI "https://github.com/Netsbump/dropit/tree/main/apps/api/src/modules/exercise"
    click ComplexAPI "https://github.com/Netsbump/dropit/tree/main/apps/api/src/modules/complex"
    click VideoAPI "https://github.com/Netsbump/dropit/tree/main/apps/api/src/modules/video"
    click CategoryAPI "https://github.com/Netsbump/dropit/tree/main/apps/api/src/modules/complex-category"
    click Entities "https://github.com/Netsbump/dropit/tree/main/apps/api/src/entities"
    click Migrations "https://github.com/Netsbump/dropit/tree/main/apps/api/src/migrations"
    click MikroORM "https://github.com/Netsbump/dropit/blob/main/apps/api/src/mikro-orm.config.ts"
    click Contract "https://github.com/Netsbump/dropit/tree/main/packages/contract"
    click Schemas "https://github.com/Netsbump/dropit/tree/main/packages/schemas"
    click Docker "https://github.com/Netsbump/dropit/blob/main/docker-compose.yml"
    click GitHub "https://github.com/Netsbump/dropit/blob/main/.github/workflows/ci.yml"
    click Turbo "https://github.com/Netsbump/dropit/blob/main/turbo.json"
    click Biome "https://github.com/Netsbump/dropit/blob/main/biome.json"

    %% Styles
    classDef frontend fill:#2563eb,color:white
    classDef backend fill:#16a34a,color:white
    classDef database fill:#ca8a04,color:white
    classDef integration fill:#9333ea,color:white
    classDef infra fill:#475569,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        DB["Database"]:::database
        Int["Integration"]:::integration
        Inf["Infrastructure"]:::infra
    end
```
