# candyvelazco100/flower_shop_app architecture

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

- Interactive diagram: https://gitdiagram.com/candyvelazco100/flower_shop_app
- Repository: https://github.com/candyvelazco100/flower_shop_app

## Overview

##### Project type and purpose
- This is a full-stack web application (“Flora Vibrante”) for managing sales, purchases, users, products and receipts in a flower shop.
- It consists of a Python/Flask backend (in `source/`) and a Node.js-based SOAP microservice (in `webservice/`), all wired together via Docker Compose and persisting data in a MySQL database.

##### File structure
- Top‐level directories:
- `source/` – main Flask service, organized by controllers (`app.py`, `app_rest.py`), models (`models/`), static assets (`static/`), templates (`templates/`), and a separate client subfolder (`source/client/`) hosting a JS-driven UI with Handlebars and plain JS.
- `webservice/` – a standalone Node.js app exposing SOAP endpoints (`soap_service.py` in Python wrapper, plus `index.js`, `app.js`) to integrate with external systems.
- `database/` – MySQL schemas, init scripts and dumps.
- Docker support: `Dockerfile`, `docker-compose.yaml`.
- Architectural cues:
- MVC pattern in Flask (`models/`, `templates/`, route handlers).
- Clear separation of concerns: backend API vs. client UI vs. microservice.

##### README
- Confirms: Flask + MySQL + Node.js SOAP.
- Describes the database schema, entity models, and high-level feature set (users, products, receipts, etc.).
- Outlines environment setup and Docker deployment.

##### Essential detail checklist
- MVC layers inside Flask (Controllers, Models, Views).
- Both the web UI routes and REST endpoints.
- Do not omit the Node.js SOAP microservice—treat it as a first-class component.
- Data flow from the user’s browser all the way to persistent storage.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    Browser["Browser"]:::frontend
    subgraph "Client Assets" 
        direction TB
        Public["Public Assets"]:::frontend
        HBS["Handlebars Views"]:::frontend
    end
    Browser -->|"loads assets"| Public
    Browser -->|"renders templates"| HBS

    %% Docker Orchestrated Services
    subgraph "Docker Compose Network"
        direction TB

        %% Flask Service
        subgraph "Flask Container"
            direction TB
            FlaskApp["Flask App\nHTTP:5000"]:::backend
            subgraph "MVC Layers"
                direction TB
                WebController["Web UI Controllers\napp.py"]:::backend
                APIController["REST API Controllers\napp_rest.py"]:::backend
                Models["Models\nsource/models/"]:::backend
                StaticAssets["Static Assets\nsource/static/"]:::backend
                Templates["Templates\nsource/templates/"]:::backend
            end
            FlaskApp -->|routes to| WebController
            FlaskApp -->|API calls| APIController
            WebController -->|uses| Models
            APIController -->|uses| Models
            WebController -->|renders| Templates
            WebController -->|serves| StaticAssets
        end

        %% SOAP Microservice
        subgraph "SOAP Service Container"
            direction TB
            SOAPIndex["Index Entry\nindex.js"]:::microservice
            SOAPApp["App Setup\napp.js"]:::microservice
            SOAPService["SOAP Wrapper\nsoap_service.py"]:::microservice
            SOAPIndex --> SOAPApp
            SOAPApp --> SOAPService
        end

        %% Database
        MySQLDB["MySQL Database\nPort:3306"]:::database

        %% Inter-service Communication
        Browser -->|HTTP:5000| FlaskApp
        FlaskApp -->|SQL queries| MySQLDB
        FlaskApp -->|SOAP RPC:8000| SOAPService
    end

    %% Click Events
    click Public "https://github.com/candyvelazco100/flower_shop_app/tree/main/source/client/public/"
    click HBS "https://github.com/candyvelazco100/flower_shop_app/tree/main/source/client/views/"
    click WebController "https://github.com/candyvelazco100/flower_shop_app/blob/main/source/app.py"
    click APIController "https://github.com/candyvelazco100/flower_shop_app/blob/main/source/app_rest.py"
    click Models "https://github.com/candyvelazco100/flower_shop_app/tree/main/source/models/"
    click StaticAssets "https://github.com/candyvelazco100/flower_shop_app/tree/main/source/static/"
    click Templates "https://github.com/candyvelazco100/flower_shop_app/tree/main/source/templates/"
    click SOAPIndex "https://github.com/candyvelazco100/flower_shop_app/blob/main/webservice/index.js"
    click SOAPApp "https://github.com/candyvelazco100/flower_shop_app/blob/main/webservice/app.js"
    click SOAPService "https://github.com/candyvelazco100/flower_shop_app/blob/main/webservice/soap_service.py"
    click MySQLDB "https://github.com/candyvelazco100/flower_shop_app/blob/main/database/database-schema.sql"

    %% Styles
    classDef frontend fill:#ade8f4,stroke:#333,stroke-width:1px
    classDef backend  fill:#b7e4c7,stroke:#333,stroke-width:1px
    classDef microservice fill:#d4a5f5,stroke:#333,stroke-width:1px
    classDef database fill:#ffcc80,stroke:#333,stroke-width:1px
```
