# d4m13n-d3v/mechanicbuddy architecture

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

- Interactive diagram: https://gitdiagram.com/d4m13n-d3v/mechanicbuddy
- Repository: https://github.com/d4m13n-d3v/mechanicbuddy

## Overview

MechanicBuddy is workshop-management software with a customer-facing web app and a separate SaaS control plane. The shop workflow runs from authenticated staff using the web UI, through the backend API, to managing clients, vehicles, work orders, inventory, and pricing; estimates and invoices can be rendered as PDFs and emailed. The management portal handles tenant operations such as provisioning and billing. The README documents the major capabilities and deployment modes; source excerpts confirm selected API, domain, and tenant-service relationships, but most feature-controller wiring was not sampled.

Main entry points: [`backend/src/MechanicBuddy.Http.Api/Program.cs`](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Http.Api/Program.cs) (Workshop API), [`backend/src/MechanicBuddy.Management.Api/Program.cs`](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Program.cs) (Management API), [`backend/src/MechanicBuddy.Management.Api/Services/TenantService.cs`](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Services/TenantService.cs) (Tenant operations), [`backend/src/MechanicBuddy.Core.Domain`](https://github.com/d4m13n-d3v/mechanicbuddy/tree/main/backend/src/MechanicBuddy.Core.Domain) (Domain model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shop_ui["Workshop web app"]
  node_web_app["Shop web UI"]
  node_web_api["Web API client<br/>[query-api.ts]"]
end

subgraph group_shop_backend["Workshop backend"]
  node_api["Workshop API<br/>[Program.cs]"]
  node_auth["Authentication<br/>[Authorization]"]
  node_clients["Clients and vehicles<br/>[Client.cs]"]
  node_work["Work orders<br/>[Work.cs]"]
  node_inventory["Parts and inventory<br/>[Storage.cs]"]
  node_pricing["Estimates and invoices<br/>[Pricing.cs]"]
  node_printing["PDF and email<br/>[PdfGenerator.cs]"]
  node_domain["Domain model"]
end

subgraph group_shop_data["Workshop persistence"]
  node_repositories["Repositories"]
  node_tenant_db[("Tenant databases")]
end

subgraph group_control_plane["SaaS control plane"]
  node_management_api["Management API<br/>[Program.cs]"]
  node_tenant_service["Tenant operations<br/>[TenantService.cs]"]
  node_tenant_store[("Tenant records")]
  node_provisioning["Tenant provisioning"]
  node_billing["Billing<br/>[BillingService.cs]"]
  node_analytics["Platform analytics"]
  node_deployment["Deployment services"]
end

subgraph group_management_ui["Management portal"]
  node_portal["Management portal"]
end

node_staff(("Shop staff"))
node_operator(("SaaS operators"))
node_external_services["Cloud infrastructure"]
node_mail["SMTP mail"]

node_staff -->|"uses"| node_web_app
node_web_app -.->|"requests data"| node_web_api
node_web_api -->|"calls API"| node_api
node_api -.->|"authorizes"| node_auth
node_api -.->|"manages"| node_clients
node_api -.->|"manages"| node_work
node_api -->|"manages"| node_inventory
node_api -.->|"manages"| node_pricing
node_api -->|"uses"| node_repositories
node_api -->|"queries"| node_tenant_db
node_repositories -->|"persists"| node_tenant_db
node_clients -.->|"models"| node_domain
node_work -.->|"models"| node_domain
node_inventory -->|"models"| node_domain
node_pricing -->|"generates documents"| node_printing
node_printing -->|"emails PDFs"| node_mail
node_operator -.->|"uses"| node_portal
node_portal -.->|"calls API"| node_management_api
node_management_api -->|"routes tenant operations"| node_tenant_service
node_tenant_service -->|"reads and writes"| node_tenant_store
node_tenant_service -->|"provisions tenants"| node_provisioning
node_tenant_service -->|"manages deployments"| node_deployment
node_management_api -->|"supports billing"| node_billing
node_management_api -->|"supports analytics"| node_analytics
node_deployment -->|"deploys infrastructure"| node_external_services

click node_web_app "https://github.com/d4m13n-d3v/mechanicbuddy/tree/main/frontend/src/app/home"
click node_web_api "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/frontend/src/_lib/server/query-api.ts"
click node_api "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Http.Api/Program.cs"
click node_auth "https://github.com/d4m13n-d3v/mechanicbuddy/tree/main/backend/src/MechanicBuddy.Core.Application/Authorization"
click node_clients "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Domain/Clients/Client.cs"
click node_work "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Domain/Work/Work.cs"
click node_inventory "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Domain/Storage.cs"
click node_pricing "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Domain/Pricings/Pricing.cs"
click node_printing "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Application/Services/PdfGenerator.cs"
click node_domain "https://github.com/d4m13n-d3v/mechanicbuddy/tree/main/backend/src/MechanicBuddy.Core.Domain"
click node_repositories "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Persistence.Postgres/GenericRepository.cs"
click node_tenant_db "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Persistence.Postgres/NHibernate/MultiTenancyConnectionDriver.cs"
click node_portal "https://github.com/d4m13n-d3v/mechanicbuddy/tree/main/management-portal/src/app/dashboard"
click node_management_api "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Program.cs"
click node_tenant_service "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Services/TenantService.cs"
click node_tenant_store "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Repositories/TenantRepository.cs"
click node_provisioning "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Services/TenantProvisioningService.cs"
click node_billing "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Services/BillingService.cs"
click node_analytics "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Services/AnalyticsService.cs"
click node_deployment "https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Infrastructure/KubernetesClient.cs"

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_web_app,node_web_api toneBlue
class node_api,node_auth,node_clients,node_work,node_inventory,node_pricing,node_printing,node_domain toneAmber
class node_repositories,node_tenant_db toneMint
class node_management_api,node_tenant_service,node_tenant_store,node_provisioning,node_billing,node_analytics,node_deployment toneRose
class node_portal,node_staff,node_operator,node_external_services,node_mail toneIndigo
```

## Components

### Workshop web app

- [Shop web UI](https://github.com/d4m13n-d3v/mechanicbuddy/tree/main/frontend/src/app/home): `frontend/src/app/home`
- [Web API client](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/frontend/src/_lib/server/query-api.ts): `frontend/src/_lib/server/query-api.ts`

### Workshop backend

- [Workshop API](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Http.Api/Program.cs): `backend/src/MechanicBuddy.Http.Api/Program.cs`
- [Authentication](https://github.com/d4m13n-d3v/mechanicbuddy/tree/main/backend/src/MechanicBuddy.Core.Application/Authorization): `backend/src/MechanicBuddy.Core.Application/Authorization`
- [Clients and vehicles](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Domain/Clients/Client.cs): `backend/src/MechanicBuddy.Core.Domain/Clients/Client.cs`
- [Work orders](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Domain/Work/Work.cs): `backend/src/MechanicBuddy.Core.Domain/Work/Work.cs`
- [Parts and inventory](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Domain/Storage.cs): `backend/src/MechanicBuddy.Core.Domain/Storage.cs`
- [Estimates and invoices](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Domain/Pricings/Pricing.cs): `backend/src/MechanicBuddy.Core.Domain/Pricings/Pricing.cs`
- [PDF and email](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Application/Services/PdfGenerator.cs): `backend/src/MechanicBuddy.Core.Application/Services/PdfGenerator.cs`
- [Domain model](https://github.com/d4m13n-d3v/mechanicbuddy/tree/main/backend/src/MechanicBuddy.Core.Domain): `backend/src/MechanicBuddy.Core.Domain`

### Workshop persistence

- [Repositories](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Persistence.Postgres/GenericRepository.cs): `backend/src/MechanicBuddy.Core.Persistence.Postgres/GenericRepository.cs`
- [Tenant databases](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Core.Persistence.Postgres/NHibernate/MultiTenancyConnectionDriver.cs): `backend/src/MechanicBuddy.Core.Persistence.Postgres/NHibernate/MultiTenancyConnectionDriver.cs`

### SaaS control plane

- [Management API](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Program.cs): `backend/src/MechanicBuddy.Management.Api/Program.cs`
- [Tenant operations](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Services/TenantService.cs): `backend/src/MechanicBuddy.Management.Api/Services/TenantService.cs`
- [Tenant records](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Repositories/TenantRepository.cs): `backend/src/MechanicBuddy.Management.Api/Repositories/TenantRepository.cs`
- [Tenant provisioning](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Services/TenantProvisioningService.cs): `backend/src/MechanicBuddy.Management.Api/Services/TenantProvisioningService.cs`
- [Billing](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Services/BillingService.cs): `backend/src/MechanicBuddy.Management.Api/Services/BillingService.cs`
- [Platform analytics](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Services/AnalyticsService.cs): `backend/src/MechanicBuddy.Management.Api/Services/AnalyticsService.cs`
- [Deployment services](https://github.com/d4m13n-d3v/mechanicbuddy/blob/main/backend/src/MechanicBuddy.Management.Api/Infrastructure/KubernetesClient.cs): `backend/src/MechanicBuddy.Management.Api/Infrastructure/KubernetesClient.cs`

### Management portal

- [Management portal](https://github.com/d4m13n-d3v/mechanicbuddy/tree/main/management-portal/src/app/dashboard): `management-portal/src/app/dashboard`

### Other components

- **Shop staff**
- **SaaS operators**
- **Cloud infrastructure**
- **SMTP mail**

## Connections

- Shop staff → Shop web UI: uses (evidence: `README.md`)
- Shop web UI → Web API client: requests data
- Web API client → Workshop API: calls API (evidence: `README.md`)
- Workshop API → Authentication: authorizes
- Workshop API → Clients and vehicles: manages
- Workshop API → Work orders: manages
- Workshop API → Parts and inventory: manages
- Workshop API → Estimates and invoices: manages
- Workshop API → Repositories: uses
- Workshop API → Tenant databases: queries
- Repositories → Tenant databases: persists (evidence: `README.md`)
- Clients and vehicles → Domain model: models (evidence: `backend/src/MechanicBuddy.Core.Domain/Clients/Client.cs`)
- Work orders → Domain model: models (evidence: `backend/src/MechanicBuddy.Core.Domain/Pricings/Estimate.cs`)
- Parts and inventory → Domain model: models (evidence: `backend/src/MechanicBuddy.Core.Domain/Storage.cs`)
- Estimates and invoices → PDF and email: generates documents (evidence: `README.md`)
- PDF and email → SMTP mail: emails PDFs (evidence: `README.md`)
- SaaS operators → Management portal: uses
- Management portal → Management API: calls API
- Management API → Tenant operations: routes tenant operations (evidence: `backend/src/MechanicBuddy.Management.Api/Program.cs`)
- Tenant operations → Tenant records: reads and writes (evidence: `backend/src/MechanicBuddy.Management.Api/Services/TenantService.cs`)
- Tenant operations → Tenant provisioning: provisions tenants (evidence: `README.md`)
- Tenant operations → Deployment services: manages deployments (evidence: `backend/src/MechanicBuddy.Management.Api/Services/TenantService.cs`)
- Management API → Billing: supports billing (evidence: `README.md`)
- Management API → Platform analytics: supports analytics (evidence: `README.md`)
- Deployment services → Cloud infrastructure: deploys infrastructure (evidence: `README.md`)
