# joshinlisbon/wald architecture

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

- Interactive diagram: https://gitdiagram.com/joshinlisbon/wald
- Repository: https://github.com/joshinlisbon/wald

## Overview

##### Main Components

A. Frontend Layer:
- Assets (JavaScript, CSS, Images)
- Webpacker integration
- Views (ERB templates)
- Client-side components (in app/javascript/components)

B. Backend Layer:
- Controllers (Application, Pages, Projects, Users, Callbacks)
- Models (User, Project, Command)
- Services (HerokuService)

C. Database Layer:
- PostgreSQL (implied by Rails convention)
- Database migrations and schema

D. External Services:
- Devise for authentication
- OAuth integration (indicated by callbacks_controller and omniauth configuration)
- Heroku integration (via HerokuService)

**[Client Browser]**
- ↕
**[Frontend Layer]**
- Asset Pipeline
- Webpacker
- JavaScript Components
- SCSS Styles
- ↕
**[Application Layer]**
- Controllers
- Views (ERB)
- Helpers
- ↕
**[Business Logic Layer]**
- Models
- Services
- ↕
**[Database Layer]**
- PostgreSQL
- ↕
**[External Services]**
- Authentication (Devise/OAuth)
- Heroku Integration

##### Important Details to Highlight

a. MVC Architecture:
- Clear separation between Models, Views, and Controllers
- Routing layer (config/routes.rb)

b. Asset Management:
- Both asset pipeline and Webpacker paths
- JavaScript/CSS compilation flow

c. Authentication Flow:
- Devise integration
- OAuth authentication path
- Demonstrate user session management

d. Database Interactions:
- Active Record relationships
- Migration management
- Schema structure

##### Implementation Notes

- Maintain consistent spacing and alignment
- Annotations for critical paths

## Diagram (Mermaid)

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

    subgraph Frontend
        Assets["Asset Pipeline"]:::frontend
        click Assets "https://github.com/JoshInLisbon/WALD/tree/master/app/assets"
        Webpacker["Webpacker"]:::frontend
        click Webpacker "https://github.com/JoshInLisbon/WALD/tree/master/config/webpack"
        JSComponents["JavaScript Components"]:::frontend
        click JSComponents "https://github.com/JoshInLisbon/WALD/tree/master/app/javascript/components"
        Styles["SCSS Styles"]:::frontend
        click Styles "https://github.com/JoshInLisbon/WALD/tree/master/app/assets/stylesheets"
        AssetJS["JavaScript Assets"]:::frontend
        click AssetJS "https://github.com/JoshInLisbon/WALD/tree/master/app/assets/javascripts"
    end

    subgraph Application
        AppLayout["Application Layout"]:::app
        click AppLayout "https://github.com/JoshInLisbon/WALD/blob/master/app/views/layouts/application.html.erb"
        Views["View Templates"]:::app
        click Views "https://github.com/JoshInLisbon/WALD/tree/master/app/views"
        Controllers["Controllers"]:::app
        click Controllers "https://github.com/JoshInLisbon/WALD/tree/master/app/controllers"
        Routes["Routes"]:::app
        click Routes "https://github.com/JoshInLisbon/WALD/blob/master/config/routes.rb"
    end

    subgraph BusinessLogic
        Models["Data Models"]:::logic
        click Models "https://github.com/JoshInLisbon/WALD/tree/master/app/models"
        Services["Services"]:::logic
        click Services "https://github.com/JoshInLisbon/WALD/tree/master/app/services"
        HerokuService["Heroku Service"]:::logic
        click HerokuService "https://github.com/JoshInLisbon/WALD/blob/master/app/services/heroku_service.rb"
        Channels["WebSocket Channels"]:::logic
        click Channels "https://github.com/JoshInLisbon/WALD/tree/master/app/channels"
    end

    subgraph Database
        PostgreSQL[(PostgreSQL)]:::db
        Migrations["Migrations"]:::db
        click Migrations "https://github.com/JoshInLisbon/WALD/tree/master/db/migrate"
        Schema["Schema"]:::db
        click Schema "https://github.com/JoshInLisbon/WALD/blob/master/db/schema.rb"
        SQLDesigner["SQL Designer"]:::db
        click SQLDesigner "https://github.com/JoshInLisbon/WALD/tree/master/public/sqldesigner"
    end

    subgraph Auth
        Devise["Devise"]:::auth
        click Devise "https://github.com/JoshInLisbon/WALD/blob/master/config/initializers/devise.rb"
        OAuth["OAuth"]:::auth
        click OAuth "https://github.com/JoshInLisbon/WALD/blob/master/app/controllers/callbacks_controller.rb"
        AuthViews["Auth Views"]:::auth
        click AuthViews "https://github.com/JoshInLisbon/WALD/tree/master/app/views/devise"
    end

    %% Connections
    Browser <--> Assets
    Browser <--> Webpacker
    Assets --> AppLayout
    Webpacker --> AppLayout
    JSComponents --> Views
    Controllers --> Views
    Routes --> Controllers
    Controllers --> Models
    Models --> PostgreSQL
    Services --> Models
    HerokuService --> Services
    Channels --> Controllers
    Migrations --> PostgreSQL
    Schema --> PostgreSQL
    SQLDesigner --> Schema
    Devise --> Controllers
    OAuth --> Devise
    AuthViews --> Views
    
    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef app fill:#2ecc71,stroke:#27ae60,color:white
    classDef logic fill:#e67e22,stroke:#d35400,color:white
    classDef db fill:#e74c3c,stroke:#c0392b,color:white
    classDef auth fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        Frontend_L["Frontend"]:::frontend
        App_L["Application"]:::app
        Logic_L["Business Logic"]:::logic
        DB_L["Database"]:::db
        Auth_L["Authentication"]:::auth
    end
```
