# caspergamingone/smart-factory-management-system architecture

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

- Interactive diagram: https://gitdiagram.com/caspergamingone/smart-factory-management-system
- Repository: https://github.com/caspergamingone/smart-factory-management-system

## Overview

#### Purpose and Shape
Smart Factory Management System is an early-stage .NET solution for managing factory operations through a terminal UI. It separates a reusable domain library from a console-oriented UI application. The solution root is `Smart-Factory-Management-System.slnx`; project boundaries are `Core/Core.csproj` and `UI/UI.csproj`.

#### Runtime Entry and Session Flow
`UI/Program.cs` is the application entry point. It initializes the interactive application flow, with authentication handled by `UI/LoginHandler.cs`, then routes users into menu-driven operations. `UI/TUIHelpers.cs` provides terminal-display/input support across the UI boundary.

#### Domain Aggregate: Factory
`Core/Factory.cs` is the central in-memory business model and likely ownership boundary for operational entities. It coordinates factory-level state and relationships among employees, machines, products, and production work. The project currently shows no persistence, API, or database layer; state is expected to live in process.

#### Workforce and Equipment Management
Employee and machine capabilities are modeled separately:
- `Core/Employee.cs` represents workforce records.
- `Core/Machine.cs` represents production equipment.
- `Core/MachinePart.cs` models machine-component/maintenance-related data.

UI workflows for these areas are isolated in `UI/EmployeeMenuHandler.cs` and `UI/MachineMenuHandler.cs`, keeping terminal interaction outside the domain objects.

#### Product and Production Pipeline
Production data flows from product definition into scheduled work:
- `Core/Product.cs` defines manufactured goods.
- `Core/ProductionOrder.cs` represents requested/planned production.
- `Core/ProductionBatch.cs` represents batch-level execution or tracking.

`UI/ProductMenuHandler.cs` manages product-facing commands, while `UI/ProductionMenuHandler.cs` drives production-order and batch interactions. These handlers should invoke domain operations rather than duplicate business rules.

#### Feature Routing and Reporting
`UI/MenuOptions.cs` defines available navigation/options, and feature handlers partition operational concerns: accounting (`UI/AccountingMenuHandler.cs`), sales (`UI/SalesMenuHandler.cs`), factory reporting (`UI/FactoryReportMenuHandler.cs`), and general reports (`UI/ReportMenuHandler.cs`). This is a command/menu-controller layer rather than a web or service interface.

#### Delivery and Documentation Infrastructure
The runtime targets the .NET SDK version pinned by `global.json`. GitHub Actions publish an executable and GitHub Pages documentation via `.github/workflows/publish-executable.yml` and `.github/workflows/github-pages-docs.yml`. Documentation is generated from repository structure by `scripts/generate_repo_map.py`, producing `docs/PROJECT_OVERVIEW.md` and the Pages-facing `index.html`; it is documentation infrastructure, not application runtime behavior.

Main entry points: [`Core/Factory.cs`](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/Factory.cs) (Factory), [`UI/MenuOptions.cs`](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/MenuOptions.cs) (Menu Routing), [`UI/Program.cs`](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/Program.cs) (Application Entry), [`Core/ProductionOrder.cs`](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/ProductionOrder.cs) (Production Order)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Terminal UI"]
  node_program(("Application Entry<br/>.NET console entry<br/>[Program.cs]"))
  node_login["Authentication<br/>login handler<br/>[LoginHandler.cs]"]
  node_navigation["Menu Routing<br/>menu options<br/>[MenuOptions.cs]"]
  node_terminal_helpers["Terminal Helpers<br/>TUI support<br/>[TUIHelpers.cs]"]
  node_workforce_ui["Workforce Commands<br/>employee menu handler"]
  node_equipment_ui["Equipment Commands<br/>machine menu handler"]
  node_product_ui["Product Commands<br/>product menu handler"]
  node_production_ui["Production Commands<br/>production menu handler"]
  node_business_ui["Business & Reports<br/>feature handlers"]
