This repo contains a minimal example demonstrating:
- Generating self-signed JWTs for Tinybird
- Consuming Tinybird API Endpoints in a Next.js frontend app using a self-signed JWT
You can read more about JWTs in Tinybird in the documentation, and there is a full end-to-end guide covering this example.
- Node.js >= v18
- A free Tinybird account
- Deploy the Tinybird resources to a Tinybird Workspace
Install app dependencies. From the root of the repo:
pnpm install
First create a new file .env.local
cp .env.example .env.local
You need to copy your Tinybird host and token to the .env.local
file in your directory:
TINYBIRD_SIGNING_TOKEN="YOUR SIGNING TOKEN" # Use your Admin Token as the signing token
TINYBIRD_WORKSPACE="YOUR WORKSPACE ID" # The UUID of your Workspace
NEXT_PUBLIC_TINYBIRD_HOST="YOUR API HOST. E.G. https://api.tinybird.co" # Your regional API host
Run it locally:
pnpm run dev
Then open http://localhost:3000 with your browser.