At Light, we want to buld the best-in-class invoice approval workflow application. When a customer receives an invoice from a vendor, an approval request is automatically sent to one or more employees (approvers).
The approval routing logic is based on three criteria:
- Invoice amount
- Department
- Manager approval requirement
Any combination of these criteria can be used to determine the approval flow.
Your task is to implement the workflow logic shown in Figure 1 below:
Figure 1: Invoice Approval Workflow
While you could hardcode all the conditions, we're looking for a flexible, dynamic design that would allow the workflow to be modified without code changes. You don't need to implement the UI for updating workflows, but your architecture should support it.
Please provide the following:
Design a database schema to support workflow configuration and execution.
- You may include a visual diagram (JPEG or similar) in your README
- No need to implement the actual database—in-memory structures are fine for this exercise
Implement the workflow shown in Figure 1 with an HTTP endpoint:
- Input fields: invoice amount, department, manager approval flag
- Output: Return the approval routing results (which approvers were selected)
- Notifications: For this exercise, simply print
"sending approval via Slack"to the console instead of implementing actual notification logic
Create a basic interface to call your endpoint and execute the workflow.
- Assume all amounts are in USD (no currency conversion needed)
- Feel free to document any real-world considerations or improvements in your README
We have included a basic Kotlin backend setup with placeholders for your implementation. You are welcome to use a different structure or language — any object-oriented language is acceptable, though statically typed languages are preferred.
cd backend
./gradlew clean build
./gradlew runcd app
npm install
npm run ios- Create a bundle:
git bundle create challenge-<your-name>.bundle --all - Send us the generated bundle file
We look forward to seeing your solution! If you have any questions, please don't hesitate to reach out.