end

subgraph group_domain["Core Domain"]
  node_factory{{"Factory<br/>domain aggregate<br/>[Factory.cs]"}}
  node_employee["Employee<br/>workforce entity<br/>[Employee.cs]"]
  node_machine["Machine<br/>equipment entity<br/>[Machine.cs]"]
  node_machine_part["Machine Part<br/>maintenance entity<br/>[MachinePart.cs]"]
  node_product["Product<br/>[Product.cs]"]
  node_production_order["Production Order<br/>planned work<br/>[ProductionOrder.cs]"]
  node_production_batch["Production Batch<br/>batch tracking<br/>[ProductionBatch.cs]"]
end

subgraph group_delivery["Delivery & Docs"]
  node_sdk[".NET SDK Pin<br/>runtime toolchain<br/>[global.json]"]
  node_executable_publish["Executable Publish<br/>GitHub Actions workflow"]
  node_docs_generator["Repository Map Generator<br/>documentation script"]
  node_pages_publish["Pages Documentation<br/>GitHub Actions workflow"]
  node_project_overview["Project Overview<br/>generated documentation"]
  node_pages_index["Pages Index<br/>generated site<br/>[index.html]"]
end

node_program -->|"authenticates session"| node_login
node_program -->|"routes commands"| node_navigation
node_program -->|"uses"| node_terminal_helpers
node_navigation -->|"selects"| node_workforce_ui
node_navigation -->|"selects"| node_equipment_ui
node_navigation -->|"selects"| node_product_ui
node_navigation -->|"selects"| node_production_ui
node_navigation -->|"selects"| node_business_ui
node_workforce_ui -->|"operates on"| node_factory
node_equipment_ui -->|"operates on"| node_factory
node_product_ui -->|"operates on"| node_factory
node_production_ui -->|"operates on"| node_factory
node_business_ui -->|"reads operations"| node_factory
node_factory -->|"manages"| node_employee
node_factory -->|"manages"| node_machine
node_factory -->|"manages"| node_product
node_factory -->|"coordinates"| node_production_order
node_machine -->|"contains"| node_machine_part
node_product -->|"is requested by"| node_production_order
node_production_order -->|"creates or tracks"| node_production_batch
node_sdk -.->|"pins build SDK"| node_executable_publish
node_executable_publish -.->|"publishes executable"| node_program
node_docs_generator -->|"generates"| node_project_overview
node_docs_generator -->|"generates"| node_pages_index
node_pages_publish -.->|"publishes"| node_pages_index

