# standfacilerep/standfacile architecture

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

- Interactive diagram: https://gitdiagram.com/standfacilerep/standfacile
- Repository: https://github.com/standfacilerep/standfacile

## Overview

#### Purpose and topology
StandFacile is a Windows desktop suite for stand/point-of-sale operations. The solution contains four executable applications: the primary StandFacile client, kitchen display/client, monitoring client, and order client. Shared code centralizes domain, persistence, networking, printing, logging, and dialogs.

Paths: `StandFacile.sln`, `StandFacile/src/StandFacile.csproj`, `StandCucina/src/StandCucina.csproj`, `StandMonitor/src/StandMonitor.csproj`, `StandOrdini/src/StandOrdini.csproj`.

#### Application entry points and UI boundary
Each application is a C# WinForms executable: `Program.cs` starts a `MainForm`, which owns user-driven control flow. Designer/resource files are paired with forms, so UI behavior and layout are tightly coupled rather than separated into a web or service layer.

Paths: `StandFacile/src/Program.cs`, `StandFacile/src/MainForm.cs`, `StandCucina/src/Program.cs`, `StandMonitor/src/MainForm.cs`, `StandOrdini/src/MainForm.cs`.

#### Primary POS data management
`DataManager` is the central StandFacile data-management layer and operates on the `SF_Data` structure. It has dedicated persistence load/save extensions for the price-list/data model, making it the main boundary between POS UI state and storage/network operations.

Paths: `StandFacile/src/DataManager.cs`, `StandFacile/src/DataManager_PL_Load.cs`, `StandFacile/src/DataManager_PL_Save.cs`, `StandFacile/src/Define.cs`.

#### Database abstraction and storage backends
The shared database interface works on `DB_Data` and selects among local SQLite and remote MySQL/PostgreSQL implementations. Database-specific files are partitioned further by load, save, order, and monitor operations; callers should depend on the interface/common layer rather than a concrete backend.

Paths: `StandCommonSrc/dBaseIntf.cs`, `StandCommonSrc/dBaseIntf_ql.cs`, `StandCommonSrc/dBaseIntf_my.cs`, `StandCommonSrc/dBaseIntf_pg.cs`, `StandCommonSrc/dBaseIntf_ord_pg.cs`.

#### Remote database tunnel and trust boundary
StandFacile includes a MySQL remote-tunnel component for an externally hosted web database. Per the README, it uses HTTP tunneling to a PHP endpoint and requires its cipher key to match the remote tunnel. Cryptographic keys and the web-server address are intended to live in the root safe-file source; the README calls this `StandCommonSafe.cs`, while the repository contains `Common_Safe.cs`.

Paths: `StandFacile/src/dBaseTunnel_my.cs`, `Common_Safe.cs`, `StandCommonSrc/Common_CL.cs`.

#### Inter-application operations and monitoring
Orders appear to flow from the primary client through shared database/network facilities to specialized order, kitchen, and monitoring clients. Monitoring/order views are explicit application responsibilities, while UDP support provides an additional local-network communication mechanism.

Paths: `StandOrdini/src/MainForm.cs`, `StandCucina/src/MainForm.cs`, `StandMonitor/src/VisOrdiniTableFrm.cs`, `StandCommonSrc/UDP_service.cs`, `StandCommonSrc/LogServer.cs`.

#### Output devices and operational configuration
Receipt/copy generation is shared and dispatched to Windows, Epson POS, or legacy printer implementations. Configuration dialogs expose network, printer, and general settings; the deployment also requires `Listino.txt` beside the executable, and setup scripts package each suite program.

Paths: `StandCommonSrc/ReceiptAndCopiesCommons.cs`, `StandCommonSrc/Printer_Windows.cs`, `StandCommonSrc/Printer_Epson_POS.cs`, `config.ini`, `StandFacile/Setup/StandFacile.iss`.

#### Runtime and dependencies
The repository is a Visual Studio/.NET Framework-era C# solution using WinForms and NuGet packages. Material persistence dependencies include SQLite; remote backends are MySQL and PostgreSQL connector-based and user-installed. The README warns that updating the SQLite dotConnect Express package can introduce a license failure.

