How tair800/azshipping works
1. This repository is a .NET microservices backend for an ERP/logistics product. The system is split into bounded-context services, each with its own API, application logic, domain model, infrastructure layer, and database migrations.
2. The main architectural pattern is consistent across services: API controllers at the edge, CQRS-style command/query handlers in the Application layer, domain aggregates and repository interfaces in Domain, and EF Core persistence/repositories in Infrastructure. Most features are organized by vertical slices such as Features/<Entity>/Commands and Features/<Entity>/Queries.
3. Identity is the authentication authority. Azshipping-Identity issues JWTs, supports login/refresh/password flows, and enriches tokens with ERP permission claims. During login it calls Settings to resolve employee-group permissions into flat erp_permission claims, so downstream services do not need to query Settings on every request.
4. All business APIs validate the same JWT settings and use shared authorization rules. The shared AzShipping.ApiSecurity library contains canonical claim names plus middleware that enforces module-level access by claim prefix. Individual services also add their own permission evaluators/filters for finer-grained rules on controller actions.
5. Settings is the central reference-data and platform-configuration service. It owns dictionaries and system configuration such as banks, countries, cities, departments, employee groups, email settings, numerations, logs, templates, transport types, packaging, and workflow statuses. It also exposes the permission-resolution endpoint used by Identity and internal services for logging/email workflows.
6. The business services are split by domain:
- Clients: CRM/client master data, directions, documents, negotiations, currencies.
- Carrier: carriers, drivers, vehicles, shipping lines, terminals, railway stations, carrier tasks/documents.
- General: employees, tasks, meetings, incoterms, VAS, vessels, projects, and task documents.
- Request: freight requests, price proposals, commercial offers, request negotiations/comments, sales and sale statuses.
- Quotes: quotes, addresses, quote types, quote funnel, dimension calculations.
- Operation: logistics operations/orders and their calculation services.
- Accounting: operation invoices, invoice lookups, acts, payments, and VAT-related logic.
7. The product has a visible business flow across services. Request captures demand and pricing inputs, Quotes turns that into quote and funnel data, Operation materializes logistics operations/orders, and Accounting tracks invoices, payments, and VAT against those operations. This is not a hard-coded shared process engine; it is a set of service-to-service aligned bounded contexts.
8. Several services depend on Settings or other platform services via HTTP clients rather than shared databases. Examples include action-log clients, VAT lookup services, settings-reference clients, permission-resolution calls, and document storage helpers. These dependencies are implemented as application-level interfaces with infrastructure-side HTTP or storage implementations.
9. Infrastructure is per-service and mostly database-centric. Each service has its own EF Core DbContext, repository implementations, seeders, and migration history, which indicates isolated persistence boundaries and independent schema evolution. The repo is organized so each bounded context can be deployed and migrated separately.
10. Cross-cutting concerns are standardized. DTOs live in Application, mapping is handled explicitly per feature, validators sit beside commands/queries where needed, and MediatR-style pipeline behavior is used for exception logging. This keeps controllers thin and pushes orchestration into handlers.
11. Shared code is intentionally small. Aside from AzShipping.ApiSecurity, the repo does not centralize business models across services; each service owns its own domain entities and DTOs. That keeps the coupling low and makes the architecture diagram naturally split around service boundaries instead of around shared libraries.
12. If you draw the architecture, the most important arrows are: browser/UI to Identity for login; Identity to Settings for permission resolution; UI to each API with the JWT; business APIs to their own databases; and selected service-to-service calls for action logs, reference data, email, document storage, and calculation helpers.
Main entry points: Operation.Application Operation App · Request.Application Request App · Accounting.Application Accounting App · AzShipping.ApiSecurity ApiSecurity
Components 23
Shared
Cross-service security primitives
- ApiSecurity · Canonical JWT claims and module-access middleware
shared/AzShipping.ApiSecurity
Identity
Authentication and token issuance
- Identity API · Login, refresh, password, roles, users, permissions
Azshipping-Identity/Identity.API - Identity App · CQRS handlers for auth and account management
Azshipping-Identity/Identity.Application - Identity Domain · Users, roles, permissions, refresh tokens
Azshipping-Identity/Identity.Domain - Identity Infra · EF Core, repositories, token and email services
Azshipping-Identity/Identity.Infrastructure
Platform
Reference data and operational services
- Settings API · Platform dictionaries, config, logs, permission resolution
services/Settings/Settings.API - Settings App · CQRS handlers for master data, logs, email, numeration
services/Settings/Settings.Application - Settings Domain · Lookup aggregates, logs, configuration, employee groups
services/Settings/Settings.Domain - Settings Infra · EF Core store, seeders, logging and SMTP helpers
services/Settings/Settings.Infrastructure
Commercial flow
Demand to quote to operation to accounting
- Clients API · Clients, directions, documents, negotiations, currencies
services/Clients/Clients.API - Clients App · Vertical-slice commands, queries, enrichment and mappers
services/Clients/Clients.Application - Clients Infra · EF Core repositories plus action-log and settings clients
services/Clients/Clients.Infrastructure - Request API · Freight requests, proposals, offers, comments, sales
services/Request/Request.API - Request App · Request lifecycle, pricing flows, calculators, validation
services/Request/Request.Application - Request Infra · EF Core repositories plus VAT and action-log clients
services/Request/Request.Infrastructure - Quotes API · Quotes, addresses, funnel and dimension endpoints
services/Quotes/Quotes.API - Quotes App · Quote lifecycle, address handling, dimension calculation
services/Quotes/Quotes.Application - Operation API · Logistics operations and permission-gated order access
services/Operation/Operation.API - Operation App · Operation orchestration and freight/finance calculations
services/Operation/Operation.Application - Operation Infra · EF Core repositories and operation schema evolution
services/Operation/Operation.Infrastructure - Accounting API · Invoices, acts, payments, VAT and lookup endpoints
services/Accounting/Accounting.API - Accounting App · Invoice, payment, and VAT workflows with calculators
services/Accounting/Accounting.Application - Accounting Infra · EF Core repositories and seed/migration boundary
services/Accounting/Accounting.Infrastructure
Connections 32
- Identity API → Identity App: HTTP to CQRS · Controllers dispatch auth and admin actions to handlers
- Identity App → Identity Domain: rules · Handlers manipulate user, role, permission, and token aggregates
- Identity App → Identity Infra: ports · Application depends on repositories and external services via interfaces
- Identity Infra → Identity Domain: persistence · Infrastructure implements repositories for auth aggregates
- Settings API → Settings App: HTTP to CQRS · Controllers dispatch reference-data and workflow actions to handlers
- Settings App → Settings Domain: rules · Handlers manage lookup, log, email, and configuration aggregates
- Settings App → Settings Infra: ports · Application uses repositories, SMTP, and internal services
- Settings Infra → Settings Domain: persistence · Infrastructure implements repositories over isolated settings data
- Clients API → Clients App: HTTP to CQRS · Client controllers delegate to vertical-slice handlers
- Clients App → Clients Infra: ports · Application uses action-log and settings reference clients plus repositories
- Clients Infra → Clients App: impl · Infrastructure provides repository and HTTP-client implementations
- Request API → Request App: HTTP to CQRS · Request controllers delegate demand and pricing operations
- Request App → Request Infra: ports · Application uses repositories, VAT lookup, and action-log clients
- Request Infra → Request App: impl · Infrastructure implements persistence and external service adapters
- Quotes API → Quotes App: HTTP to CQRS · Quote controllers delegate to handlers and mappers
- Operation API → Operation App: HTTP to CQRS · Operation controller delegates orchestration and calculations
- Operation App → Operation Infra: ports · Application uses operation repositories and persistence adapters
- Operation Infra → Operation App: impl · Infrastructure implements operation storage and seeding
- Accounting API → Accounting App: HTTP to CQRS · Accounting controllers delegate invoices, acts, payments, and VAT flows
- Accounting App → Accounting Infra: ports · Application uses repositories for accounting aggregates
- Accounting Infra → Accounting App: impl · Infrastructure implements accounting persistence and seeding
- Identity API → Settings API: permission claims · Login enriches JWTs by resolving employee-group permissions from Settings
- Settings App → Identity App: claims source · Settings resolves flat ERP permission claims used by Identity
- Clients Infra → Settings API: reference data · Clients uses settings lookup and action-log services over HTTP
- Request App → Quotes App: demand to quote · Request data feeds quote and funnel workflows
- Quotes App → Operation App: quote to ops · Quote outcomes materialize into logistics operations
- Operation App → Accounting App: ops to finance · Operations drive invoices, acts, payments, and VAT tracking
- Clients App → ApiSecurity: shared auth · Services rely on canonical claims and module-access middleware
- Request App → ApiSecurity: shared auth · Services rely on canonical claims and module-access middleware
- Quotes App → ApiSecurity: shared auth · Services rely on canonical claims and module-access middleware
- Operation App → ApiSecurity: shared auth · Services rely on canonical claims and module-access middleware
- Accounting App → ApiSecurity: shared auth · Services rely on canonical claims and module-access middleware