# sujit-rao/cafe-aroma architecture

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

- Interactive diagram: https://gitdiagram.com/sujit-rao/cafe-aroma
- Repository: https://github.com/sujit-rao/cafe-aroma

## Overview

##### Main Components

A. Frontend Layer:
- Static Assets (CSS, JS, Images)
- HTML Templates
- Main pages: Home, Cart, Profile, Checkout, etc.
- Use blue coloring for frontend components

B. Backend Layer:
- Authentication App (user management)
- Main App (core business logic)
- Project Configuration (cafe_aroma)
- Use green coloring for backend components

C. Database Layer:
- User/Customer Model
- Product Model
- Order Model
- Use orange coloring for database components

D. External Services:
- Use purple coloring for external services

##### Component Relationships

- Client → Backend: HTTP/HTTPS requests
- Backend → Database: Model operations
- Backend → Razorpay: Payment processing
- Razorpay → Backend: Payment callbacks

##### Detailed Component Breakdown

A. Authentication Module:
- Custom user model
- Authentication views (login/signup)
- User management

B. Main Application Module:
- Product management
- Cart functionality
- Order processing
- Payment integration
- Static file handling

##### Data Flow Indicators

- Static file serving (wavy lines)

##### Additional Elements

A. Include a section for:
- Media storage (media/product_images)
- Static file serving
- URL routing structure

B. Management Commands:
- Custom management commands (create_customers)

##### Technical Stack Indicators

- Frontend: HTML, CSS, JavaScript
- Backend: Django
- Database: SQLite
- Payment: Razorpay
- Static/Media: Local storage

##### Security Layer

Security measures:
- Django's authentication system
- Payment gateway security
- CSRF protection

##### Development Environment

Development tools:
- Local development server
- Migration system
- Admin interface

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef frontend fill:#3498db,stroke:#2980b9,color:white
    classDef backend fill:#2ecc71,stroke:#27ae60,color:white
    classDef database fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    classDef security fill:#e74c3c,stroke:#c0392b,color:white

    %% Frontend Layer
    subgraph Frontend
        StaticAssets["Static Assets"]
        Templates["Templates"]
        Pages["Core Pages"]
        
        subgraph StaticFiles
            CSS["CSS Files"]
            JS["JavaScript"]
            Images["Images"]
        end
        
        subgraph CorePages
            Home["Home Page"]
            Cart["Cart Page"]
            Profile["Profile Page"]
            Checkout["Checkout Page"]
            Payment["Payment Pages"]
        end
        
        StaticAssets --> StaticFiles
        Templates --> CorePages
    end

    %% Backend Layer
    subgraph Backend
        DjangoCore["Django Core"]
        
        subgraph AuthApp["Authentication App"]
            AuthViews["Auth Views"]
            AuthModels["Auth Models"]
            AuthUrls["Auth URLs"]
        end
        
        subgraph MainApp["Main Application"]
            MainViews["Main Views"]
            MainModels["Main Models"]
            MainUrls["Main URLs"]
            Commands["Management Commands"]
        end
        
        subgraph Config["Project Configuration"]
            Settings["Settings"]
            ProjectUrls["Project URLs"]
        end
    end

    %% Database Layer
    subgraph Database
        SQLite["SQLite Database"]
        UserModel["User/Customer Model"]
        ProductModel["Product Model"]
        OrderModel["Order Model"]
    end

    %% External Services
    RazorPay["Razorpay Payment Gateway"]:::external

    %% Media Storage
    MediaStorage["Media Storage"]

    %% Relationships
    Frontend --> Backend
    Backend --> Database
    Backend --> RazorPay
    RazorPay --> Backend
    Backend --> MediaStorage

    %% Click Events
    click StaticAssets "https://github.com/sujit-rao/Cafe-Aroma/tree/main/main/static"
    click CSS "https://github.com/sujit-rao/Cafe-Aroma/tree/main/main/static/css"
    click JS "https://github.com/sujit-rao/Cafe-Aroma/tree/main/main/static/js"
    click Images "https://github.com/sujit-rao/Cafe-Aroma/tree/main/main/static/images"
    click Templates "https://github.com/sujit-rao/Cafe-Aroma/tree/main/main/templates/html"
    click Home "https://github.com/sujit-rao/Cafe-Aroma/blob/main/main/templates/html/index.html"
    click Cart "https://github.com/sujit-rao/Cafe-Aroma/blob/main/main/templates/html/cart.html"
    click Profile "https://github.com/sujit-rao/Cafe-Aroma/blob/main/main/templates/html/profile.html"
    click Checkout "https://github.com/sujit-rao/Cafe-Aroma/blob/main/main/templates/html/checkout.html"
    click Payment "https://github.com/sujit-rao/Cafe-Aroma/blob/main/main/templates/html/razorpay_checkout.html"
    click AuthApp "https://github.com/sujit-rao/Cafe-Aroma/tree/main/authentication"
    click AuthViews "https://github.com/sujit-rao/Cafe-Aroma/blob/main/authentication/views.py"
    click AuthModels "https://github.com/sujit-rao/Cafe-Aroma/blob/main/authentication/models.py"
    click AuthUrls "https://github.com/sujit-rao/Cafe-Aroma/blob/main/authentication/urls.py"
    click MainApp "https://github.com/sujit-rao/Cafe-Aroma/tree/main/main"
    click MainViews "https://github.com/sujit-rao/Cafe-Aroma/blob/main/main/views.py"
    click MainModels "https://github.com/sujit-rao/Cafe-Aroma/blob/main/main/models.py"
    click MainUrls "https://github.com/sujit-rao/Cafe-Aroma/blob/main/main/urls.py"
    click Config "https://github.com/sujit-rao/Cafe-Aroma/tree/main/cafe_aroma"
    click Settings "https://github.com/sujit-rao/Cafe-Aroma/blob/main/cafe_aroma/settings.py"
    click ProjectUrls "https://github.com/sujit-rao/Cafe-Aroma/blob/main/cafe_aroma/urls.py"
    click Commands "https://github.com/sujit-rao/Cafe-Aroma/blob/main/main/management/commands/create_customers.py"
    click MediaStorage "https://github.com/sujit-rao/Cafe-Aroma/tree/main/media/product_images"

    %% Style Applications
    class Frontend,StaticAssets,Templates,Pages,StaticFiles,CorePages,CSS,JS,Images,Home,Cart,Profile,Checkout,Payment frontend
    class Backend,DjangoCore,AuthApp,MainApp,Config,AuthViews,AuthModels,AuthUrls,MainViews,MainModels,MainUrls,Commands,Settings,ProjectUrls backend
    class Database,SQLite,UserModel,ProductModel,OrderModel database
    class RazorPay external
```
