Backend MVP scaffold for multi-vendor, single-rider orchestration.
- Bun 1.2+
- PowerShell (for smoke test script)
- Redis (only if running BullMQ mode)
- PostgreSQL (only if running Prisma repository mode)
Copy .env.example to .env and update values.
cp .env.example .envImportant values:
ORDER_API_PORT=3000QUEUE_DRIVER=in-memoryorQUEUE_DRIVER=bullmqREPOSITORY_DRIVER=memoryorREPOSITORY_DRIVER=prismaDATABASE_URL=postgresql://postgres:postgres@localhost:5432/deliveryOSRM_ENABLED=trueOSRM_BASE_URL=https://router.project-osrm.orgOSRM_TIMEOUT_MS=10000(0disables timeout)OSRM_DISABLE_TIMEOUT=falseOSRM_HEALTH_RETRIES=3OSRM_HEALTH_RETRY_DELAY_MS=600OSRM_FAILURE_THRESHOLD=3OSRM_COOLDOWN_MS=60000OSRM_CACHE_TTL_MS=300000OSRM_MAX_CONCURRENT_REQUESTS=4OSRM_LOG_FAILED_ROUTE_URL=trueOSRM_LOG_SUCCESS_ROUTE_URL=trueREDIS_URL=redis://localhost:6379(required for BullMQ mode)VENDOR_MIN_CONFIDENCE=0.65
bun install
bun run dev- Queue driver (
bullmqorin-memory) - Repository driver (
prismaormemory) - Redis connection status (connected/ping/reconnect/error/closed)
- OSRM API availability
- OSRM route request logs (success/failure URL, coords, timeout, minutes/reason)
- Route planner logs (final stop sequence + rider map URL)
- Dispatch logs (final rider guidance payload)
GET /healthPOST /api/v1/ordersGET /api/v1/orders/:orderIdGET /api/v1/orders/:orderId/routePOST /api/v1/orders/:orderId/cancelGET /api/v1/users/:userId/routes
If you run many concurrent orders against the public endpoint (router.project-osrm.org), you can hit timeouts/rate limits.
This project throttles and caches OSRM estimates, logs route URLs, and falls back to local estimation during cooldown.
For heavy load tests, prefer your own OSRM server and set OSRM_BASE_URL to that instance.
bun run smoke:test