GitHub Repository
You can find the project source code on GitHub.
Prerequisites
- An Upstash QStash API key.
- Node.js and npm (or another package manager) installed.
- Python and pip installed.
Step 1: Setup
Clone the Next.js & Flask example:Step 2: Installation
Create a virtual environment and activate it:Terminal
Step 3: Configure Environment Variables
Create a.env
file in your project root and add your QStash token. This token is used to authenticate your application with the QStash service.
Terminal
Option 1: Local QStash Server
To start the local QStash server, run:QSTASH_URL
and QSTASH_TOKEN
values in the console. Add these values to your .env
file:
.env
Option 2: Local Tunnel
Alternatively, you can set up a local tunnel. For this option:- Copy the
QSTASH_TOKEN
from the Upstash Console. - Update your
.env
file with the following:
.env
- Replace
***
with your actual QStash token. - Set
UPSTASH_WORKFLOW_URL
to the public URL provided by your local tunnel.

Step 4: Start the Development Server
Upstash Workflow is powered by QStash, and QStash needs a publicly accessible URL to run your workflows. Here’s how to set up your workflow endpoint for local development. In a nutshell, in local development, you can either use the QStash development server or use a local tunnel to make your workflow endpoint publicly accessible. Don’t forget to source your environment file to set your environment variables:Terminal

Step 5: Deploying the Project at Vercel
To deploy the project at vercel and try the endpoints, you should start with setting up the project by running:Terminal
QSTASH_TOKEN
, to the project as environment variables. You can find this env variables from the Upstash Console. To learn more about other env variables and their use in the context of Upstash Workflow, you can read the Secure your Endpoint in our documentation.
Once you add the env variables, you can deploy the project with:
Terminal
Next Steps
- Learn how to protect your workflow endpoint from unauthorized access by securing your workflow endpoint.
- Explore the source code for a detailed, end-to-end example and best practices.
- For setting up and testing your workflows in a local environment, check out our local development guide.