Skip to content
All work

Open source · 2024

tinyqueue

A job queue for edge functions that fits in 4 kB, with retries, delays and no server to run. 2,400 stars and used in production by teams I've never met.

Client
Open source
Role
Author and maintainer
Year
2024
Stack
  • TypeScript
  • PostgreSQL
  • Deno
  • GitHub Actions
A dark code editor on a laptop showing a short TypeScript example that adds a job to a queue, beside a terminal with green test results.

The brief

Every project I built needed a few background jobs (send this email in ten minutes, retry that webhook) and every queue I found wanted its own server. tinyqueue keeps jobs in the Postgres you already have and runs them from your edge functions.

What made it hard

  • No server and no extra service
  • At-least-once delivery, and honest about it
  • Small enough to read in an afternoon

Results

Size, minified and gzipped
After: 4 kB
GitHub stars
After: 2,400
Weekly downloads
After: 31,000
Open issues
After: 6

How it was built

tinyqueue started as forty lines in a client project and grew because other people kept asking for it.

Jobs in the database you have

A job is a row. Workers claim rows with FOR UPDATE SKIP LOCKED, so two functions never take the same job, and a job that isn’t finished in time goes back to the queue. No Redis, no broker, no dashboard to keep alive.

Small, and staying small

The library has one rule: it must fit in 4 kB. Every feature request is weighed against it, which has made for better features and a lot of polite no’s.

Ask about my work

Services, prices, projects and availability

Hi! Ask me what Mara builds, roughly what it costs, how a project runs or when she's free.

Accent

Get itGet this template: Kernel on WPTom