Skip to main content

Architecture overview

Context​

One container image runs in two roles (Integrations__Roles): Api serves HTTP, and Worker runs the message consumers and the scheduled jobs. In Kubernetes they are separate Deployments; locally and in the demo, one process runs both.

Layers​

Dependencies point inwards. The Application layer owns the ports (ITaxProvider, IAddressProvider, IPartyProvider, ICertificateProvider, IExchangeRateProvider, IEventPublisher, IAppDbContext), and the outer layers implement them. These rules are enforced by architecture tests (tests/.../Architecture/LayeringTests.cs):

RuleWhy
Domain depends on nothing but the base libraryBusiness rules stay testable and portable
Contracts are self-containedOther teams reference them as a package
Application reaches the outside only through its own portsProviders can be swapped (Mexico, a different FX source)
The Avalara SDK is used only inside the AvaTax adapterOne place to change when Avalara changes
Adapter classes are internalCallers depend on ports, not on implementations

A request, end to end​

Saving before calling AvaTax and using a document code derived from the caller's natural key means a crash or retry, including a redelivered message whose first attempt rolled back, adjusts the same AvaTax transaction instead of creating a second one. The transactional outbox means events leave only when the change commits.

Where to go next​