
Template details
Python Queue Subscribers Starter
Deploy Python background tasks using Vercel Queues. FastAPI example with queue subscribers and Runtime Cache.
About this template
Python Queue Subscribers + Vercel is a boilerplate example from the official Vercel examples repository that demonstrates how to build Python background workers with Vercel Queues, using FastAPI for the web layer and sharing task results through Vercel Runtime Cache.
What is Python Queue Subscribers + Vercel?
Python Queue Subscribers + Vercel is a runnable example application that shows how to implement queue subscribers in Python on the Vercel platform. It accepts HTTP requests from a dashboard, publishes addition and multiplication tasks with vercel.queue.send, processes those tasks in subscribers defined in tasks.py, and stores the results in SQLite during local development or Vercel Runtime Cache when deployed. The project lives in the Vercel examples GitHub repository under python/queue-subscribers and is maintained by Vercel.
What makes it stand out?
This example stands out because it combines several Vercel-specific services in a small Python application:
- FastAPI web app — the entire backend is built with FastAPI, a modern ASGI framework for Python.
- Vercel Queues integration — tasks are sent to
addandmultiplytopics viavercel.queue.send. - Declarative subscriber config —
pyproject.tomlpoints the queue subscriber totasks.py, where decorated handlers process messages. - Dual result storage — results are stored in a local SQLite file during development and Vercel Runtime Cache when deployed, so the same code works in both environments.
- Interactive dashboard — the example includes a UI that polls for each task until its result is available, giving immediate feedback.
- One-click deployment — a deploy button lets you clone and deploy this project directly to Vercel with a live demo at
python-queue-subscribers.labs.vercel.dev.
Who is this template for?
Python developers who want to learn how to use Vercel Queues with a real codebase will find this example useful. It's also suited for teams building serverless background-job systems who need a reference implementation with FastAPI. Finally, Vercel users who want to understand Runtime Cache and queue-based task processing can study this minimal but complete starter.
What can you do with it?
- Learn queue-based architecture: Read how the FastAPI app publishes tasks and how subscribers in
tasks.pyconsume them fromaddandmultiplytopics. - Deploy a working serverless worker: Use the one-click Vercel deploy button to put a live background-processing app online in minutes.
- Run locally: Install the Vercel CLI, run
vercel dev, and the app is available athttp://localhost:3000. - Extend with new tasks: Add new topics and handlers in
tasks.pyto process other types of background work.
How does it work?
The dashboard sends requests to the FastAPI app, which calls vercel.queue.send to publish jobs to the add and multiply topics. The subscriber process, configured in pyproject.toml and implemented in tasks.py, receives each message and executes the corresponding handler. Task results are written to SQLite during local development or Vercel Runtime Cache in production, and the dashboard polls until results appear.
FAQ
How do I run this project locally?
Install the Vercel CLI with npm i -g vercel, then run vercel dev in the project directory. The application will be available at http://localhost:3000.
Can I deploy it to Vercel?
Yes, the repository includes a one-click deploy button that clones the python/queue-subscribers example into your Vercel project, sets a demo URL, and deploys it.
What is Vercel Runtime Cache?
Vercel Runtime Cache is a lightweight caching mechanism provided by Vercel to share data between serverless function invocations. In this example it stores the results of processed queue tasks when the app is deployed.
Which Python framework does it use?
The example uses FastAPI, a modern web framework for Python. It is not tied to any frontend framework; the dashboard is a simple HTML page.
What are the queue topics?
The example defines two topics: add for addition tasks and multiply for multiplication tasks. Each topic has a corresponding handler in tasks.py that processes the published messages.














