# roniantoniius/warung-omega-ecommerce architecture

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

- Interactive diagram: https://gitdiagram.com/roniantoniius/warung-omega-ecommerce
- Repository: https://github.com/roniantoniius/warung-omega-ecommerce

## Overview

##### Main Components

A. Frontend Layer:
- Templates (Jinja-based views)
- Main templates: products, cart, transactions, recipes
- Static Assets (CSS, JS, images)

B. Backend Layer (FastAPI):
- Authentication Service
- Route Controllers
- Product Management
- Cart Management
- Category Management
- Search Functionality
- Recipe Management
- Image Upload Service
- Email Service

C. Database Layer:
- PostgreSQL Database (via Supabase)
- Tortoise ORM Models

D. External Services:
- Midtrans Payment Gateway
- OAuth Authentication
- Supabase Services
- Email Service Provider

**[Client Layer]**
- ↓
**[API Gateway/Load Balancer]**
- ↓
**[Application Layer]**
- ↓
**[Database Layer]**

##### Component Relationships

- HTTP/HTTPS requests between frontend and backend
- Database queries through Tortoise ORM
- External API calls to Midtrans and OAuth providers
- Email service communications

##### Specific Implementation Details

Key architectural elements:
**[Frontend (Jinja Templates)] ←→ [FastAPI Backend]**
- ↑                           ↑

**[Static Assets]               [Route Controllers]**
- ↑

- [Authentication Service]
- ↑

- [Database] ←→ [Tortoise ORM] → [External Services]

##### Additional Elements

- Container orchestration layer (Docker/Kubernetes)
- Environment configuration
- Security layers
- API endpoints grouping

##### Deployment Flow

Deployment process:
**[Local Development] → [Docker Container] → [Kubernetes Cluster] → [Heroku Platform]**

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        Browser["Web Browser"]
    end

    subgraph "Frontend Layer"
        Templates["Templates"]
        StaticAssets["Static Assets"]
        PurchaseView["Purchase View"]:::frontend
        ProductsView["Products View"]:::frontend
        RecipeView["Recipe Views"]:::frontend
        TransactionView["Transaction View"]:::frontend
    end

    subgraph "API Gateway"
        LoadBalancer["Load Balancer"]
        MainApp["Main Application"]:::backend
    end

    subgraph "Application Layer"
        AuthService["Authentication Service"]:::backend
        EmailService["Email Service"]:::backend
        
        subgraph "Route Controllers"
            ProductMgmt["Product Management"]:::backend
            CartMgmt["Cart Management"]:::backend
            CategoryMgmt["Category Management"]:::backend
            SearchFunc["Search Functionality"]:::backend
            RecipeMgmt["Recipe Management"]:::backend
            ImageUpload["Image Upload Service"]:::backend
        end
    end

    subgraph "Database Layer"
        Database["PostgreSQL/Supabase"]:::database
        ORM["Tortoise ORM"]:::database
        Models["Data Models"]:::database
    end

    subgraph "External Services"
        Midtrans["Midtrans Payment"]:::external
        OAuth["OAuth Provider"]:::external
        Supabase["Supabase Services"]:::external
        EmailProvider["Email Provider"]:::external
    end

    subgraph "Deployment"
        Docker["Docker Container"]:::deployment
        Kubernetes["Kubernetes Cluster"]:::deployment
    end

    %% Relationships
    Browser --> LoadBalancer
    LoadBalancer --> MainApp
    MainApp --> AuthService
    MainApp --> Templates
    Templates --> StaticAssets
    
    AuthService --> OAuth
    EmailService --> EmailProvider
    
    ProductMgmt & CartMgmt & CategoryMgmt & SearchFunc & RecipeMgmt & ImageUpload --> ORM
    ORM --> Database
    ORM --> Models
    
    CartMgmt --> Midtrans
    MainApp --> Supabase

    %% Click Events
    click AuthService "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/app/authentication.py"
    click EmailService "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/app/emails.py"
    click Database "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/database/db.py"
    click MainApp "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/app/main.py"
    click Models "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/app/models.py"
    click ProductMgmt "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/app/routes/product_routes.py"
    click CartMgmt "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/app/routes/cart_routes.py"
    click CategoryMgmt "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/app/routes/categories_routes.py"
    click SearchFunc "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/app/routes/search_routes.py"
    click RecipeMgmt "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/app/routes/resep_routes.py"
    click ImageUpload "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/app/routes/upload_image_routes.py"
    click TransactionView "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/templates/daftar-transaksi.jinja"
    click ProductsView "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/templates/products.jinja"
    click RecipeView "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/templates/resep.jinja"
    click PurchaseView "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/templates/beli.html"
    click Docker "https://github.com/roniantoniius/Warung-Omega-Ecommerce/tree/master/Dockerfile"
    click Kubernetes "https://github.com/roniantoniius/Warung-Omega-Ecommerce/blob/master/deployment.yaml"

    %% Styling
    classDef frontend fill:#3498db
    classDef backend fill:#2ecc71
    classDef database fill:#9b59b6
    classDef external fill:#f1c40f
    classDef deployment fill:#e74c3c

    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        DB["Database Component"]:::database
        Ext["External Service"]:::external
        Deploy["Deployment Component"]:::deployment
    end
```
