The overall architecture
Which responsibility belongs in the API, which can the worker assume after committing?
The approval API accepts submissions, decisions, and status queries. After commit, the worker reads the outbox and hands over U-17. Both processes use the authoritative relational data store; the purchasing application remains outside the system boundary.
Starting point Step 5 defined request, task and handover as separate states.
Assumptions for the example case
Illustrative design: an internal procurement request for 6,000 euros undergoes business review followed by budget review. The inclusive budget threshold is 5,000 euros. These figures are assumptions rather than operational measurements. Ordering, payment, contract law and automatic decisions are outside the scope.
Runtime components within approval coordination
Runtime view · API and worker share a relational datastore
System boundary · Approval coordination
- Separate runtime processes
- Authoritative SQL datastore
- People and purchasing outside
The approval transaction writes state and outbox together. A worker then delivers U-17 to the external target.
Domain modules in API and Worker
Component view · Domain responsibilities within processes
API process
Worker process
- Modules per runtime process
- Joint transaction contract
Request and task management update business state in one transaction. Reminders read due tasks; handover coordination tracks acceptance evidence separately.
Starting architecture
- Modular core
- Application management, rule evaluation, task management and handover coordination remain domain modules of a clear core.
- Two runtime roles
- The API process answers requests. The worker processes outbox and reminder repeatably. Both share a transactional database boundary.
- Product neutral choice
- SQL, Worker and Outbox follow from transaction, history and external repetition. They do not require a specific workflow engine.
Map business responsibilities to implementation
| Building block at a glance | Module cooperation | Runtime |
|---|---|---|
| Application management | Maintains revision and request version; calls rule evaluation and task management | API |
| Rule evaluation | Provides versioned threshold rule P-2; determines whether budget approval is required | API as an internal call |
| Task management | Checks permissions and tasks; updates request management and requests handover at completion | API within a transaction |
| Handover coordination | Writes U-17 in the approval transaction; the purchasing adapter delivers it later | API and Worker |
Application management
- Module cooperation
- Maintains revision and request version; calls rule evaluation and task management
- Runtime
- API
Rule evaluation
- Module cooperation
- Provides versioned threshold rule P-2; determines whether budget approval is required
- Runtime
- API as an internal call
Task management
- Module cooperation
- Checks permissions and tasks; updates request management and requests handover at completion
- Runtime
- API within a transaction
Handover coordination
- Module cooperation
- Writes U-17 in the approval transaction; the purchasing adapter delivers it later
- Runtime
- API and Worker
Terms in this step
- Modular monolith
- A domain-structured application core with clear module boundaries and one release unit. Here, API and worker are two processes of the same application, rather than independently owned domain services.
- Runtime process
- An executable component such as the API or worker, distinct from a domain task or module.
Try it yourself
Assign submission, approval decision, reminder and U-17 handover to the API or worker. Justify one assignment.
A hint for your attempt
Ask if the step needs an immediate answer or can withstand an external repetition.
Compare with a possible solution
- API
- Submission and decision belong in the API because they check current business state and return a result or 409 to the person.
- Worker
- Reminder and U-17 transmission are with the worker because they can run repeatedly and timed after a commit.
Apply to your project
Which of your domain modules need an immediate answer, and which ones are allowed to work in a decoupled manner?