The challenge
Run background work with clear delivery guarantees, controlled concurrency and failure recovery, without adding infrastructure beyond the database.
The solution
A persistent queue in PostgreSQL itself with FOR UPDATE SKIP LOCKED, multi-process workers and a web dashboard to create, track and reprocess tasks.
Main features
- Queues with priorities, scheduling and per-queue concurrency limits.
- Idempotency key, exponential backoff retries, timeout and lease-based heartbeat.
- Recovery of abandoned tasks, dead-letter queue (DLQ) and controlled reprocessing.
- Execution history, structured logs, role-based users and organization isolation.
- Documented API (OpenAPI) and a responsive dashboard.
Architecture
Node and TypeScript API, React dashboard and PostgreSQL as both queue and database. Delivery is at least once (at-least-once); effect idempotency depends on the handler, and that is documented.
- React dashboard
- Node + TypeScript API
- PostgreSQL queue (SKIP LOCKED)
- Multi-process workers
Decisions and lessons
- Postgres as the only queue infrastructure reduces moving parts without giving up safe concurrency.
- The stated guarantee is at-least-once; exactly-once is not promised.
- Only predefined, safe task types run; no arbitrary code executes on the platform.
Scope and limitations
The public demo uses sample data, which is restarted periodically. The first request after an idle period can take longer. Details are documented in the repository.
Availability
- Source code
- Public
- Demo
- Available
- Case study
- Unavailable
- Status
- Online demo
Context and problem
Systems need to run background work: reports, integrations and heavy routines. SyncFlow covers that with a persistent queue in PostgreSQL, scalable workers and an operations dashboard, without requiring Redis or RabbitMQ.
How it works
- Task created on the dashboard or API
- PostgreSQL queue
- Worker runs with lease and heartbeat
- Result, retry or DLQ
Business rules
- At-least-once delivery; effect idempotency depends on the handler.
- Only predefined, safe task types; no arbitrary code runs.
- Organization isolation and roles: owner, admin, operator and reader.
Technical challenges and solutions
- Challenge: Safe concurrency without extra infrastructure. Solution: FOR UPDATE SKIP LOCKED in PostgreSQL as the single queue mechanism.
- Challenge: Recovering abandoned tasks. Solution: Lease-based heartbeat with automatic requeue of stuck tasks.
Security and privacy
- Role-based users and organization isolation.
- API keys and minimal scope in the public demo.
- Predefined task types; no arbitrary code.
Tests and evidence
- Unit and integration tests with real PostgreSQL, including abrupt worker termination (kill -9), and reproducible performance experiments documented in the repository.
Lessons learned
- A mature relational database covers more queue use cases than common practice suggests.
- Stating the real guarantee (at-least-once) avoids promises the system cannot keep.
Current status
Public demo with sample data, restarted periodically. The first request after an idle period can take longer.
Documented evidence
- Public demo with operator and reader accounts, published in the README
- Unit and integration tests with real PostgreSQL and reproducible experiments
- Real dashboard captures on desktop and mobile in the repository