# igorkolcha/ktcm architecture

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

- Interactive diagram: https://gitdiagram.com/igorkolcha/ktcm
- Repository: https://github.com/igorkolcha/ktcm

## Overview

1. **Overall shape**
   - This is a **single-user Windows desktop application** built with **C# WinForms on .NET 10 (net10.0-windows)**.
   - The repository contains one application project (`KTCM`) and no separate backend, service, or client/server split.

2. **Primary business purpose**
   - The app is an **electronic work journal** for the KTCM maintenance workflow at railway stations.
   - It tracks: work start/end times, performers, and the type of equipment being serviced, and it can generate **Excel reports**.

3. **UI layer**
   - `Form1.cs` / `Form1.Designer.cs` / `Form1.resx` form the main user interface.
   - This is likely the central screen where users enter journal records, browse existing entries in a grid, and trigger export/report actions.
   - Because it is WinForms, the UI and interaction logic are tightly coupled to the form event handlers.

4. **Local data persistence**
   - `ConnectionDataBase.cs` indicates a dedicated database-access component rather than inline SQL scattered throughout the UI.
   - The compiled output includes a local database file named `ктсм.db`, which strongly suggests the app uses a **local embedded database** for storage.
   - The architecture therefore centers on **UI → data-access helper → local database**.

5. **Report/export subsystem**
   - `DataGridToExcel.cs` is a separate utility for exporting tabular data to Excel.
   - The app likely uses the on-screen grid as the source of truth for reports or exports, transforming displayed records into spreadsheet output.
   - This is the main non-persistence integration boundary in the app.

6. **Data flow**
   - Typical flow is: user enters or edits maintenance journal data in the form, the form calls the database helper to save/read records, the grid is refreshed from stored data, and the export helper generates an Excel report from that dataset.
   - The app is therefore **stateful around local data**, not stateless request/response.

7. **Project and build structure**
   - `KTCM.csproj` defines a WinForms application targeting Windows only.
   - The presence of `bin/Debug/net10.0-windows` and `obj/...` artifacts confirms a standard .NET desktop build pipeline.
   - The `.slnx` solution file indicates a modern Visual Studio solution format.

8. **Runtime and deployment boundary**
   - The executable (`KTCM.exe`) and runtime config files are produced locally; there is no evidence of containerization or cloud deployment.
   - The app appears intended to run directly on operator workstations in a Windows environment.

9. **Assets and localization**
   - `Properties/Resources.resx` and `Resources.Designer.cs` indicate resource-backed UI assets/strings.
   - This usually supports icons, images, or localized text used by the WinForms interface.

10. **What is not present**
   - There are no signs of web hosting, APIs, background workers, messaging, or multi-user synchronization.
   - There is also no separate persistence server: the architecture is centered on a **desktop UI + local database + export utility**.

11. **How to diagram it**
   - A good architecture diagram would show one **WinForms desktop application** box containing:
     - Main form/UI
     - Database access component
     - Excel export component
   - Outside the app boundary, show:
     - A **local SQLite-like database file** (`ктсм.db`)
     - An **Excel file output/report destination**
   - The key interaction arrows are from UI to database for CRUD and from UI/grid data to Excel export.

