0
showcase
Shipped: A service with a job running behind it
I built and deployed an asynchronous digest service using Node.js, Express.js, MongoDB Atlas, Mongoose, JWT, bcryptjs, Zod, and JavaScript-based background workers. The API authenticates users, isolates user-owned data, accepts digest requests asynchronously, and returns "202 Accepted" without waiting for the background work to finish. Digest jobs are stored in MongoDB and processed by a separate worker with idempotency, retry handling, stale-job recovery, and actionable error states. The service also uses an in-memory cache for completed digest responses.
The application code is pushed to GitHub, the API server is deployed on Render, the background worker is deployed as a separate Render Background Worker, and the database is deployed on MongoDB Atlas. The API has been fully tested with Postman, and the complete Postman collection is included in the GitHub repository so the reviewer can import it and test the endpoints directly.
How the reviewer can verify the acceptance criteria
● Deployed and reachable: Open the deployed Render API URL and call "/health". The GitHub repository is linked in the project documentation.
● Request returns without waiting: Send "POST /api/v1/digests" with valid authentication and an "Idempotency-Key". The API immediately returns "202 Accepted", while the separate Render background worker processes the job afterward.
● Safe to run twice: Send the same digest request again using the same "Idempotency-Key". The existing digest is returned instead of creating a duplicate.
● Worker failure handling: The README documents the "QUEUED → PROCESSING → COMPLETED/FAILED" lifecycle, retry attempts, stale-job recovery, and what happens if the worker dies during processing.
● Authentication: Call a protected endpoint without an "Authorization" header. The API returns "401 Unauthorized".
● User isolation: Digest and event queries are scoped to the authenticated user's ID, preventing one user from reading another user's records.
● Actionable errors: The API returns structured "400", "401", "404", "409", and "500" responses with machine-readable error codes and human-readable messages.
● Caching: Completed digest responses are cached in application memory for 60 seconds, with MongoDB remaining the source of truth.
● No committed secrets: ".env" is excluded through ".gitignore".
● API testing: The included Postman collection contains the complete authentication, protected-route, event, digest, retry, and health-check flows and can be imported directly by the reviewer.
Repository: https://github.com/abbasg-dev/async-digest-service
Live: https://async-digest-service.onrender.com
Built for the Verified Backend Internship · Final project
Add a comment
0/2000