click node_program "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/Program.cs"
click node_login "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/LoginHandler.cs"
click node_navigation "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/MenuOptions.cs"
click node_terminal_helpers "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/TUIHelpers.cs"
click node_workforce_ui "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/EmployeeMenuHandler.cs"
click node_equipment_ui "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/MachineMenuHandler.cs"
click node_product_ui "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/ProductMenuHandler.cs"
click node_production_ui "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/ProductionMenuHandler.cs"
click node_factory "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/Factory.cs"
click node_employee "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/Employee.cs"
click node_machine "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/Machine.cs"
click node_machine_part "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/MachinePart.cs"
click node_product "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/Product.cs"
click node_production_order "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/ProductionOrder.cs"
click node_production_batch "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/ProductionBatch.cs"
click node_sdk "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/global.json"
click node_executable_publish "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/.github/workflows/publish-executable.yml"
click node_docs_generator "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/scripts/generate_repo_map.py"
click node_pages_publish "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/.github/workflows/github-pages-docs.yml"
click node_project_overview "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/docs/PROJECT_OVERVIEW.md"
click node_pages_index "https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/index.html"

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_program,node_login,node_navigation,node_terminal_helpers,node_workforce_ui,node_equipment_ui,node_product_ui,node_production_ui,node_business_ui toneBlue
class node_factory,node_employee,node_machine,node_machine_part,node_product,node_production_order,node_production_batch toneAmber
class node_sdk,node_executable_publish,node_docs_generator,node_pages_publish,node_project_overview,node_pages_index toneMint
```

## Components

### Terminal UI

Console interaction and feature routing.

- [Application Entry](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/Program.cs): .NET console entry · `UI/Program.cs`
- [Authentication](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/LoginHandler.cs): login handler · `UI/LoginHandler.cs`
- [Menu Routing](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/MenuOptions.cs): menu options · `UI/MenuOptions.cs`
- [Terminal Helpers](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/TUIHelpers.cs): TUI support · `UI/TUIHelpers.cs`
- [Workforce Commands](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/EmployeeMenuHandler.cs): employee menu handler · `UI/EmployeeMenuHandler.cs`
- [Equipment Commands](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/MachineMenuHandler.cs): machine menu handler · `UI/MachineMenuHandler.cs`
- [Product Commands](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/ProductMenuHandler.cs): product menu handler · `UI/ProductMenuHandler.cs`
- [Production Commands](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/UI/ProductionMenuHandler.cs): production menu handler · `UI/ProductionMenuHandler.cs`
- **Business & Reports**: feature handlers · Accounting, sales, factory reports, and general reports.

### Core Domain

In-memory factory operations model.

- [Factory](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/Factory.cs): domain aggregate · Owns in-memory operational state and relationships. · `Core/Factory.cs`
- [Employee](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/Employee.cs): workforce entity · `Core/Employee.cs`
- [Machine](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/Machine.cs): equipment entity · `Core/Machine.cs`
- [Machine Part](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/MachinePart.cs): maintenance entity · `Core/MachinePart.cs`
- [Product](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/Product.cs): product entity · `Core/Product.cs`
- [Production Order](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/ProductionOrder.cs): planned work · `Core/ProductionOrder.cs`
- [Production Batch](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/Core/ProductionBatch.cs): batch tracking · `Core/ProductionBatch.cs`

### Delivery & Docs

Build publishing and generated documentation.

- [.NET SDK Pin](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/global.json): runtime toolchain · `global.json`
- [Executable Publish](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/.github/workflows/publish-executable.yml): GitHub Actions workflow · `.github/workflows/publish-executable.yml`
- [Repository Map Generator](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/scripts/generate_repo_map.py): documentation script · `scripts/generate_repo_map.py`
- [Pages Documentation](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/.github/workflows/github-pages-docs.yml): GitHub Actions workflow · `.github/workflows/github-pages-docs.yml`
- [Project Overview](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/docs/PROJECT_OVERVIEW.md): generated documentation · `docs/PROJECT_OVERVIEW.md`
- [Pages Index](https://github.com/caspergamingone/smart-factory-management-system/blob/new-tui-frontend/index.html): generated site · `index.html`

## Connections

- Application Entry → Authentication: authenticates session
- Application Entry → Menu Routing: routes commands
- Application Entry → Terminal Helpers: uses
- Menu Routing → Workforce Commands: selects
- Menu Routing → Equipment Commands: selects
- Menu Routing → Product Commands: selects
- Menu Routing → Production Commands: selects
- Menu Routing → Business & Reports: selects
- Workforce Commands → Factory: operates on
- Equipment Commands → Factory: operates on
- Product Commands → Factory: operates on
- Production Commands → Factory: operates on
- Business & Reports → Factory: reads operations
- Factory → Employee: manages
- Factory → Machine: manages
- Factory → Product: manages
- Factory → Production Order: coordinates
- Machine → Machine Part: contains
- Product → Production Order: is requested by
- Production Order → Production Batch: creates or tracks
- .NET SDK Pin → Executable Publish: pins build SDK
- Executable Publish → Application Entry: publishes executable
- Repository Map Generator → Project Overview: generates
- Repository Map Generator → Pages Index: generates
- Pages Documentation → Pages Index: publishes
