# cgoat24/la-beuverie architecture

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

- Interactive diagram: https://gitdiagram.com/cgoat24/la-beuverie
- Repository: https://github.com/cgoat24/la-beuverie

## Overview

##### Main Components

Frontend Layer:
- SvelteKit Frontend (src/routes)
- Component Library (src/components)
- Client-side Stores (src/lib/stores)
- Form Validations (src/lib/validations)

API Layer:
- REST API endpoints (src/routes/api)
- Authentication Routes (src/routes/auth)
- Service Layer (src/lib/server/services)

Database Layer:
- PostgreSQL Database
- Prisma ORM Layer (prisma/schema.prisma)

##### Component Relationships

- Frontend components → API Layer (via HTTP requests)
- API Layer → Service Layer (internal calls)
- Service Layer → Prisma ORM → PostgreSQL
- Authentication flow between Frontend → Auth Routes → Database

##### Specific Implementation Details

- Drink Management System
- CRUD operations
- Search functionality
- Filtering system
- User Authentication System
- Login/Signup
- Session management
- Tag System
- Tag management
- Filtering by tags

##### Important Architectural Patterns to Highlight
- MVC-like pattern in the SvelteKit structure
- Service-based architecture for business logic
- Repository pattern via Prisma
- Component-based UI architecture

##### Technical Stack Indicators
- SvelteKit (Frontend framework)
- Prisma (ORM)
- PostgreSQL (Database)
- Docker (Container)
- TailwindCSS (Styling)

**[Client Layer (Browser)]**
- ↕
**[Frontend Components]**
- ↕
**[API Routes Layer]**
- ↕
**[Service Layer]**
- ↕
**[Data Access Layer]**
- ↕
**[Database Layer]**

##### Validation layer for data integrity

- Using consistent symbols
- Grouping related components
- Using straight lines for direct connections
- Including brief descriptions for complex interactions

This structure reflects the modern full-stack application architecture while maintaining clarity about the specific implementation details of La Beuverie.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph Frontend
        Routes["Frontend Routes"]:::frontend
        Components["Component Library"]:::frontend
        Stores["Client-side Stores"]:::frontend
        Validations["Form Validations"]:::frontend
        FormInputs["Form Input Components"]:::frontend
        ErrorHandling["Error Handling"]:::frontend
        HTTPUtils["HTTP Client Utilities"]:::frontend
    end

    subgraph API
        RestAPI["REST API Endpoints"]:::api
        AuthRoutes["Authentication Routes"]:::api
        DrinkAPI["Drink Management API"]:::api
        TagAPI["Tag System API"]:::api
    end

    subgraph Services
        ServiceLayer["Service Layer"]:::service
        AuthService["Authentication Service"]:::service
        DrinkService["Drink Service"]:::service
        SearchService["Search Service"]:::service
        UserService["User Service"]:::service
    end

    subgraph Data
        PrismaORM["Prisma ORM Layer"]:::data
        PostgreSQL[(PostgreSQL Database)]:::data
        Seeder["Data Seeding System"]:::data
    end

    %% Connections
    Browser --> Routes
    Routes --> Components
    Routes --> Stores
    Components --> FormInputs
    Components --> ErrorHandling
    Components --> HTTPUtils
    Components --> Validations

    HTTPUtils --> RestAPI
    HTTPUtils --> AuthRoutes
    HTTPUtils --> DrinkAPI
    HTTPUtils --> TagAPI

    RestAPI --> ServiceLayer
    AuthRoutes --> AuthService
    DrinkAPI --> DrinkService
    TagAPI --> SearchService

    ServiceLayer --> PrismaORM
    AuthService --> PrismaORM
    DrinkService --> PrismaORM
    SearchService --> PrismaORM
    UserService --> PrismaORM

    PrismaORM --> PostgreSQL
    Seeder --> PostgreSQL

    %% Click Events
    click Components "https://github.com/cgoat24/la-beuverie/tree/main/src/components"
    click Validations "https://github.com/cgoat24/la-beuverie/tree/main/src/lib/validations"
    click Stores "https://github.com/cgoat24/la-beuverie/tree/main/src/lib/stores"
    click RestAPI "https://github.com/cgoat24/la-beuverie/tree/main/src/routes/api"
    click AuthRoutes "https://github.com/cgoat24/la-beuverie/tree/main/src/routes/auth"
    click ServiceLayer "https://github.com/cgoat24/la-beuverie/tree/main/src/lib/server/services"
    click PrismaORM "https://github.com/cgoat24/la-beuverie/blob/main/prisma/schema.prisma"
    click Seeder "https://github.com/cgoat24/la-beuverie/tree/main/prisma/seeder"
    click DrinkAPI "https://github.com/cgoat24/la-beuverie/tree/main/src/routes/api/drinks"
    click TagAPI "https://github.com/cgoat24/la-beuverie/tree/main/src/routes/api/tags"
    click ErrorHandling "https://github.com/cgoat24/la-beuverie/blob/main/src/components/Error.svelte"
    click FormInputs "https://github.com/cgoat24/la-beuverie/tree/main/src/components/inputs"
    click AuthService "https://github.com/cgoat24/la-beuverie/blob/main/src/lib/server/services/authService.ts"
    click DrinkService "https://github.com/cgoat24/la-beuverie/blob/main/src/lib/server/services/drinkService.ts"
    click SearchService "https://github.com/cgoat24/la-beuverie/blob/main/src/lib/server/services/searchService.ts"
    click UserService "https://github.com/cgoat24/la-beuverie/blob/main/src/lib/server/services/userService.ts"
    click HTTPUtils "https://github.com/cgoat24/la-beuverie/blob/main/src/lib/utils/HTTPRequest.ts"
    click Routes "https://github.com/cgoat24/la-beuverie/tree/main/src/routes"

    %% Styles
    classDef frontend fill:#2563eb,color:white
    classDef api fill:#16a34a,color:white
    classDef service fill:#ca8a04,color:white
    classDef data fill:#9333ea,color:white

    %% Legend
    subgraph Legend
        Frontend_L[Frontend]:::frontend
        API_L[API Layer]:::api
        Service_L[Services]:::service
        Data_L[Data Layer]:::data
    end
```
