# aandrei1/orderprocess architecture

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

- Interactive diagram: https://gitdiagram.com/aandrei1/orderprocess
- Repository: https://github.com/aandrei1/orderprocess

## Overview

orderProcess is a Symfony order-processing backend with a small React UI. The main workflow accepts an order request, reserves product stock, creates and pays the order, persists changes and outbox events atomically, then returns a read-model representation. Listing/detail orders and product catalog reads are separate CQRS-style branches. The README documents outbox messaging, optimistic locking and correlated structured logging; their runtime wiring is not fully sampled, so those connections are shown as unverified where necessary.

Main entry points: [`src/Orders/Application/Command/PlaceOrderHandler.php`](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Command/PlaceOrderHandler.php) (Place order), [`frontend/src/api.ts`](https://github.com/aandrei1/orderprocess/blob/main/frontend/src/api.ts) (API client), [`frontend/src/App.tsx`](https://github.com/aandrei1/orderprocess/blob/main/frontend/src/App.tsx) (Web app), [`src/Orders/UI/Controller/OrderController.php`](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/UI/Controller/OrderController.php) (Order API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interfaces"]
  node_web["Web app<br/>[App.tsx]"]
  node_orderform["Order form<br/>[NewOrder.tsx]"]
  node_orderlistui["Order list UI<br/>[OrderList.tsx]"]
  node_frontendapi["API client<br/>[api.ts]"]
  node_ordercontroller["Order API"]
  node_productcontroller["Product API"]
end

subgraph group_app["Application workflows"]
  node_placehandler["Place order"]
  node_queryhandlers["Order queries"]
  node_productquery["Product query"]
  node_txport["Transaction port"]
  node_eventport["Event dispatch port"]
  node_orderreadport["Order read port<br/>[OrderReadModel.php]"]
  node_productreadport["Product read port"]
end

subgraph group_domain["Orders domain"]
  node_order["Order aggregate<br/>[Order.php]"]
  node_product["Stock product<br/>[Product.php]"]
  node_orderrepo["Order repository port"]
  node_productrepo["Product repository port"]
  node_paymentport["Payment port<br/>[PaymentGateway.php]"]
end

subgraph group_infra["Infrastructure adapters"]
  node_dborder["Order persistence"]
  node_dbproduct["Product persistence"]
  node_dbread["SQL read models"]
  node_dbtx["Doctrine transaction"]
  node_outbox["Transactional outbox"]
  node_mockpayment["Mock payment"]
  node_logging["Correlated logging"]
end

node_customer(("Customer"))
node_database[("PostgreSQL")]
node_rabbitmq["RabbitMQ"]
node_observability["Log analytics"]

node_customer -->|"uses"| node_web
node_web -->|"routes to"| node_orderform
node_web -->|"routes to"| node_orderlistui
node_orderform -->|"submits via"| node_frontendapi
node_orderlistui -->|"fetches via"| node_frontendapi
node_frontendapi -.->|"HTTP requests"| node_ordercontroller
node_frontendapi -.->|"HTTP requests"| node_productcontroller
node_ordercontroller -->|"invokes"| node_placehandler
node_ordercontroller -->|"dispatches queries"| node_queryhandlers
node_productcontroller -->|"dispatches query"| node_productquery
node_placehandler -->|"runs transaction"| node_txport
node_placehandler -->|"loads and saves"| node_productrepo
node_placehandler -->|"decrements stock"| node_product
node_placehandler -->|"creates and pays"| node_order
node_placehandler -->|"charges"| node_paymentport
node_placehandler -->|"saves order"| node_orderrepo
node_placehandler -->|"dispatches events"| node_eventport
node_placehandler -->|"logs outcome"| node_logging
node_order -.->|"read model adapter"| node_orderreadport
node_queryhandlers -->|"queries"| node_orderreadport
node_productquery -->|"queries"| node_productreadport
node_orderreadport -->|"implemented by"| node_dbread
node_productreadport -.->|"implemented by"| node_dbread
node_orderrepo -->|"implemented by"| node_dborder
node_productrepo -->|"implemented by"| node_dbproduct
node_txport -->|"implemented by"| node_dbtx
node_eventport -.->|"implemented by"| node_outbox
node_paymentport -.->|"implemented by"| node_mockpayment
node_dborder -.->|"reads and writes"| node_database
node_dbproduct -.->|"reads and writes"| node_database
node_dbread -.->|"queries"| node_database
node_dbtx -.->|"controls transaction"| node_database
node_outbox -.->|"writes event rows"| node_database
node_outbox -.->|"publishes events"| node_rabbitmq
node_logging -.->|"ships logs"| node_observability

click node_web "https://github.com/aandrei1/orderprocess/blob/main/frontend/src/App.tsx"
click node_orderform "https://github.com/aandrei1/orderprocess/blob/main/frontend/src/NewOrder.tsx"
click node_orderlistui "https://github.com/aandrei1/orderprocess/blob/main/frontend/src/OrderList.tsx"
click node_frontendapi "https://github.com/aandrei1/orderprocess/blob/main/frontend/src/api.ts"
click node_ordercontroller "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/UI/Controller/OrderController.php"
click node_productcontroller "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/UI/Controller/ProductController.php"
click node_placehandler "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Command/PlaceOrderHandler.php"
click node_queryhandlers "https://github.com/aandrei1/orderprocess/tree/main/src/Orders/Application/Query"
click node_productquery "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Query/ListProductsHandler.php"
click node_order "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Domain/Model/Order.php"
click node_product "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Domain/Model/Product.php"
click node_orderrepo "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Domain/Port/OrderRepository.php"
click node_productrepo "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Domain/Port/ProductRepository.php"
click node_paymentport "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Domain/Port/PaymentGateway.php"
click node_txport "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Port/TransactionManager.php"
click node_eventport "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Port/DomainEventDispatcher.php"
click node_orderreadport "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Port/OrderReadModel.php"
click node_productreadport "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Port/ProductReadModel.php"
click node_dborder "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Infrastructure/Persistence/DoctrineOrderRepository.php"
click node_dbproduct "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Infrastructure/Persistence/DoctrineProductRepository.php"
click node_dbread "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Infrastructure/Persistence/DoctrineOrderReadModel.php"
click node_dbtx "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Infrastructure/Persistence/DoctrineTransactionManager.php"
click node_outbox "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Infrastructure/Messaging/OutboxDomainEventDispatcher.php"
click node_mockpayment "https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Infrastructure/Messaging/MockPaymentGateway.php"
click node_logging "https://github.com/aandrei1/orderprocess/tree/main/src/Orders/Infrastructure/Logging"

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,node_orderform,node_orderlistui,node_frontendapi,node_ordercontroller,node_productcontroller toneBlue
class node_placehandler,node_queryhandlers,node_productquery,node_txport,node_eventport,node_orderreadport,node_productreadport,node_database toneAmber
class node_order,node_product,node_orderrepo,node_productrepo,node_paymentport toneMint
class node_dborder,node_dbproduct,node_dbread,node_dbtx,node_outbox,node_mockpayment,node_logging toneRose
class node_customer,node_rabbitmq,node_observability toneIndigo
```

## Components

### User interfaces

- [Web app](https://github.com/aandrei1/orderprocess/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Order form](https://github.com/aandrei1/orderprocess/blob/main/frontend/src/NewOrder.tsx): `frontend/src/NewOrder.tsx`
- [Order list UI](https://github.com/aandrei1/orderprocess/blob/main/frontend/src/OrderList.tsx): `frontend/src/OrderList.tsx`
- [API client](https://github.com/aandrei1/orderprocess/blob/main/frontend/src/api.ts): `frontend/src/api.ts`
- [Order API](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/UI/Controller/OrderController.php): `src/Orders/UI/Controller/OrderController.php`
- [Product API](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/UI/Controller/ProductController.php): `src/Orders/UI/Controller/ProductController.php`

### Application workflows

- [Place order](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Command/PlaceOrderHandler.php): `src/Orders/Application/Command/PlaceOrderHandler.php`
- [Order queries](https://github.com/aandrei1/orderprocess/tree/main/src/Orders/Application/Query): `src/Orders/Application/Query`
- [Product query](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Query/ListProductsHandler.php): `src/Orders/Application/Query/ListProductsHandler.php`
- [Transaction port](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Port/TransactionManager.php): `src/Orders/Application/Port/TransactionManager.php`
- [Event dispatch port](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Port/DomainEventDispatcher.php): `src/Orders/Application/Port/DomainEventDispatcher.php`
- [Order read port](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Port/OrderReadModel.php): `src/Orders/Application/Port/OrderReadModel.php`
- [Product read port](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Application/Port/ProductReadModel.php): `src/Orders/Application/Port/ProductReadModel.php`

### Orders domain

- [Order aggregate](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Domain/Model/Order.php): `src/Orders/Domain/Model/Order.php`
- [Stock product](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Domain/Model/Product.php): `src/Orders/Domain/Model/Product.php`
- [Order repository port](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Domain/Port/OrderRepository.php): `src/Orders/Domain/Port/OrderRepository.php`
- [Product repository port](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Domain/Port/ProductRepository.php): `src/Orders/Domain/Port/ProductRepository.php`
- [Payment port](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Domain/Port/PaymentGateway.php): `src/Orders/Domain/Port/PaymentGateway.php`

### Infrastructure adapters

- [Order persistence](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Infrastructure/Persistence/DoctrineOrderRepository.php): `src/Orders/Infrastructure/Persistence/DoctrineOrderRepository.php`
- [Product persistence](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Infrastructure/Persistence/DoctrineProductRepository.php): `src/Orders/Infrastructure/Persistence/DoctrineProductRepository.php`
- [SQL read models](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Infrastructure/Persistence/DoctrineOrderReadModel.php): `src/Orders/Infrastructure/Persistence/DoctrineOrderReadModel.php`
- [Doctrine transaction](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Infrastructure/Persistence/DoctrineTransactionManager.php): `src/Orders/Infrastructure/Persistence/DoctrineTransactionManager.php`
- [Transactional outbox](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Infrastructure/Messaging/OutboxDomainEventDispatcher.php): `src/Orders/Infrastructure/Messaging/OutboxDomainEventDispatcher.php`
- [Mock payment](https://github.com/aandrei1/orderprocess/blob/main/src/Orders/Infrastructure/Messaging/MockPaymentGateway.php): `src/Orders/Infrastructure/Messaging/MockPaymentGateway.php`
- [Correlated logging](https://github.com/aandrei1/orderprocess/tree/main/src/Orders/Infrastructure/Logging): `src/Orders/Infrastructure/Logging`

### Other components

- **Customer**
- **PostgreSQL**
- **RabbitMQ**
- **Log analytics**

## Connections

- Customer → Web app: uses (evidence: `frontend/src/App.tsx`)
- Web app → Order form: routes to (evidence: `frontend/src/App.tsx`)
- Web app → Order list UI: routes to (evidence: `frontend/src/App.tsx`)
- Order form → API client: submits via (evidence: `frontend/src/NewOrder.tsx`)
- Order list UI → API client: fetches via (evidence: `frontend/src/OrderList.tsx`)
- API client → Order API: HTTP requests
- API client → Product API: HTTP requests
- Order API → Place order: invokes (evidence: `src/Orders/UI/Controller/OrderController.php`)
- Order API → Order queries: dispatches queries (evidence: `src/Orders/UI/Controller/OrderController.php`)
- Product API → Product query: dispatches query (evidence: `src/Orders/UI/Controller/ProductController.php`)
- Place order → Transaction port: runs transaction (evidence: `src/Orders/Application/Command/PlaceOrderHandler.php`)
- Place order → Product repository port: loads and saves (evidence: `src/Orders/Application/Command/PlaceOrderHandler.php`)
- Place order → Stock product: decrements stock (evidence: `src/Orders/Application/Command/PlaceOrderHandler.php`)
- Place order → Order aggregate: creates and pays (evidence: `src/Orders/Application/Command/PlaceOrderHandler.php`)
- Place order → Payment port: charges (evidence: `src/Orders/Application/Command/PlaceOrderHandler.php`)
- Place order → Order repository port: saves order (evidence: `src/Orders/Application/Command/PlaceOrderHandler.php`)
- Place order → Event dispatch port: dispatches events (evidence: `src/Orders/Application/Command/PlaceOrderHandler.php`)
- Place order → Correlated logging: logs outcome (evidence: `src/Orders/Application/Command/PlaceOrderHandler.php`)
- Order aggregate → Order read port: read model adapter
- Order queries → Order read port: queries (evidence: `src/Orders/Application/Query/ListOrdersHandler.php`)
- Product query → Product read port: queries (evidence: `src/Orders/Application/Query/ListProductsHandler.php`)
- Order read port → SQL read models: implemented by (evidence: `src/Orders/Application/Port/OrderReadModel.php`)
- Product read port → SQL read models: implemented by
- Order repository port → Order persistence: implemented by (evidence: `src/Orders/Infrastructure/Persistence/DoctrineOrderRepository.php`)
- Product repository port → Product persistence: implemented by (evidence: `src/Orders/Infrastructure/Persistence/DoctrineProductRepository.php`)
- Transaction port → Doctrine transaction: implemented by (evidence: `src/Orders/Infrastructure/Persistence/DoctrineTransactionManager.php`)
- Event dispatch port → Transactional outbox: implemented by
- Payment port → Mock payment: implemented by
- Order persistence → PostgreSQL: reads and writes
- Product persistence → PostgreSQL: reads and writes
- SQL read models → PostgreSQL: queries
- Doctrine transaction → PostgreSQL: controls transaction
- Transactional outbox → PostgreSQL: writes event rows
- Transactional outbox → RabbitMQ: publishes events
- Correlated logging → Log analytics: ships logs
