# leslitech/lesli architecture

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

- Interactive diagram: https://gitdiagram.com/leslitech/lesli
- Repository: https://github.com/leslitech/lesli

## Overview

##### Main Components Identification

The system should be represented with these core components:

a) Backend Layer:
- Rails Engine Core (Lesli::Engine)
- Controllers Structure
- Models Layer
- Database System
- Authentication/Authorization System
- Service Layer
- Mailer System

b) Frontend Layer:
- Vue.js Components
- Asset Pipeline
- SCSS/Styling System
- JavaScript Modules

c) Integration Layer:
- API Interfaces
- External Services
- Cloud Object System

##### Detailed Component Breakdown

**[Lesli Engine Core]**
- [Application Layer]
- Controllers (app/controllers/lesli/*)
- Models (app/models/lesli/*)
- Views (app/views/lesli/*)

- [Frontend Architecture]
- Vue.js Components (lib/vue/*)
- SCSS Framework (lib/scss/*)
- Asset Pipeline

- [Service Layer]
- Authentication (Devise)
- Authorization
- Custom Services
- Mailers

- [Database Layer]
- Migrations
- Seeds
- Structure

- [Integration Layer]
- API Interfaces
- Cloud Objects
- External Services

##### Important Architectural Elements to Highlight

- Modular nature of the framework
- Engine-based architecture
- Separation between core functionality and extensible components
- Workflow system architecture
- Cloud object system integration

##### Key Relationships to Emphasize

- How the Lesli engine integrates with host Rails applications
- Relationship between core components and extensions
- Demonstrate the authentication/authorization flow
- Interaction between frontend and backend components

##### Technical Details

- Database connection pool
- Asset compilation pipeline
- Vue.js component hierarchy
- Service object pattern implementation
- API endpoint structure
- Mailer system integration

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core
        Engine["Rails Engine Core"]:::core
        Config["System Configuration"]:::core
    end

    subgraph "Application Layer"
        AppLayer["Application Components"]:::app
        Controllers["Controllers Layer"]:::app
        Models["Models Layer"]:::app
        Views["View Templates"]:::app
        Validators["Validation Layer"]:::app
    end

    subgraph "Service Layer"
        Services["Service Layer"]:::service
        AppServices["Application Services"]:::service
        Auth["Authentication System"]:::service
        AuthZ["Authorization System"]:::service
        Mailers["Mailer System"]:::service
    end

    subgraph "Frontend Architecture"
        FrontEnd["Frontend Layer"]:::frontend
        VueComponents["Vue.js Components"]:::frontend
        VueLayouts["Frontend Layouts"]:::frontend
        FrontComps["Frontend Components"]:::frontend
        SCSS["SCSS Framework"]:::frontend
        Assets["Asset Pipeline"]:::frontend
        JS["JavaScript Modules"]:::frontend
    end

    subgraph "Integration Layer"
        Integration["Integration Components"]:::integration
        API["API Interfaces"]:::integration
        Cloud["Cloud Object System"]:::integration
    end

    subgraph "Database Layer"
        DB[(Database)]:::database
        Migrations["Database Migrations"]:::database
    end

    %% Core Relationships
    Engine --> AppLayer
    Engine --> Integration
    Config --> Engine

    %% Application Layer Relationships
    AppLayer --> Controllers
    AppLayer --> Models
    AppLayer --> Views
    AppLayer --> Validators

    %% Service Layer Relationships
    Services --> AppServices
    Services --> Auth
    Services --> AuthZ
    Services --> Mailers

    %% Frontend Relationships
    FrontEnd --> VueComponents
    FrontEnd --> SCSS
    FrontEnd --> Assets
    FrontEnd --> JS
    VueComponents --> VueLayouts
    VueComponents --> FrontComps

    %% Integration Layer Relationships
    Integration --> API
    Integration --> Cloud

    %% Cross-Layer Relationships
    Controllers --> Services
    Models --> DB
    API --> Controllers
    Cloud --> Models
    Views --> FrontEnd
    Migrations --> DB

    %% Styling
    classDef core fill:#2d84ea,stroke:#333,stroke-width:2px
    classDef app fill:#3498db,stroke:#333,stroke-width:2px
    classDef service fill:#9b59b6,stroke:#333,stroke-width:2px
    classDef frontend fill:#2ecc71,stroke:#333,stroke-width:2px
    classDef integration fill:#e67e22,stroke:#333,stroke-width:2px
    classDef database fill:#34495e,stroke:#333,stroke-width:2px

    %% Click Events
    click Engine "https://github.com/LesliTech/Lesli/blob/master/lib/lesli/engine.rb"
    click Controllers "https://github.com/LesliTech/Lesli/tree/master/app/controllers/lesli/"
    click Models "https://github.com/LesliTech/Lesli/tree/master/app/models/lesli/"
    click Auth "https://github.com/LesliTech/Lesli/blob/master/app/controllers/lesli/application_devise_controller.rb"
    click Services "https://github.com/LesliTech/Lesli/tree/master/app/services/lesli/"
    click Mailers "https://github.com/LesliTech/Lesli/tree/master/app/mailers/lesli/"
    click VueComponents "https://github.com/LesliTech/Lesli/tree/master/lib/vue/"
    click SCSS "https://github.com/LesliTech/Lesli/tree/master/lib/scss/"
    click Assets "https://github.com/LesliTech/Lesli/tree/master/app/assets/"
    click JS "https://github.com/LesliTech/Lesli/tree/master/lib/assets/javascripts/lesli/"
    click Cloud "https://github.com/LesliTech/Lesli/tree/master/app/models/lesli/cloud_object/"
    click AuthZ "https://github.com/LesliTech/Lesli/blob/master/app/interfaces/lesli/authorization_interface.rb"
    click Migrations "https://github.com/LesliTech/Lesli/tree/master/db/migrate/v1/"
    click Views "https://github.com/LesliTech/Lesli/tree/master/app/views/lesli/"
    click API "https://github.com/LesliTech/Lesli/tree/master/app/interfaces/lesli/"
    click Validators "https://github.com/LesliTech/Lesli/tree/master/app/validators/lesli/"
    click AppServices "https://github.com/LesliTech/Lesli/blob/master/app/services/lesli/application_lesli_service.rb"
    click VueLayouts "https://github.com/LesliTech/Lesli/tree/master/lib/vue/layouts/"
    click FrontComps "https://github.com/LesliTech/Lesli/tree/master/lib/vue/components/"
    click Config "https://github.com/LesliTech/Lesli/blob/master/config/initializers/lesli.rb"
```
