Create Kafka
First, create an Upstash Kafka cluster and topic following those steps. You will need the endpoint, username and password in the following steps.
Create Project
We will use Wrangler to create the application. After installing and configuring wrangler, create a folder for your project inside the folder run:wrangler init
It will create wrangler.toml
. Paste your account id to the toml which is
logged by wrangler.
Copy and paste the Upstash Kafka URL, topic name, username and password to the
toml.
Implement the Function
Init a node project and install @upstash/kafka:Run and Deploy the Function
Run the function locally:wrangler dev
Deploy your function to Cloudflare by running: