0
showcase
Shipped: A service with a job running behind it
### Project Overview
I built an asynchronous Background Job Processing Service using Node.js, Express, MySQL (TiDB Cloud Serverless with TLS/SSL), and deployed it to Render.
The architecture consists of:
1. REST API Server: Accepts job requests, validates authentication, enforces user scoping, and guarantees idempotency.
2. Background Worker: Polls pending tasks from the database, executes the job asynchronously, tracks attempt limits, and updates the status upon completion.
3. Persistent Database: Managed TiDB Cloud database storing jobs, idempotency keys, execution statuses, and timestamps.
---
### How to Test and Verify Acceptance Criteria
Base URL:
https://final-project-5nyu.onrender.com
Auth Token: supersecrettoken123
#### 1. Submit a New Job (POST /jobs)
Run the following curl command to submit a background job:
```bash
curl -X POST https://final-project-5nyu.onrender.com/jobs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer supersecrettoken123" \
-H "x-user-id: user_101" \
-d '{"idempotencyKey": "demo-key-001"}'
Expected Output: Returns HTTP 202 with jobId and status: "pending".
2. Check Job Status (GET /jobs/:id)
Allow 1-2 seconds for the worker to process the job, then retrieve the status:
Bash
curl -X GET https://final-project-5nyu.onrender.com/jobs/1 \
-H "Authorization: Bearer supersecrettoken123" \
-H "x-user-id: user_101"
Expected Output: Returns HTTP 200 with status: "completed" and execution details (processedAt).
3. Test Idempotency (Duplicate Prevention)
Re-run the exact same POST request with the same idempotencyKey:
Bash
curl -X POST https://final-project-5nyu.onrender.com/jobs \
-H "Content-Type: application/json" \
-H "Authorization: Bearer supersecrettoken123" \
-H "x-user-id: user_101" \
-d '{"idempotencyKey": "demo-key-001"}'
Expected Output: Returns HTTP 200 with the existing jobId and message "Job already registered" without creating a duplicate record.
4. Test Authentication & User Isolation
Missing/invalid Authorization header returns HTTP 401 Unauthorized.
Missing x-user-id header returns HTTP 401 Missing user identity.
Repository: https://github.com/roh155/final_project
Live: https://final-project-5nyu.onrender.com
Built for the Verified Backend Internship · Final projectAdd a comment
0/2000