Paths: `StandFacile/src/packages.config`, `StandFacile/src/App.config`, `packages/SQLite.3.13.0`, `packages/Newtonsoft.Json.13.0.4`.

Main entry points: [`StandCommonSrc/dBaseIntf.cs`](https://github.com/standfacilerep/standfacile/blob/master/StandCommonSrc/dBaseIntf.cs) (Database abstraction), [`StandFacile.sln`](https://github.com/standfacilerep/standfacile/blob/master/StandFacile.sln) (StandFacile solution), [`StandFacile/src/StandFacile.csproj`](https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/StandFacile.csproj) (Primary POS client), [`StandFacile/src/MainForm.cs`](https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/MainForm.cs) (POS MainForm)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_apps["WinForms clients"]
  node_pos_project["Primary POS client<br/>WinForms executable<br/>[StandFacile.csproj]"]
  node_pos_entry["POS startup<br/>Program entry<br/>[Program.cs]"]
  node_pos_main["POS MainForm<br/>WinForms UI<br/>[MainForm.cs]"]
  node_kitchen_project["Kitchen client<br/>WinForms executable<br/>[StandCucina.csproj]"]
  node_kitchen_entry["Kitchen startup<br/>Program entry<br/>[Program.cs]"]
  node_kitchen_ui["Kitchen MainForm<br/>WinForms UI<br/>[MainForm.cs]"]
  node_monitor_project["Monitoring client<br/>WinForms executable"]
  node_monitor_ui["Monitor order view<br/>WinForms UI"]
  node_orders_project["Order client<br/>WinForms executable<br/>[StandOrdini.csproj]"]
  node_orders_ui["Orders MainForm<br/>WinForms UI<br/>[MainForm.cs]"]
end

subgraph group_data["Data and connectivity"]
  node_data_manager["DataManager<br/>POS data layer<br/>[DataManager.cs]"]
  node_pos_model["SF_Data model<br/>domain data<br/>[Define.cs]"]
  node_db_interface{{"Database abstraction<br/>DB_Data interface<br/>[dBaseIntf.cs]"}}
  node_db_backends[("SQLite, MySQL, PostgreSQL<br/>database backends<br/>[dBaseIntf_ql.cs]")]
  node_mysql_tunnel["MySQL HTTP tunnel<br/>remote tunnel<br/>[dBaseTunnel_my.cs]"]
  node_safe_settings["Safe credentials<br/>secret settings<br/>[Common_Safe.cs]"]
  node_udp_log["UDP and logging<br/>local operations<br/>[UDP_service.cs]"]
end

subgraph group_operations["Operations support"]
  node_printing["Receipt printing<br/>output dispatch"]
  node_runtime_config["Runtime configuration<br/>application config<br/>[config.ini]"]
  node_installer["POS installer<br/>Inno Setup script<br/>[StandFacile.iss]"]
end

node_solution["StandFacile solution<br/>Visual Studio solution<br/>[StandFacile.sln]"]

node_solution -->|"builds"| node_pos_project
node_solution -->|"builds"| node_kitchen_project
node_solution -->|"builds"| node_monitor_project
node_solution -->|"builds"| node_orders_project
node_pos_project -->|"starts"| node_pos_entry
node_pos_entry -->|"opens"| node_pos_main
node_kitchen_project -->|"starts"| node_kitchen_entry
node_kitchen_entry -->|"opens"| node_kitchen_ui
node_pos_main -->|"manages data through"| node_data_manager
node_data_manager -->|"operates on"| node_pos_model
node_data_manager -->|"persists through"| node_db_interface
node_db_interface -->|"selects"| node_db_backends
node_db_backends -->|"remote MySQL via"| node_mysql_tunnel
node_mysql_tunnel -.->|"uses key and endpoint"| node_safe_settings
node_orders_ui -->|"reads and writes orders"| node_db_interface
node_kitchen_ui -->|"consumes orders"| node_db_interface
node_monitor_ui -->|"monitors orders"| node_db_interface
node_orders_ui -.->|"local notifications"| node_udp_log
node_pos_main -->|"prints receipts"| node_printing
node_pos_project -.->|"loads"| node_runtime_config
node_installer -->|"packages"| node_pos_project

click node_solution "https://github.com/standfacilerep/standfacile/blob/master/StandFacile.sln"
click node_pos_project "https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/StandFacile.csproj"
click node_pos_entry "https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/Program.cs"
click node_pos_main "https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/MainForm.cs"
click node_kitchen_project "https://github.com/standfacilerep/standfacile/blob/master/StandCucina/src/StandCucina.csproj"
click node_kitchen_entry "https://github.com/standfacilerep/standfacile/blob/master/StandCucina/src/Program.cs"
click node_kitchen_ui "https://github.com/standfacilerep/standfacile/blob/master/StandCucina/src/MainForm.cs"
click node_monitor_project "https://github.com/standfacilerep/standfacile/blob/master/StandMonitor/src/StandMonitor.csproj"
click node_monitor_ui "https://github.com/standfacilerep/standfacile/blob/master/StandMonitor/src/VisOrdiniTableFrm.cs"
click node_orders_project "https://github.com/standfacilerep/standfacile/blob/master/StandOrdini/src/StandOrdini.csproj"
click node_orders_ui "https://github.com/standfacilerep/standfacile/blob/master/StandOrdini/src/MainForm.cs"
click node_data_manager "https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/DataManager.cs"
click node_pos_model "https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/Define.cs"
click node_db_interface "https://github.com/standfacilerep/standfacile/blob/master/StandCommonSrc/dBaseIntf.cs"
click node_db_backends "https://github.com/standfacilerep/standfacile/blob/master/StandCommonSrc/dBaseIntf_ql.cs"
click node_mysql_tunnel "https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/dBaseTunnel_my.cs"
click node_safe_settings "https://github.com/standfacilerep/standfacile/blob/master/Common_Safe.cs"
click node_udp_log "https://github.com/standfacilerep/standfacile/blob/master/StandCommonSrc/UDP_service.cs"
click node_printing "https://github.com/standfacilerep/standfacile/blob/master/StandCommonSrc/ReceiptAndCopiesCommons.cs"
click node_runtime_config "https://github.com/standfacilerep/standfacile/blob/master/config.ini"
click node_installer "https://github.com/standfacilerep/standfacile/blob/master/StandFacile/Setup/StandFacile.iss"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pos_project,node_pos_entry,node_pos_main,node_kitchen_project,node_kitchen_entry,node_kitchen_ui,node_monitor_project,node_monitor_ui,node_orders_project,node_orders_ui toneBlue
class node_data_manager,node_pos_model,node_db_interface,node_db_backends,node_mysql_tunnel,node_safe_settings,node_udp_log toneAmber
class node_printing,node_runtime_config,node_installer toneMint
class node_solution toneNeutral
```

## Components

### WinForms clients

Four desktop executables for POS operations.

- [Primary POS client](https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/StandFacile.csproj): WinForms executable · `StandFacile/src/StandFacile.csproj`
- [POS startup](https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/Program.cs): Program entry · `StandFacile/src/Program.cs`
- [POS MainForm](https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/MainForm.cs): WinForms UI · Owns primary user-driven POS flow. · `StandFacile/src/MainForm.cs`
- [Kitchen client](https://github.com/standfacilerep/standfacile/blob/master/StandCucina/src/StandCucina.csproj): WinForms executable · `StandCucina/src/StandCucina.csproj`
- [Kitchen startup](https://github.com/standfacilerep/standfacile/blob/master/StandCucina/src/Program.cs): Program entry · `StandCucina/src/Program.cs`
- [Kitchen MainForm](https://github.com/standfacilerep/standfacile/blob/master/StandCucina/src/MainForm.cs): WinForms UI · `StandCucina/src/MainForm.cs`
- [Monitoring client](https://github.com/standfacilerep/standfacile/blob/master/StandMonitor/src/StandMonitor.csproj): WinForms executable · `StandMonitor/src/StandMonitor.csproj`
- [Monitor order view](https://github.com/standfacilerep/standfacile/blob/master/StandMonitor/src/VisOrdiniTableFrm.cs): WinForms UI · `StandMonitor/src/VisOrdiniTableFrm.cs`
- [Order client](https://github.com/standfacilerep/standfacile/blob/master/StandOrdini/src/StandOrdini.csproj): WinForms executable · `StandOrdini/src/StandOrdini.csproj`
- [Orders MainForm](https://github.com/standfacilerep/standfacile/blob/master/StandOrdini/src/MainForm.cs): WinForms UI · `StandOrdini/src/MainForm.cs`

### Data and connectivity

Shared persistence, remote access, and local communication.

- [DataManager](https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/DataManager.cs): POS data layer · Manages SF_Data and price-list load/save. · `StandFacile/src/DataManager.cs`
- [SF_Data model](https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/Define.cs): domain data · `StandFacile/src/Define.cs`
- [Database abstraction](https://github.com/standfacilerep/standfacile/blob/master/StandCommonSrc/dBaseIntf.cs): DB_Data interface · Callers use common database operations instead of concrete backends. · `StandCommonSrc/dBaseIntf.cs`
- [SQLite, MySQL, PostgreSQL](https://github.com/standfacilerep/standfacile/blob/master/StandCommonSrc/dBaseIntf_ql.cs): database backends · Concrete local and remote load/save, order, and monitoring implementations. · `StandCommonSrc/dBaseIntf_ql.cs`
- [MySQL HTTP tunnel](https://github.com/standfacilerep/standfacile/blob/master/StandFacile/src/dBaseTunnel_my.cs): remote tunnel · Connects to the externally hosted web database through a PHP endpoint. · `StandFacile/src/dBaseTunnel_my.cs`
- [Safe credentials](https://github.com/standfacilerep/standfacile/blob/master/Common_Safe.cs): secret settings · Supplies tunnel cipher key and web-server address. · `Common_Safe.cs`
- [UDP and logging](https://github.com/standfacilerep/standfacile/blob/master/StandCommonSrc/UDP_service.cs): local operations · Provides local-network messaging and log-server support. · `StandCommonSrc/UDP_service.cs`

### Operations support

Output, configuration, and deployment concerns.

- [Receipt printing](https://github.com/standfacilerep/standfacile/blob/master/StandCommonSrc/ReceiptAndCopiesCommons.cs): output dispatch · Routes receipts and copies to Windows, Epson POS, or legacy printers. · `StandCommonSrc/ReceiptAndCopiesCommons.cs`
- [Runtime configuration](https://github.com/standfacilerep/standfacile/blob/master/config.ini): application config · Configuration dialogs and deployment require settings plus Listino.txt. · `config.ini`
- [POS installer](https://github.com/standfacilerep/standfacile/blob/master/StandFacile/Setup/StandFacile.iss): Inno Setup script · `StandFacile/Setup/StandFacile.iss`

### Other components

- [StandFacile solution](https://github.com/standfacilerep/standfacile/blob/master/StandFacile.sln): Visual Studio solution · `StandFacile.sln`

## Connections

- StandFacile solution → Primary POS client: builds
- StandFacile solution → Kitchen client: builds
- StandFacile solution → Monitoring client: builds
- StandFacile solution → Order client: builds
- Primary POS client → POS startup: starts
- POS startup → POS MainForm: opens
- Kitchen client → Kitchen startup: starts
- Kitchen startup → Kitchen MainForm: opens
- POS MainForm → DataManager: manages data through
- DataManager → SF_Data model: operates on
- DataManager → Database abstraction: persists through
- Database abstraction → SQLite, MySQL, PostgreSQL: selects
- SQLite, MySQL, PostgreSQL → MySQL HTTP tunnel: remote MySQL via
- MySQL HTTP tunnel → Safe credentials: uses key and endpoint
- Orders MainForm → Database abstraction: reads and writes orders
- Kitchen MainForm → Database abstraction: consumes orders
- Monitor order view → Database abstraction: monitors orders
- Orders MainForm → UDP and logging: local notifications
- POS MainForm → Receipt printing: prints receipts
- Primary POS client → Runtime configuration: loads
- POS installer → Primary POS client: packages
