# abdullahtariqlatif/rails_vault architecture

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

- Interactive diagram: https://gitdiagram.com/abdullahtariqlatif/rails_vault
- Repository: https://github.com/abdullahtariqlatif/rails_vault

## Overview

##### Main Components

A. Frontend Layer:
- Bootstrap 4.6.2 UI Framework
- JavaScript/Webpack Bundle
- jQuery 3.6.4
- PopperJS 1.16.1
- Asset Pipeline
- SCSS Stylesheets
- Images
- Webpacker (v5.0)
- Turbolinks 5

B. Application Layer:
- Controllers (Articles)
- Views (ERB Templates)
- Models (Article)
- Helpers
- Action Cable (WebSocket support)
- Action Mailer

C. Database Layer:
- SQLite3 Database
- Active Record ORM

- ┌─────────── Client Layer ───────────┐
- Browser / HTTP / WebSocket Requests│
- ┬─────────────────┘
- ↑         ↓
- ┌─────────── Rails App Layer ────────┐
- ┌─────────┐    ┌─────────┐       │
- Controllers│←→ │Views    │       │
- ┘    └─────────┘       │
- ↑            ↑              │
- ↓            ↓              │
- ┌─────────┐    ┌─────────┐       │
- Models   │←→ │Helpers  │       │
- ┘    └─────────┘       │
- ┬─────────────────┘
- ↑         ↓
- ┌────────── Database Layer ─────────┐
- SQLite3                │
- ┘

##### Component Relationships
- HTTP request flow from client to controllers
- MVC pattern interactions
- Asset compilation pipeline
- Database interactions through Active Record

##### Important Details

A. Asset Processing:
- ┌─── Asset Pipeline ───┐
- SCSS → CSS          │
- JS → Webpack Bundle │
- ┘

B. Request Flow:
- Browser → Routes → Controller → Model → Database
- ↳ Controller → View → Browser

- Ruby 2.7.8
- Rails 6.1.7.3
- NodeJS 16.18.0
- Webpack 5.0
- Bootstrap 4.6.2

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Browser (HTTP/WebSocket)"]:::client
    end

    subgraph Frontend
        AssetPipeline["Asset Pipeline"]:::frontend
        click AssetPipeline "https://github.com/abdullahtariqlatif/rails_vault/blob/main/app/assets/config/manifest.js"
        SCSS["SCSS Stylesheets"]:::frontend
        click SCSS "https://github.com/abdullahtariqlatif/rails_vault/blob/main/app/assets/stylesheets/application.scss"
        WebpackBundle["JavaScript/Webpack Bundle"]:::frontend
        click WebpackBundle "https://github.com/abdullahtariqlatif/rails_vault/blob/main/app/javascript/packs/application.js"
        WebpackConfig["Webpack Config"]:::frontend
        click WebpackConfig "https://github.com/abdullahtariqlatif/rails_vault/blob/main/config/webpack/environment.js"
        Bootstrap["Bootstrap 4.6.2"]:::frontend
    end

    subgraph "Rails Application"
        Routes["Routes"]:::app
        click Routes "https://github.com/abdullahtariqlatif/rails_vault/blob/main/config/routes.rb"
        
        subgraph "MVC Components"
            direction TB
            Controllers["Articles Controller"]:::controller
            click Controllers "https://github.com/abdullahtariqlatif/rails_vault/blob/main/app/controllers/articles_controller.rb"
            Views["Views (ERB Templates)"]:::view
            click Views "https://github.com/abdullahtariqlatif/rails_vault/blob/main/app/views/articles/index.html.erb"
            Models["Article Model"]:::model
            click Models "https://github.com/abdullahtariqlatif/rails_vault/blob/main/app/models/article.rb"
            Helpers["Helpers"]:::helper
            click Helpers "https://github.com/abdullahtariqlatif/rails_vault/blob/main/app/helpers/articles_helper.rb"
        end
        
        subgraph "Communication"
            ActionCable["Action Cable"]:::comm
            click ActionCable "https://github.com/abdullahtariqlatif/rails_vault/blob/main/app/channels/application_cable/channel.rb"
            ActionMailer["Action Mailer"]:::comm
            click ActionMailer "https://github.com/abdullahtariqlatif/rails_vault/blob/main/app/mailers/application_mailer.rb"
        end
        
        subgraph "Testing"
            ModelTests["Model Tests"]:::test
            click ModelTests "https://github.com/abdullahtariqlatif/rails_vault/blob/main/test/models/article_test.rb"
            ControllerTests["Controller Tests"]:::test
            click ControllerTests "https://github.com/abdullahtariqlatif/rails_vault/blob/main/test/controllers/articles_controller_test.rb"
            Fixtures["Test Fixtures"]:::test
            click Fixtures "https://github.com/abdullahtariqlatif/rails_vault/blob/main/test/fixtures/articles.yml"
        end
    end

    subgraph "Database Layer"
        Database["SQLite3 Database"]:::db
        click Database "https://github.com/abdullahtariqlatif/rails_vault/blob/main/config/database.yml"
        Schema["Database Schema"]:::db
        click Schema "https://github.com/abdullahtariqlatif/rails_vault/blob/main/db/schema.rb"
        Migrations["Migrations"]:::db
        click Migrations "https://github.com/abdullahtariqlatif/rails_vault/blob/main/db/migrate/20230501141324_create_articles.rb"
    end

    %% Relationships
    Browser --> Routes
    Routes --> Controllers
    Controllers --> Models
    Controllers --> Views
    Models --> Database
    Views --> Helpers
    Browser --> ActionCable
    
    %% Asset Flow
    AssetPipeline --> WebpackBundle
    SCSS --> AssetPipeline
    WebpackConfig --> WebpackBundle
    Bootstrap --> AssetPipeline

    %% Styles
    classDef client fill:#9BB8CD
    classDef frontend fill:#4A90E2
    classDef app fill:#82B366
    classDef controller fill:#82B366
    classDef view fill:#82B366
    classDef model fill:#82B366
    classDef helper fill:#82B366
    classDef comm fill:#82B366
    classDef test fill:#D4B089
    classDef db fill:#E8913A

    %% Legend
    subgraph Legend
        Client_["Client Layer"]:::client
        Frontend_["Frontend Layer"]:::frontend
        App_["Application Layer"]:::app
        DB_["Database Layer"]:::db
        Test_["Testing Components"]:::test
    end
```
