Project Setup
We will use C3 (create-cloudflare-cli) command-line tool to create our functions. You can open a new terminal window and run C3 using the prompt below.create-cloudflare package, and lead you through setup. C3 will also install Wrangler in projects by default, which helps us testing and deploying the projects.
3. Use QStash in your handler
First we import the library:src/index.ts
Env interface to include the QSTASH_CURRENT_SIGNING_KEY
and QSTASH_NEXT_SIGNING_KEY environment variables.
src/index.ts
handler function.
First we create a new receiver and provide it with the signing keys.
src/index.ts
src/index.ts
src/index.ts
Configure Credentials
There are two methods for setting up the credentials for QStash. The recommended way is to use Cloudflare Upstash Integration. Alternatively, you can add the credentials manually.Using the Cloudflare Integration
Access to the Cloudflare Dashboard and login with the same account that you’ve used while setting up the Worker application. Then, navigate to Workers & Pages > Overview section on the sidebar. Here, you’ll find your application listed.


Setting up Manually
Navigate to Upstash Console and copy/paste your QStash credentials towrangler.toml as below.
Test and Deploy
You can test the function locally withnpx wrangler dev
Deploy your function to Cloudflare with npx wrangler deploy
The endpoint of the function will be provided to you, once the deployment is done.