# pglombardo/passwordpusher architecture

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

- Interactive diagram: https://gitdiagram.com/pglombardo/passwordpusher
- Repository: https://github.com/pglombardo/passwordpusher

## Overview

##### Main Components

a. Frontend Layer:
- Web Interface (Rails Views + Assets)
- JavaScript Controllers (Stimulus.js)
- Theme System
- Internationalization System

b. Application Layer:
- Rails Controllers
- Authentication System (Devise)
- Admin Dashboard
- Background Jobs System

c. Data Layer:
- Database (supports MySQL, PostgreSQL, MariaDB)
- Active Storage for file handling
- Encrypted Storage System

d. External Services:
- Email Service
- Translation Service
- Analytics (optional)

##### Key Architectural Patterns to Highlight

a. MVC Architecture:
- Models: Password, FilePush, URL, User, View
- Controllers: Separate controllers for each resource
- Views: ERB templates with layout system

b. Service-Oriented Components:
- Authentication Service
- Encryption Service
- Background Job Processing
- Internationalization Service

**[User/Browser Layer]**

- ▼
**[Load Balancer/Reverse Proxy]**

- ▼
**[Web Application Layer]**
- Frontend Components
- Asset Pipeline
- JavaScript Controllers
- View Templates

- Application Core
- Controllers
- Models
- Services
- Background Jobs

- Security Layer
- Authentication
- Authorization
- Encryption

- ▼
**[Data Layer]**
- Primary Database
- Active Storage
- Cache Store

##### Important Flows to Highlight

a. Password Push Flow:
**User → Web Interface → Controller → Encryption Service → Database**

b. Password Retrieval Flow:
**User → Web Interface → Controller → Authentication → Decryption → View**

c. Background Jobs Flow:
**Scheduler → Job Queue → Worker → Database Cleanup**

##### Key Technical Details

- Encryption system using lockbox
- Multi-language support (29 languages)
- Theme system with 26 themes
- Docker/Kubernetes deployment options
- Background job processing
- API endpoints for programmatic access

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Browser/User Interface"]
    end

    subgraph LoadBalancer
        LB["Load Balancer/Reverse Proxy"]
    end

    subgraph WebLayer["Web Application Layer"]
        subgraph FrontEnd["Frontend Components"]
            WebUI["Web Interface"]:::frontend
            JSControllers["JavaScript Controllers"]:::frontend
            ThemeSystem["Theme System"]:::frontend
            I18n["Internationalization"]:::frontend
        end

        subgraph AppCore["Application Core"]
            Controllers["Rails Controllers"]:::core
            AuthSystem["Authentication System"]:::security
            AdminDash["Admin Dashboard"]:::core
            BGJobs["Background Jobs"]:::core
        end

        subgraph Security["Security Layer"]
            Auth["Authentication"]:::security
            Authz["Authorization"]:::security
            Encrypt["Encryption"]:::security
        end
    end

    subgraph DataLayer["Data Layer"]
        DB[(Primary Database)]:::data
        ActiveStore[(Active Storage)]:::data
        Cache[(Cache Store)]:::data
    end

    subgraph ExternalServices["External Services"]
        Email["Email Service"]:::external
        Translation["Translation Service"]:::external
        Analytics["Analytics"]:::external
    end

    %% Connections
    Browser --> LB
    LB --> WebUI
    WebUI --> JSControllers
    WebUI --> ThemeSystem
    WebUI --> I18n
    
    JSControllers --> Controllers
    Controllers --> Auth
    Controllers --> Encrypt
    Controllers --> BGJobs
    
    Auth --> DB
    BGJobs --> DB
    Controllers --> DB
    Controllers --> ActiveStore
    Controllers --> Cache
    
    Controllers --> Email
    I18n --> Translation
    Controllers --> Analytics

    %% Click Events
    click WebUI "https://github.com/pglombardo/PasswordPusher/tree/master/app/views/"
    click JSControllers "https://github.com/pglombardo/PasswordPusher/tree/master/app/javascript/controllers/"
    click ThemeSystem "https://github.com/pglombardo/PasswordPusher/tree/master/app/assets/stylesheets/themes/"
    click I18n "https://github.com/pglombardo/PasswordPusher/tree/master/config/locales/"
    click Controllers "https://github.com/pglombardo/PasswordPusher/tree/master/app/controllers/"
    click AuthSystem "https://github.com/pglombardo/PasswordPusher/tree/master/app/controllers/users/"
    click AdminDash "https://github.com/pglombardo/PasswordPusher/tree/master/app/controllers/admin/"
    click BGJobs "https://github.com/pglombardo/PasswordPusher/tree/master/app/jobs/"
    click DB "https://github.com/pglombardo/PasswordPusher/tree/master/app/models/"
    click ActiveStore "https://github.com/pglombardo/PasswordPusher/blob/master/config/storage.yml"
    click Encrypt "https://github.com/pglombardo/PasswordPusher/blob/master/config/initializers/lockbox.rb"
    click Email "https://github.com/pglombardo/PasswordPusher/tree/master/app/mailers/"
    click Translation "https://github.com/pglombardo/PasswordPusher/blob/master/config/initializers/translation.rb"

    %% Styles
    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef core fill:#4CAF50,stroke:#2E7D32,color:white
    classDef security fill:#F44336,stroke:#C62828,color:white
    classDef data fill:#FFC107,stroke:#FFA000,color:black
    classDef external fill:#9C27B0,stroke:#6A1B9A,color:white

    %% Legend
    subgraph Legend
        Frontend["Frontend Components"]:::frontend
        CoreComp["Core Components"]:::core
        SecurityComp["Security Components"]:::security
        DataComp["Data Components"]:::data
        ExtComp["External Services"]:::external
    end
```
