Skip to content

Latest commit

 

History

History
77 lines (55 loc) · 1.25 KB

File metadata and controls

77 lines (55 loc) · 1.25 KB

Usage Guide

1) Start the service

  1. Install dependencies:
    • pnpm install
  2. Start local dependencies (MongoDB and Redis).
  3. Run the API:
    • pnpm run watch

The API is available on http://localhost:3000

2) Main API flow

Create a batch

POST /api/documents/batch

Request: { "userIds": ["user_1", "user_2", "user_3"] }

Response: { "batchId": "...", "status": "pending", "totalDocuments": 3, "createdAt": "..." }

Track a batch

GET /api/documents/batch/{batchId}

You receive global progress and document-level statuses.

Download a PDF

GET /api/documents/{documentId}

Returns application/pdf when ready.

3) Observability endpoints

  • GET /health
    • returns dependency checks for database, redis, queue
  • GET /metrics
    • returns Prometheus format metrics

4) OpenAPI

Specification file:

  • docs/openapi.yaml

Swagger UI:

Use it with:

  • Swagger Editor (import file)
  • Swagger UI (serve file statically)
  • Postman (import OpenAPI)

5) Runtime configuration

Important variables:

  • PORT
  • MONGO_URI
  • REDIS_URL
  • WORKER_CONCURRENCY
  • JOB_ATTEMPTS
  • JOB_BACKOFF_DELAY_MS
  • PDF_TIMEOUT_MS
  • DOCUSIGN_SIMULATION_ENABLED
  • DOCUSIGN_FAILURE_RATE
  • DOCUSIGN_FAILURE_THRESHOLD
  • DOCUSIGN_RESET_TIMEOUT_MS