# youssefbouhdyd/slice-haven architecture

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

- Interactive diagram: https://gitdiagram.com/youssefbouhdyd/slice-haven
- Repository: https://github.com/youssefbouhdyd/slice-haven

## Overview

##### Main components
- Web Server/Backend Application:
- Represented by main.py (or app.py as mentioned in the README).
- This is where the routing, business logic, and API endpoints are defined.
- Database:
- The SQLite database in the ./database folder (pizza_data.db).
- This component handles data persistence (orders, records, restaurant details, etc.).
- Frontend:
- HTML Templates (base.html, order.html, records.html) located in the ./templates folder.
- Static assets (CSS in static/css, JavaScript in static/javascript, images, and webfonts).
- Deployment/Configuration:
- Files like Procfile and requirements.txt ensure that the application can be deployed and its dependencies installed.
- Version Control & Community:
- Files such as .gitignore and CONTRIBUTING.md which support collaborative development.

##### Relationships and interactions between components
- The web server (main.py) receives HTTP requests from client browsers.
- For each request, it uses the appropriate HTML template from the templates folder to generate responses.
- The static folder is referenced in the rendered HTML so that CSS, JavaScript, and images load in the user’s browser.
- The backend communicates with the SQLite database to fetch, update, or store pizza order data.
- The Procfile and requirements.txt are used during deployment, dictating how the application is run and what dependencies it needs.

##### Architectural patterns and design principles
- Separation of Concerns: The project clearly separates the frontend (templates and static files) from the backend (Python scripts and database).
- MVC-like Structure (loosely): While not strictly adhering to a full MVC framework, the use of templates (view) and the Python script (controller and model logic interactions with the database) models some of MVC principles.
- Simplicity: A single entry point (main.py/app.py) for handling web requests, which is typical of lightweight web frameworks.

##### Relevant technologies and frameworks
- Python as the core language.
- Likely Flask or similar lightweight web framework.
- SQLite as the database engine.
- HTML/CSS/JavaScript for frontend development.
- Deployment configuration via Procfile.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Section
    subgraph "Client"
        CB("Client Browser"):::client
    end

    %% Server Section
    subgraph "Server"
        WS("Web Server (main.py)"):::server
        subgraph "Frontend Files"
            T1("Base Template (base.html)"):::server
            T2("Order Template (order.html)"):::server
            T3("Records Template (records.html)"):::server
            SA("Static Assets"):::server
        end
        subgraph "Deployment & Version Control"
            D1("Deployment: Procfile"):::deployment
            D2("Deployment: requirements.txt"):::deployment
            V1("Version Control: .gitignore"):::deployment
            V2("Version Control: CONTRIBUTING.md"):::deployment
        end
    end

    %% Database Section
    subgraph "Database"
        DB("SQLite Database (pizza_data.db)"):::db
    end

    %% Connections
    CB -->|"HTTP_Request"| WS
    WS -->|"Render_Template"| T1
    WS -->|"Render_Template"| T2
    WS -->|"Render_Template"| T3
    WS -->|"Serve_Assets"| SA
    WS -->|"Database_Query"| DB
    DB -->|"Query_Response"| WS

    %% Click Events
    click WS "https://github.com/youssefbouhdyd/slice-haven/blob/main/main.py"
    click DB "https://github.com/youssefbouhdyd/slice-haven/blob/main/database/pizza_data.db"
    click T1 "https://github.com/youssefbouhdyd/slice-haven/blob/main/templates/base.html"
    click T2 "https://github.com/youssefbouhdyd/slice-haven/blob/main/templates/order.html"
    click T3 "https://github.com/youssefbouhdyd/slice-haven/blob/main/templates/records.html"
    click SA "https://github.com/youssefbouhdyd/slice-haven/tree/main/static/"
    click D1 "https://github.com/youssefbouhdyd/slice-haven/tree/main/Procfile"
    click D2 "https://github.com/youssefbouhdyd/slice-haven/blob/main/requirements.txt"
    click V1 "https://github.com/youssefbouhdyd/slice-haven/blob/main/.gitignore"
    click V2 "https://github.com/youssefbouhdyd/slice-haven/blob/main/CONTRIBUTING.md"

    %% Styles
    classDef client fill:#a3d5ff,stroke:#333,stroke-width:2px;
    classDef server fill:#d5ffa3,stroke:#333,stroke-width:2px;
    classDef db fill:#ffcccb,stroke:#333,stroke-width:2px;
    classDef deployment fill:#eee8aa,stroke:#333,stroke-width:2px;
```
