Scenario
Design a small backend service that manages a core entity with CRUD operations and also supports an asynchronous background job triggered by user actions.
To make the problem concrete, assume the core entity is a Document that a user can create/update/delete and optionally request an Export (a long-running job that generates a downloadable file).
Requirements
Functional
-
CRUD Documents
-
Create a document (title + body)
-
Read/list documents (filter by owner)
-
Update a document
-
Delete a document
-
Async Export Job
-
User requests an export for a document.
-
Export runs asynchronously (may take minutes).
-
User can query job status.
-
When done, user can fetch a download URL (or a reference to the exported file).
Non-functional
-
Multi-tenant: documents belong to a user/account.
-
Avoid duplicated exports when users retry the request.
-
System should be resilient to worker crashes and support retries.
Deliverables
-
Propose a relational schema (tables, key fields, indexes).
-
Define REST APIs (endpoints, request/response, status codes).
-
Describe the async job workflow (queue, worker, retries, idempotency).
-
Call out important edge cases and operational considerations.