# hassyyy/expense-manager-jaan architecture

> Architecture diagram of the GitHub repository hassyyy/expense-manager-jaan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hassyyy/expense-manager-jaan
- Repository: https://github.com/hassyyy/expense-manager-jaan

## Overview

##### Project type and purpose
- From the file tree and README title (“expense-manager”), this is a full-stack Ruby on Rails monolithic web application for tracking expenses/transactions.
- It uses Rails MVC, Stimulus JS (importmap), Avo (a Rails admin engine), ActionCable (real-time channels), ActiveJob, and ActionMailer.

##### File structure
- Top-level Ruby/Rails config: Gemfile, config/, db/, app/, bin/, lib/, public/, storage/.
- app/ splits into:
- app/controllers – HTTP controllers plus an Avo sub-controller for admin UI
- app/models – ActiveRecord models (Transaction)
- app/views – ERB views for both public UI and Avo cards/partials/layouts
- app/assets + app/javascript – CSS (Sprockets) and Stimulus controllers (importmap)
- app/channels – ActionCable channels
- app/jobs & app/mailers – background jobs & emails
- Avo admin: app/avo/cards, dashboards, filters, resources define metrics and CRUD
- Config: Puma web server, database.yml, importmap, initializers for Avo, CSP, etc.
- Procfile indicates Heroku/Procfile-based deployment.

##### Readme insights
- We infer from conventions and file tree that this is a standard Rails MVC monolith with an admin engine.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        direction TB
        Browser["Client Browser"]:::external
        Stimulus["StimulusJS Controllers"]:::httpBlue
        CSS["CSS Assets"]:::httpBlue
        Importmap["Importmap Config"]:::httpBlue
    end

    %% Web Layer
    subgraph "Web Layer"
        direction TB
        Entry["HTTP Entrypoint (Procfile / Puma)"]:::httpBlue
        Router["Rails Router"]:::httpBlue
        Controllers["Rails Controllers"]:::httpBlue
        AvoEngine["Avo Admin Engine"]:::httpBlue
    end

    %% Domain Layer
    subgraph "Domain Layer"
        direction TB
        Models["ActiveRecord Models"]:::httpBlue
        Views["Rails Views"]:::httpBlue
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        Database["PostgreSQL"]:::external
        Storage["ActiveStorage Service"]:::external
    end

    %% Infrastructure Services
    subgraph "Infrastructure"
        direction TB
        WebSocket["ActionCable (WebSocket)"]:::realTimeOrange
        Jobs["ActiveJob Workers"]:::asyncGreen
        Mailer["ActionMailer"]:::asyncGreen
        SMTP["SMTP Service"]:::external
        S3["S3 / External Storage"]:::external
    end

    %% Relationships
    Browser -->|"HTTP Requests"| Entry
    Stimulus -->|"Enhances UI"| Browser
    CSS -->|"Styles UI"| Browser
    Importmap -->|"Maps JS"| Stimulus

    Entry -->|"forwards requests"| Router
    Router -->|"dispatches to"| Controllers
    Controllers -->|"CRUD operations"| Models
    Controllers -->|"renders"| Views
    Controllers -->|"mounts at /avo"| AvoEngine
    AvoEngine -->|"uses"| Models
    AvoEngine -->|"renders"| Views

    Models -->|"persistence"| Database
    Views -->|"assets upload/download"| Storage

    Controllers -->|"broadcast events"| WebSocket
    WebSocket -->|"push updates"| Browser

    Controllers -->|"enqueue jobs"| Jobs
    Jobs -->|"process async tasks"| Mailer
    Jobs -->|"store files"| Storage

    Mailer -->|"send emails"| SMTP

    Storage -->|"external persistence"| S3

    %% Click Events
    click Stimulus "https://github.com/hassyyy/expense-manager-jaan/tree/main/app/javascript/controllers/"
    click CSS "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/assets/stylesheets/application.css"
    click Importmap "https://github.com/hassyyy/expense-manager-jaan/blob/main/config/importmap.rb"
    click Entry "https://github.com/hassyyy/expense-manager-jaan/tree/main/Procfile"
    click Entry "https://github.com/hassyyy/expense-manager-jaan/blob/main/config.ru"
    click Entry "https://github.com/hassyyy/expense-manager-jaan/blob/main/config/puma.rb"
    click Entry "https://github.com/hassyyy/expense-manager-jaan/tree/main/bin/rails"
    click Router "https://github.com/hassyyy/expense-manager-jaan/blob/main/config/routes.rb"
    click Controllers "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/controllers/application_controller.rb"
    click Controllers "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/controllers/avo/transactions_controller.rb"
    click Models "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/models/transaction.rb"
    click Models "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/models/application_record.rb"
    click Database "https://github.com/hassyyy/expense-manager-jaan/blob/main/db/schema.rb"
    click Database "https://github.com/hassyyy/expense-manager-jaan/blob/main/db/migrate/20230215200000_create_transactions.rb"
    click Database "https://github.com/hassyyy/expense-manager-jaan/blob/main/config/database.yml"
    click Views "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/views/layouts/application.html.erb"
    click Views "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/views/layouts/mailer.html.erb"
    click Views "https://github.com/hassyyy/expense-manager-jaan/tree/main/app/views/avo/"
    click AvoEngine "https://github.com/hassyyy/expense-manager-jaan/tree/main/app/avo/cards/"
    click AvoEngine "https://github.com/hassyyy/expense-manager-jaan/tree/main/app/avo/dashboards/"
    click AvoEngine "https://github.com/hassyyy/expense-manager-jaan/tree/main/app/avo/filters/"
    click AvoEngine "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/avo/resources/transaction_resource.rb"
    click AvoEngine "https://github.com/hassyyy/expense-manager-jaan/blob/main/config/initializers/avo.rb"
    click WebSocket "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/channels/application_cable/channel.rb"
    click WebSocket "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/channels/application_cable/connection.rb"
    click WebSocket "https://github.com/hassyyy/expense-manager-jaan/blob/main/config/cable.yml"
    click Jobs "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/jobs/application_job.rb"
    click Mailer "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/mailers/application_mailer.rb"
    click Mailer "https://github.com/hassyyy/expense-manager-jaan/blob/main/app/views/layouts/mailer.html.erb"
    click Storage "https://github.com/hassyyy/expense-manager-jaan/blob/main/config/storage.yml"
    click Storage "https://github.com/hassyyy/expense-manager-jaan/tree/main/storage/"
    click Storage "https://github.com/hassyyy/expense-manager-jaan/tree/main/public/"
    click SMTP "https://github.com/hassyyy/expense-manager-jaan/blob/main/config/environments/*.rb"

    %% Styles
    classDef httpBlue fill:#cce5ff,stroke:#66b0ff,color:#004085;
    classDef asyncGreen fill:#d4edda,stroke:#28a745,color:#155724;
    classDef realTimeOrange fill:#fff3cd,stroke:#ffcd39,color:#856404;
    classDef externalGray fill:#e2e3e5,stroke:#b8b9ba,color:#6c757d;
```
