Design a Multi-Service Workflow Engine
Company: DoorDash
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Onsite
# Design a Multi-Service Workflow Engine
Design and demonstrate a workflow engine whose independent services run on separate ports and call one another to complete a workflow. The result should make service boundaries, workflow state, failures, and local end-to-end verification explicit.
### Constraints & Assumptions
- Each service owns one bounded responsibility and exposes a documented interface.
- Calls may fail, time out, or be retried; duplicate work must be considered.
- The design must be runnable locally as multiple processes, but no particular language or framework is required.
### Clarifying Questions to Ask
- Is the workflow synchronous, asynchronous, or a mix of both?
- Which steps have irreversible side effects and need compensation?
- What completion result must the caller observe?
```hint Define the state machine
Name each workflow state and transition before choosing transports or frameworks.
```
### What a Strong Answer Covers
- Clear service boundaries and interface contracts.
- An orchestration or choreography choice justified for the workflow.
- Durable state, correlation identifiers, idempotency, retry, timeout, and compensation behavior.
- A local multi-port test that proves both the success path and at least one failed dependency path.
### Follow-up Questions
1. How would you resume a workflow after the coordinator restarts?
2. When would an event broker be preferable to direct service calls?
Quick Answer: Design a locally runnable workflow engine made of collaborating services, with durable state, retries, idempotency, and failure recovery.