Production-style Python/FastAPI backend for employee expense approvals, risk-based routing, decision audit trails, and idempotent workflow operations.
- FastAPI + SQLAlchemy backend with service/repository architecture
- Real workflow state machine: draft, pending manager, pending finance, pending director, approved, rejected, changes requested
- Idempotent expense creation to prevent duplicate submissions
- Risk scoring and approval routing based on claim amount and suspicious text
- Audit trail for every workflow decision
- Request timing middleware, structured JSON logging, Docker, CI, and Pytest coverage
flowchart LR
Draft --> Submitted["pending_manager"]
Submitted --> Finance["pending_finance"]
Finance --> Director["pending_director"]
Submitted --> Approved
Finance --> Approved
Director --> Approved
Submitted --> Rejected
Finance --> Rejected
Director --> Rejected
curl -X POST http://localhost:8000/api/v1/expenses \
-H "Content-Type: application/json" \
-d '{"employee_id":"E100","department":"Operations","amount":2500,"description":"Client travel","idempotency_key":"claim-001"}'curl -X POST http://localhost:8000/api/v1/expenses/{claim_id}/decisions \
-H "Content-Type: application/json" \
-d '{"actor_id":"M1","actor_role":"manager","action":"approve","comment":"Approved"}'python3 -m venv .venv
source .venv/bin/activate
make install
make test
make devSwagger UI: http://localhost:8000/docs
This project mirrors a real internal enterprise workflow platform: business rules, state transitions, auditability, idempotency, persistence, APIs, and tests. It is designed to be explainable in interviews while still showing backend engineering maturity.