I built this delivery dispatch service to practice and master core backend engineering fundamentals in NestJS. Instead of just building a basic CRUD API, I wanted to understand how real-world dispatch systems manage state transitions, handle route assignments, and keep data consistent under concurrent requests.
The backend is engineered with NestJS, TypeORM, and PostgreSQL running inside Docker containers. To handle state protection, I implemented concurrency guards that intercept duplicate route acceptance requests and immediately throw an HTTP 409 Conflict exception before any invalid state mutation reaches the database.
To streamline my testing workflow without manually dropping database schemas, I also built a Node.js automation script (scripts/clear-db.js) that pipes dynamic SQL queries straight into the Docker container via IPC streams.
In the video, I walk through the route acceptance logic, demonstrate how the HTTP 409 conflict guard blocks duplicate claims, and run a live demo of the automated database reset in action.
Check out the video below to watch the full walkthrough in action. If you enjoy the demo, please give the video a like and leave a comment with your thoughts!
Top comments (2)
Great demo! Curious... under the hood, are you using TypeORM's @VersionColumn for optimistic locking to trigger that 409, or doing a direct status check before updating? Keep up the good work.
Clean walkthrough. Throwing an explicit 409 Conflict instead of letting quiet state overwrites pass in the background is such an underrated practice. Solid engineering Peace 👏