# saidwalikhan/stitchflow architecture

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

- Interactive diagram: https://gitdiagram.com/saidwalikhan/stitchflow
- Repository: https://github.com/saidwalikhan/stitchflow

## Overview

TailorPro is a tailoring-shop order-management API. Its sampled application workflow creates an order for the authenticated customer: it checks customer, services, measurements, and shop; generates an order number; builds order items using stored service prices; then saves the order. Domain entities represent shops, services, customer measurements, and order status. The tree has no README content or controller source, so the API-to-command dispatch is not shown; the diagram limits those connections to the host’s documented controller mapping and the handler’s evidenced dependencies.

Main entry points: [`TailorPro/TailorPro.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs`](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs) (Create order handler), [`TailorPro/TailorPro.Api/Program.cs`](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Api/Program.cs) (API host), [`TailorPro/TailorPro.Infrastructure/Persistence/ApplicationDbContext.cs`](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Infrastructure/Persistence/ApplicationDbContext.cs) (Application context), [`TailorPro/TailorPro.Application/Common/Behaviors/ValidationBehavior.cs`](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Application/Common/Behaviors/ValidationBehavior.cs) (Validation pipeline)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API host"]
  node_host["API host<br/>[Program.cs]"]
  node_controllers["Controller routes<br/>[TailorPro.Api]"]
end

subgraph group_application["Order application"]
  node_create_cmd["Create order request"]
  node_validation["Validation pipeline"]
  node_validator["Order validator"]
  node_handler["Create order handler"]
end

subgraph group_domain["Tailoring domain"]
  node_domain_models["Order and profiles<br/>[Order.cs]"]
  node_service_model["Shop services<br/>[Service.cs]"]
end

subgraph group_infrastructure["Infrastructure"]
  node_context["Application context"]
  node_database[("Application database")]
  node_current_user["Current user service"]
  node_order_number["Order number generator"]
end

node_customer(("API user"))

node_customer -->|"sends requests"| node_host
node_host -->|"maps controllers"| node_controllers
node_host -->|"registers application"| node_validation
node_host -->|"registers infrastructure"| node_context
node_validation -->|"runs validators"| node_validator
node_validation -->|"continues request"| node_handler
node_handler -->|"reads user"| node_current_user
node_handler -->|"loads profiles and services"| node_context
node_handler -->|"generates number"| node_order_number
node_handler -->|"creates order"| node_domain_models
node_handler -->|"uses service prices"| node_service_model
node_handler -->|"adds and saves order"| node_context
node_context -->|"reads and writes"| node_database

click node_host "https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Api/Program.cs"
click node_controllers "https://github.com/saidwalikhan/stitchflow/tree/main/TailorPro/TailorPro.Api"
click node_create_cmd "https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommand.cs"
click node_validation "https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Application/Common/Behaviors/ValidationBehavior.cs"
click node_validator "https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandValidator.cs"
click node_handler "https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs"
click node_domain_models "https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Domain/Entities/Order.cs"
click node_service_model "https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Domain/Entities/Service.cs"
click node_context "https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Infrastructure/Persistence/ApplicationDbContext.cs"
click node_current_user "https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Infrastructure/Identity/CurrentUserService.cs"
click node_order_number "https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Infrastructure/Services/OrderNumberGenerator.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_host,node_controllers,node_customer toneBlue
class node_create_cmd,node_validation,node_validator,node_handler toneAmber
class node_domain_models,node_service_model toneMint
class node_context,node_database,node_current_user,node_order_number toneRose
```

## Components

### API host

- [API host](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Api/Program.cs): `TailorPro/TailorPro.Api/Program.cs`
- [Controller routes](https://github.com/saidwalikhan/stitchflow/tree/main/TailorPro/TailorPro.Api): `TailorPro/TailorPro.Api`

### Order application

- [Create order request](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommand.cs): `TailorPro/TailorPro.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommand.cs`
- [Validation pipeline](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Application/Common/Behaviors/ValidationBehavior.cs): `TailorPro/TailorPro.Application/Common/Behaviors/ValidationBehavior.cs`
- [Order validator](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandValidator.cs): `TailorPro/TailorPro.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandValidator.cs`
- [Create order handler](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs): `TailorPro/TailorPro.Application/Features/Orders/Commands/CreateOrder/CreateOrderCommandHandler.cs`

### Tailoring domain

- [Order and profiles](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Domain/Entities/Order.cs): `TailorPro/TailorPro.Domain/Entities/Order.cs`
- [Shop services](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Domain/Entities/Service.cs): `TailorPro/TailorPro.Domain/Entities/Service.cs`

### Infrastructure

- [Application context](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Infrastructure/Persistence/ApplicationDbContext.cs): `TailorPro/TailorPro.Infrastructure/Persistence/ApplicationDbContext.cs`
- **Application database**
- [Current user service](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Infrastructure/Identity/CurrentUserService.cs): `TailorPro/TailorPro.Infrastructure/Identity/CurrentUserService.cs`
- [Order number generator](https://github.com/saidwalikhan/stitchflow/blob/main/TailorPro/TailorPro.Infrastructure/Services/OrderNumberGenerator.cs): `TailorPro/TailorPro.Infrastructure/Services/OrderNumberGenerator.cs`

### Other components

- **API user**

## Connections

- API user → API host: sends requests
- API host → Controller routes: maps controllers
- API host → Validation pipeline: registers application
- API host → Application context: registers infrastructure
- Validation pipeline → Order validator: runs validators
- Validation pipeline → Create order handler: continues request
- Create order handler → Current user service: reads user
- Create order handler → Application context: loads profiles and services
- Create order handler → Order number generator: generates number
- Create order handler → Order and profiles: creates order
- Create order handler → Shop services: uses service prices
- Create order handler → Application context: adds and saves order
- Application context → Application database: reads and writes
