BACKEND – API DESIGN
GED – Document Management API
GED is a team project for ter-dig: a REST API for electronic document management, designed as a modular monolith. As the top contributor, I implemented user management endpoints, demo data seeding, and secured the cursor pagination (PR #11).

Modular monolith by feature
Each business module (auth, users, documents, uploads, OCR, administration) follows the same MVC separation — routes → controller → service → repository — with Zod schemas validating every input and output, typed domain errors, and OpenAPI documentation generated from the code.
Asynchronous OCR pipeline
The API never runs OCR inside the HTTP process. Uploads answer 202 Accepted immediately, then flow through BullMQ queues powered by Redis — ingestion → OCR → indexing → archive/notification — moving each document through RECEIVED → STORED → PROCESSING → INDEXED → READY statuses. Large files upload directly to MinIO via presigned URLs.
- 5 queues orchestrated with isolated BullMQ workers
- Tesseract.js OCR running in its own worker process
- SHA-256 checksums for idempotent uploads and duplicate detection
Security & reliability
Server-side sessions (argon2, HttpOnly cookies), CSRF protection, rate limiting, and strict multi-company isolation: the company scope always comes from the session, never from client input. Cursor pagination is HMAC-signed to prevent forgery (PR #11). Quality gates include vitest across unit, integration and e2e layers, dependency-cruiser boundaries, and commitlint with husky.
- HMAC-signed cursors with UTC validation (PR #11)
- Company scoping enforced in every repository query
- Idempotent database setup and demo seeding scripts