# mikededo/stack architecture

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

- Interactive diagram: https://gitdiagram.com/mikededo/stack
- Repository: https://github.com/mikededo/stack

## Overview

##### High-Level Components

a) Applications Layer:
- Finance App (Port 3000)
- i18n App
- Advent App
Each as separate containers showing their internal structure

b) Shared Packages Layer:
- UI Components (@stack/ui)
- Actions (@stack/actions)
- Utils (@stack/utils)
- Layouts (@stack/layouts)
- Supabase Integration (@stack/supabase)

c) Infrastructure Layer:
- Supabase (Database & Authentication)
- Coolify (Deployment Platform)

##### Component Relationships

a) Inter-component Dependencies:

b) Deployment Flow:
- Source Code → Coolify → Deployed Apps

##### Detailed Component Breakdown

Finance App:
- Frontend (SvelteKit)
- Public Routes
- Private Routes
- Domain Logic
- Database Tables
- Books
- Expenses
- Tags
- Budget

i18n App:
- Frontend (SvelteKit)
- Project Management
- Language Management
- Translation Editor
- Database Tables
- Projects
- Languages
- Translations

##### Infrastructure Details

Supabase Section:
- PostgreSQL Database
- Authentication
- Row Level Security
- API Layer

Coolify Section:
- Build Pipeline
- Deployment Configuration
- Port Mapping

##### Additional Notes

Important details:
- Port mappings (3000 for Finance)
- Environment configurations
- Authentication flow
- Database migration paths
- Local development setup

**[Applications Layer]**
- ↓
**[Shared Packages Layer]**
- ↓
**[Infrastructure Layer]**

Remember to:
- Keep components aligned and properly spaced
- Use consistent styling for similar components
- Version information and deployment requirements
- Development vs production configurations

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef app fill:#2563eb,color:white
    classDef package fill:#eab308,color:black
    classDef infra fill:#dc2626,color:white
    classDef db fill:#16a34a,color:white
    classDef frontend fill:#3b82f6,color:white
    classDef backend fill:#22c55e,color:white

    %% Applications Layer
    subgraph Apps
        Finance["Finance App (Port 3000)"]
        I18N["i18n App"]
        Advent["Advent App"]

        subgraph FinanceDetails
            FinanceRoutes["Frontend Routes"]
            FinanceDB["Database Queries"]
            FinanceDomain["Domain Logic"]
        end

        subgraph I18NDetails
            I18NRoutes["Frontend Routes"]
            I18NDB["Database Queries"]
            I18NDomain["Domain Logic"]
        end

        subgraph AdventDetails
            AdventRoutes["Frontend Routes"]
            AdventComponents["Components"]
        end
    end

    %% Shared Packages Layer
    subgraph Packages
        UI["UI Components"]
        Actions["Actions"]
        Utils["Utils"]
        Layouts["Layouts"]
        SupabaseIntegration["Supabase Integration"]

        subgraph SupabaseIntegrationDetails
            Auth["Authentication"]
            DBIntegration["Database Integration"]
        end
    end

    %% Infrastructure Layer
    subgraph Infrastructure
        Supabase["Supabase"]
        Coolify["Coolify"]

        subgraph SupabaseDetails
            PostgreSQL["PostgreSQL Database"]
            RLS["Row Level Security"]
            APILayer["API Layer"]
        end
    end

    %% Relationships
    Finance --> UI
    Finance --> Actions
    Finance --> Utils
    Finance --> Layouts
    Finance --> SupabaseIntegration

    I18N --> UI
    I18N --> Actions
    I18N --> Utils
    I18N --> Layouts
    I18N --> SupabaseIntegration

    Advent --> UI
    Advent --> Actions
    Advent --> Utils
    Advent --> Layouts
    Advent --> SupabaseIntegration

    SupabaseIntegration --> Supabase
    Supabase --> PostgreSQL
    Supabase --> RLS
    Supabase --> APILayer

    Finance --> Coolify
    I18N --> Coolify
    Advent --> Coolify

    %% Component Classes
    class Finance,I18N,Advent app
    class UI,Actions,Utils,Layouts,SupabaseIntegration package
    class Supabase,Coolify infra
    class PostgreSQL,RLS,APILayer db
    class FinanceRoutes,I18NRoutes,AdventRoutes frontend
    class FinanceDB,I18NDB backend

    %% Click Events
    click Finance "https://github.com/mikededo/stack/tree/main/apps/finance/"
    click FinanceRoutes "https://github.com/mikededo/stack/tree/main/apps/finance/src/routes/"
    click FinanceDB "https://github.com/mikededo/stack/tree/main/apps/finance/src/lib/db/queries/"
    click FinanceDomain "https://github.com/mikededo/stack/tree/main/apps/finance/src/lib/domain/"
    
    click I18N "https://github.com/mikededo/stack/tree/main/apps/i18n/"
    click I18NRoutes "https://github.com/mikededo/stack/tree/main/apps/i18n/src/routes/"
    click I18NDB "https://github.com/mikededo/stack/tree/main/apps/i18n/src/lib/db/queries/"
    click I18NDomain "https://github.com/mikededo/stack/tree/main/apps/i18n/src/lib/domain/"
    
    click Advent "https://github.com/mikededo/stack/tree/main/apps/advent/"
    click AdventRoutes "https://github.com/mikededo/stack/tree/main/apps/advent/src/routes/"
    click AdventComponents "https://github.com/mikededo/stack/tree/main/apps/advent/src/lib/components/"
    
    click UI "https://github.com/mikededo/stack/tree/main/packages/ui/"
    click Actions "https://github.com/mikededo/stack/tree/main/packages/actions/src/"
    click Utils "https://github.com/mikededo/stack/tree/main/packages/utils/src/"
    click Layouts "https://github.com/mikededo/stack/tree/main/packages/layouts/src/components/"
    
    click SupabaseIntegration "https://github.com/mikededo/stack/tree/main/packages/supabase/"
    click Auth "https://github.com/mikededo/stack/blob/main/packages/supabase/src/auth.ts"
    click DBIntegration "https://github.com/mikededo/stack/blob/main/packages/supabase/src/database.ts"
    
    click PostgreSQL "https://github.com/mikededo/stack/tree/main/supabase/migrations/"
    click Supabase "https://github.com/mikededo/stack/blob/main/supabase/config.toml"
```