Main entry points: [`KTCM/KTCM/KTCM.csproj`](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/KTCM.csproj) (KTCM), [`KTCM/KTCM/Form1.cs`](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Form1.cs) (Main form), [`KTCM/KTCM/ConnectionDataBase.cs`](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/ConnectionDataBase.cs) (DB helper), [`KTCM/KTCM/DataGridToExcel.cs`](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/DataGridToExcel.cs) (Excel export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop app"]
  node_solution["Solution<br/>slnx<br/>[KTCM.slnx]"]
  node_project["KTCM<br/>WinForms project<br/>[KTCM.csproj]"]
  node_program["Program<br/>entrypoint<br/>[Program.cs]"]
  node_form["Main form<br/>WinForms UI<br/>[Form1.cs]"]
  node_formdesigner["Form layout<br/>WinForms designer<br/>[Form1.Designer.cs]"]
  node_formresx["Form resources<br/>UI resources<br/>[Form1.resx]"]
  node_dbhelper["DB helper<br/>data access"]
  node_excelhelper["Excel export<br/>reporting<br/>[DataGridToExcel.cs]"]
  node_appresx["App resources<br/>resource set<br/>[Resources.resx]"]
  node_appresgen["Resource code<br/>resource wrapper"]
end

subgraph group_storage["Local storage"]
  node_database[("ктсм.db<br/>embedded database<br/>[ктсм.db]")]
end

subgraph group_reports["Report output"]
  node_excelout["Excel report<br/>xlsx output"]
end

node_solution -->|"contains"| node_project
node_project -->|"starts"| node_program
node_program -->|"opens"| node_form
node_project -->|"includes"| node_formdesigner
node_project -->|"includes"| node_formresx
node_project -->|"includes"| node_dbhelper
node_project -->|"includes"| node_excelhelper
node_project -->|"includes"| node_appresx
node_project -->|"includes"| node_appresgen
node_form -->|"reads/writes"| node_dbhelper
node_form -->|"exports"| node_excelhelper
node_form -->|"uses"| node_formdesigner
node_form -->|"uses"| node_formresx
node_dbhelper -->|"stores data"| node_database
node_excelhelper -->|"creates"| node_excelout
node_appresgen -->|"generates from"| node_appresx

click node_solution "https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM.slnx"
click node_project "https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/KTCM.csproj"
click node_program "https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Program.cs"
click node_form "https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Form1.cs"
click node_formdesigner "https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Form1.Designer.cs"
click node_formresx "https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Form1.resx"
click node_dbhelper "https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/ConnectionDataBase.cs"
click node_excelhelper "https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/DataGridToExcel.cs"
click node_appresx "https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Properties/Resources.resx"
click node_appresgen "https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Properties/Resources.Designer.cs"
click node_database "https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/bin/Debug/net10.0-windows/ктсм.db"

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_solution,node_project,node_program,node_form,node_formdesigner,node_formresx,node_dbhelper,node_excelhelper,node_appresx,node_appresgen toneBlue
class node_database toneAmber
class node_excelout toneMint
```

## Components

### Desktop app

Single WinForms application for maintenance journal entry and reporting

- [Solution](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM.slnx): slnx · Visual Studio solution container · `KTCM/KTCM.slnx`
- [KTCM](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/KTCM.csproj): WinForms project · .NET 10 Windows desktop application project · `KTCM/KTCM/KTCM.csproj`
- [Program](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Program.cs): entrypoint · Application startup and form launch · `KTCM/KTCM/Program.cs`
- [Main form](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Form1.cs): WinForms UI · Primary journal screen and event-driven interaction layer · `KTCM/KTCM/Form1.cs`
- [Form layout](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Form1.Designer.cs): WinForms designer · Generated control layout for the main form · `KTCM/KTCM/Form1.Designer.cs`
- [Form resources](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Form1.resx): UI resources · Localized or embedded resources for the main form · `KTCM/KTCM/Form1.resx`
- [DB helper](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/ConnectionDataBase.cs): data access · Encapsulated local database access used by the form · `KTCM/KTCM/ConnectionDataBase.cs`
- [Excel export](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/DataGridToExcel.cs): reporting · Transforms grid data into spreadsheet output · `KTCM/KTCM/DataGridToExcel.cs`
- [App resources](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Properties/Resources.resx): resource set · Shared application assets and strings · `KTCM/KTCM/Properties/Resources.resx`
- [Resource code](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/Properties/Resources.Designer.cs): resource wrapper · Strongly typed access to shared resources · `KTCM/KTCM/Properties/Resources.Designer.cs`

### Local storage

Embedded local database used by the desktop app

- [ктсм.db](https://github.com/igorkolcha/ktcm/blob/main/KTCM/KTCM/bin/Debug/net10.0-windows/ктсм.db): embedded database · Local persistent store bundled with the application · `KTCM/KTCM/bin/Debug/net10.0-windows/ктсм.db`

### Report output

Spreadsheet export destination for generated reports

- **Excel report**: xlsx output · Generated report file produced from journal data

## Connections

- Solution → KTCM: contains · Solution organizes the application project
- KTCM → Program: starts · Project entry point launches the app
- Program → Main form: opens · Startup loads the main WinForms screen
- KTCM → Form layout: includes · Designer-generated layout is part of the form
- KTCM → Form resources: includes · Form-specific resources are compiled with the UI
- KTCM → DB helper: includes · Database access helper is compiled into the app
- KTCM → Excel export: includes · Excel export helper is compiled into the app
- KTCM → App resources: includes · Shared resource set is part of the application
- KTCM → Resource code: includes · Generated resource wrapper is part of the application
- Main form → DB helper: reads/writes · Main UI persists and loads journal entries through the helper
- Main form → Excel export: exports · Main UI triggers spreadsheet generation
- Main form → Form layout: uses · Form logic is coupled to its generated controls
- Main form → Form resources: uses · Form relies on its local resources
- DB helper → ктсм.db: stores data · Database helper talks to the embedded local database
- Excel export → Excel report: creates · Export helper produces Excel report output
- Resource code → App resources: generates from · Designer wrapper is generated from the resource file
