MicroservicesOverview

Microservices

Scanly currently runs three dedicated microservice packages alongside the main backend:

  • Automation Worker processes durable automation runs and coordinates their checkpoints with the backend.
  • Mail Gateway sends prepared messages through AWS SES or the local Inbucket SMTP server.
  • Frame Gateway provides the public HTTP and Socket.IO edge for live frame state.

The backend remains the owner of business data and Postgres persistence. The worker services receive small queue messages or TCP requests and ask the backend to perform operations that require domain data.

Architecture

Connection Summary

ServiceReceives work throughCalls or publishes toPublic endpoint
Automation WorkerBullMQ automations queueBackend TCP RPC and external HTTP targetsNone
Mail GatewayBullMQ mail queueBullMQ mail-results, AWS SES, or InbucketNone
Frame GatewayHTTP, Socket.IO, and backend TCP eventsBackend TCP RPC and connected frame clientsHTTP and Socket.IO on port 3334

Service Boundaries

  • Only the backend reads or writes automation and mail delivery records in Postgres.
  • Template rendering, variable resolution, attachments, tracking preparation, and domain authorization stay in the backend.
  • Valkey carries durable queue work. It is not the authoritative store for automation or delivery history.
  • The Automation Worker does not call the Mail Gateway directly. A SEND_MAIL automation action returns to the backend, which prepares and enqueues the mail request.
  • The Frame Gateway communicates directly with the backend over NestJS TCP because frame reads and updates need immediate request-response handling.