Skip to content

๐Ÿค– Architecture โ€‹

This architecture follows the Onion Architecture principle, with the Core domain logic at the center.

  • Core โ€“ Contains the Domain rules and models, the Application layer for use cases, and Contracts for abstractions.
  • Infrastructure โ€“ Implements persistence, messaging, and storage (e.g. Database, Azure Service Bus, Azure Blob Storage).
  • Connectors โ€“ Integrations with external systems like KatanaPIM, Google Sheets, and Exact Online.
  • UI โ€“ Entry points such as API, Admin, Functions, and Jobs, all delegating to the Application layer.
  • App โ€“ Frontend client consuming the API.

Dependencies always point inward: outer layers depend on the Core, but the Core remains independent, ensuring separation of concerns and maintainability.

200%

System Topology โ€‹

All runtime components deployed to Azure and their primary communication paths.

200%
ComponentDeploymentKey detail
AppContainer App (port 3000)Nuxt.js frontend, calls PublicApi via nuxt-api-party
Public APIContainer App (port 8080)ASP.NET, JWT/Auth0, Service Bus Data Sender role only
AdminContainer App (port 8080)Blazor, Service Bus Data Owner (DLQ management), can start jobs
FunctionsFlex Consumption plan5 timer, 2 ServiceBus, 2 HTTP triggers
JobsContainer App JobEvent-triggered by queued-jobs, one message per instance, exits after completion
Tenant DBsSQL Server elastic poolDatabase-per-tenant; connector schemas (ExactOnline, KatanaPim, Wolfpack, GoogleSheet) live in the tenant DB
Admin DBSQL ServerShared across all tenants (administrations, identities, job definitions)

Event Processing Flow โ€‹

Domain changes propagate asynchronously through two chains where Service Bus queues and Azure Functions are the links. Both chains originate from synchronous API writes but continue independently in the background.

Part 1 โ€” Notification chain โ€‹

A command handler writes to the database and the EventOutbox in a single transaction. A timer function publishes outbox entries to the events queue, where a ServiceBus function dispatches them to MediatR handlers. Handlers that produce webhooks push work to the webhooks queue for a second function to execute.

200%
StepDetail
Outbox writeCustomMediator.PublishToOutbox writes notification + metadata in the same DB transaction as the command
DeduplicationDeduplicationKeyVisitor collapses multiple updates to the same entity within a batch
Event functionSets IAdministrationContext, then runs all INotificationHandler<T> implementations
Webhook retriesExponential backoff (1, 5, 15, 30 โ€ฆ min), up to 16 attempts, then dead-lettered
Dead lettersVisible in Admin portal (DLQ page) for events, webhooks, and queued-jobs

Part 2 โ€” Job execution chain โ€‹

A timer function evaluates cron schedules and publishes JobExecuteCommand messages to the queued-jobs queue. Each message triggers a Container App Job instance that scales from zero, runs the sync/export, and exits.

200%
Job typePurpose
ItemSync / ItemSelectiveSyncImport items from connectors
CustomerSync / CustomerSelectiveSyncImport customers from connectors
PriceListSyncImport price lists from connectors
OrderExportExport orders to connectors
AuditTrailPublishPublish audit trail entries to Blob Storage

Jobs can also be started manually from the Admin portal, which publishes directly to the queued-jobs queue via JobStartCommandHandler.

Notification types flowing through the chain โ€‹

DomainNotifications
ItemsItemCreatedNotification ยท ItemUpdatedNotification ยท ItemDeletedNotification
CustomersCustomerCreatedNotification ยท CustomerUpdatedNotification ยท CustomerDeletedNotification
Customer addressesCustomerAddressCreatedNotification ยท CustomerAddressUpdatedNotification ยท CustomerAddressDeletedNotification
Customer contactsCustomerContactPersonCreatedNotification ยท CustomerContactPersonUpdatedNotification ยท CustomerContactPersonDeletedNotification
Price listsPriceListCreatedNotification ยท PriceListUpdatedNotification ยท PriceListDeletedNotification
Entity listsEntityListCreatedNotification ยท EntityListUpdatedNotification
OrdersOrderCreatedNotification
AdministrationAdministrationNotificationSendEmailNotification