# t-x-t/dukatia architecture

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

- Interactive diagram: https://gitdiagram.com/t-x-t/dukatia
- Repository: https://github.com/t-x-t/dukatia

## Overview

##### Main Components Overview
The system consists of three main components that should be prominently featured:

a. Frontend (Nuxt.js Application)
- As a client-side component
- Modules like Accounts, Transactions, Assets, Budgets, and Dashboard
- Vue.js components structure

b. Backend (Rust Application)
- As the main server component
- Modular structure with key services:
- Transaction management
- Account management
- Asset management
- Budget management
- User management
- Chart generation
- Currency handling

c. Database (PostgreSQL)
- As the data persistence layer
- Note about SQL migrations (given the numerous upgrade files)

##### Component Relationships

- Frontend → Backend: REST API calls (documented in /docs/dev/rest_api/)
- Backend → Database: Data persistence layer
- Authentication flow (access_token module)

##### Architectural Patterns to Highlight

- The modular architecture (each feature has its own module)
- MVC-like pattern in the backend (db.rs, mod.rs, rest_api.rs structure)
- The chart generation system (separate chart modules for different features)

##### Detailed Component Breakdown

Frontend Layer:
**[Frontend (Nuxt.js)]**
- Pages (accounts, assets, budgets, etc.)
- Components (forms, charts, details views)
- API Integration Layer

Backend Layer:
**[Backend (Rust)]**
- Web Server
- Feature Modules
- Transactions
- Accounts
- Assets
- Budgets
- Users
- Chart Generation
- Authentication

Database Layer:
**[PostgreSQL]**
- Core Tables
- Migration System

##### Additional Elements

- Docker container boundaries
- Environment configuration
- API endpoints
- Security layers (PEPPER configuration)

This system design should effectively communicate both the high-level architecture and the detailed component interactions that make Dukatia a comprehensive financial management system.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        FE[Frontend Nuxt.js]
        Pages[Pages Module]
        Comps[Components]
        Charts[Chart Components]
        API[API Integration]
        
        FE --> Pages
        FE --> Comps
        Comps --> Charts
        FE --> API
    end

    subgraph Server
        WS[Web Server]
        
        subgraph Services
            TS[Transaction Service]
            AS[Account Service]
            AstS[Asset Service]
            BS[Budget Service]
            US[User Management]
            CG[Chart Generation]
            CH[Currency Handler]
            Auth[Authentication]
            DS[Dashboard Service]
        end
        
        WS --> Services
    end

    subgraph Storage
        DB[(PostgreSQL)]
        Mig[SQL Migrations]
        Init[Database Init]
        
        DB --> Mig
        DB --> Init
    end

    subgraph Config
        DC[Docker Config]
        BC[Backend Config]
        FC[Frontend Config]
    end

    API --> WS
    Services --> DB
    
    %% Styling
    classDef frontend fill:#3498db,color:white
    classDef backend fill:#2ecc71,color:white
    classDef database fill:#f1c40f,color:white
    classDef config fill:#e74c3c,color:white
    
    class FE,Pages,Comps,Charts,API frontend
    class WS,TS,AS,AstS,BS,US,CG,CH,Auth,DS backend
    class DB,Mig,Init database
    class DC,BC,FC config
    
    %% Click events
    click FE "https://github.com/t-x-t/dukatia/tree/main/frontend"
    click Pages "https://github.com/t-x-t/dukatia/tree/main/frontend/pages"
    click Comps "https://github.com/t-x-t/dukatia/tree/main/frontend/components"
    click Charts "https://github.com/t-x-t/dukatia/tree/main/frontend/components/Chart"
    click TS "https://github.com/t-x-t/dukatia/tree/main/backend/src/transaction"
    click AS "https://github.com/t-x-t/dukatia/tree/main/backend/src/account"
    click AstS "https://github.com/t-x-t/dukatia/tree/main/backend/src/asset"
    click BS "https://github.com/t-x-t/dukatia/tree/main/backend/src/budget"
    click US "https://github.com/t-x-t/dukatia/tree/main/backend/src/user"
    click CG "https://github.com/t-x-t/dukatia/tree/main/backend/src/chart"
    click CH "https://github.com/t-x-t/dukatia/tree/main/backend/src/currency"
    click Auth "https://github.com/t-x-t/dukatia/tree/main/backend/src/access_token"
    click WS "https://github.com/t-x-t/dukatia/tree/main/backend/src/webserver"
    click Mig "https://github.com/t-x-t/dukatia/tree/main/backend/sql"
    click Init "https://github.com/t-x-t/dukatia/blob/main/backend/sql/init.sql"
    click DC "https://github.com/t-x-t/dukatia/blob/main/docker-compose.yml"
    click BC "https://github.com/t-x-t/dukatia/tree/main/backend/src/config"
    click FC "https://github.com/t-x-t/dukatia/blob/main/frontend/nuxt.config.ts"
    click DS "https://github.com/t-x-t/dukatia/tree/main/backend/src/dashboard"
```
