# ankushmalik/propgage architecture

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

- Interactive diagram: https://gitdiagram.com/ankushmalik/propgage
- Repository: https://github.com/ankushmalik/propgage

## Overview

##### Main Components

A. Client-Side Layer:
- Web Interface (Rails Views)
- Asset Pipeline (JavaScript/CSS)
- User Authentication Forms

B. Server-Side Components:
- Application Controllers
- User Management System
- Bidding System
- Post Management
- Asset Management

C. Data Layer:
- Database (likely PostgreSQL based on Rails convention)
- Active Record Models
- File Storage (for user profile pictures and assets)

##### Key Relationships to Highlight

- Users <-> Posts (Asset listings)
- Posts <-> Bids
- Users <-> Pictures (attachments)
- Users (dual roles as lenders and borrowers)

##### Architectural Pattern

The system follows the Model-View-Controller (MVC) pattern typical of Rails applications:

**Client Layer**
- ↕
**Controller Layer (Authentication/Authorization)**
- ↕
**Model Layer (Business Logic)**
- ↕
**Database Layer**

##### Specific Implementation Details

A. Frontend Components (Blue):
- User Interface Views (/app/views)
- Asset Pipeline (JavaScript/CSS in /app/assets)
- Devise Authentication Views

B. Backend Components (Green):
- Controllers:
- Home Controller (main interface)
- Posts Controller (asset listings)
- Bids Controller (bidding system)
- Users Controller (user management)

C. Models (Yellow):
- User (with Devise integration)
- Post (asset listings)
- Bid (lending offers)
- Picture (attachments)
- Tag (categorization)

D. Database (Purple):
- PostgreSQL Tables
- Active Record Associations

##### External Services Integration

Integration points for:
- File Storage System (for attachments)
- Authentication System (Devise)
- Asset Pipeline

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef frontend fill:#a8d1f0,stroke:#333
    classDef backend fill:#90EE90,stroke:#333
    classDef model fill:#FFE5B4,stroke:#333
    classDef database fill:#DDA0DD,stroke:#333
    classDef security fill:#FFB6C1,stroke:#333

    %% Client Layer
    subgraph ClientLayer
        UI["Web Interface"]:::frontend
        Assets["Asset Pipeline"]:::frontend
        AuthViews["Authentication Views"]:::frontend
    end

    %% Controller Layer
    subgraph ControllerLayer
        AppController["Application Controller"]:::backend
        HomeController["Home Controller"]:::backend
        PostsController["Posts Controller"]:::backend
        BidsController["Bids Controller"]:::backend
        UsersController["Users Controller"]:::backend
    end

    %% Model Layer
    subgraph ModelLayer
        User["User Model"]:::model
        Post["Post Model"]:::model
        Bid["Bid Model"]:::model
        Picture["Picture Model"]:::model
        Tag["Tag Model"]:::model
    end

    %% Data Layer
    subgraph DataLayer
        DB[(PostgreSQL Database)]:::database
        FileStorage[(File Storage)]:::database
        Schema[(Database Schema)]:::database
    end

    %% External Services
    DeviseAuth{"Devise Authentication"}:::security

    %% Relationships
    UI --> AppController
    UI --> AuthViews
    AuthViews --> DeviseAuth
    Assets --> UI

    AppController --> HomeController
    AppController --> PostsController
    AppController --> BidsController
    AppController --> UsersController

    HomeController --> User
    PostsController --> Post
    BidsController --> Bid
    UsersController --> User

    User --> DB
    Post --> DB
    Bid --> DB
    Picture --> DB
    Tag --> DB
    Picture --> FileStorage

    %% Click Events
    click UI "https://github.com/AnkushMalik/Propgage/tree/master/app/views"
    click Assets "https://github.com/AnkushMalik/Propgage/tree/master/app/assets"
    click AuthViews "https://github.com/AnkushMalik/Propgage/tree/master/app/views/devise"
    click AppController "https://github.com/AnkushMalik/Propgage/blob/master/app/controllers/application_controller.rb"
    click HomeController "https://github.com/AnkushMalik/Propgage/blob/master/app/controllers/home_controller.rb"
    click PostsController "https://github.com/AnkushMalik/Propgage/blob/master/app/controllers/posts_controller.rb"
    click BidsController "https://github.com/AnkushMalik/Propgage/blob/master/app/controllers/bids_controller.rb"
    click UsersController "https://github.com/AnkushMalik/Propgage/blob/master/app/controllers/users_controller.rb"
    click User "https://github.com/AnkushMalik/Propgage/blob/master/app/models/user.rb"
    click Post "https://github.com/AnkushMalik/Propgage/blob/master/app/models/post.rb"
    click Bid "https://github.com/AnkushMalik/Propgage/blob/master/app/models/bid.rb"
    click Picture "https://github.com/AnkushMalik/Propgage/blob/master/app/models/picture.rb"
    click Tag "https://github.com/AnkushMalik/Propgage/blob/master/app/models/tag.rb"
    click DB "https://github.com/AnkushMalik/Propgage/blob/master/config/database.yml"
    click Schema "https://github.com/AnkushMalik/Propgage/blob/master/db/schema.rb"
    click DeviseAuth "https://github.com/AnkushMalik/Propgage/blob/master/config/initializers/devise.rb"

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        ModelComp["Model Component"]:::model
        DataStore["Data Store"]:::database
        Security["Security Component"]:::security
    end
```
