0037: Onboarding Adapter Architecture
Date: 2025-11-08
Status: Proposed
Context
The platform requires a service to manage complex, multi-step onboarding processes for new tenants and users. These processes are long-running and may involve human interaction, external API calls, and internal service orchestration.
We have two primary architectural options:
- Stateful Service: Build the
onboarding-serviceas a stateful microservice that manages its own state machine, persistence, and retry logic. - Stateless Adapter: Build the
onboarding-serviceas a stateless adapter that provides a domain-specific API but delegates the actual orchestration and state management to a generic, platform-wideworkflow-service.
A stateful service would duplicate logic that is common to many long-running business processes (e.g., order fulfillment, report generation). A generic workflow-service (as planned in P1) is designed to solve this problem centrally.
Decision
We will implement the onboarding-service as a stateless adapter on top of the generic workflow-service.
The onboarding-service will not have its own state machine or persistence layer for tracking process state. Its sole responsibilities are:
- To provide a clean, domain-specific API for "onboarding" (e.g.,
POST /onboarding/start). - To translate these domain-specific requests into generic calls to the
workflow-service(e.g.,POST /workflows/{workflow_name}/start). - To act as a simple proxy for status queries, translating
GET /onboarding/{id}/statustoGET /workflows/instances/{id}.
Consequences
Positive
- Simplicity & Focus: The
onboarding-serviceremains simple, stateless, and focused on its API contract. It is easy to develop, test, and scale. - Reusability: We avoid building a custom state machine and instead leverage the robust, reusable capabilities of the central
workflow-service. - Consistency: All long-running business processes across the platform will be managed and monitored in the same way, using the
workflow-service. - Flexibility: The mapping of onboarding "pipelines" to actual workflows can be configured within the adapter, allowing for changes without redeploying the core workflow engine.
Negative
- Direct Dependency: The
onboarding-servicehas a hard, synchronous dependency on theworkflow-serviceto function. This is an acceptable trade-off as they are part of the same core process. - Distributed Logic: The complete logic for an onboarding process is distributed between the adapter's API and the workflow definition itself, which can be slightly more complex to trace end-to-end.