Skip to content

Latest commit

 

History

History
49 lines (32 loc) · 1.37 KB

README.md

File metadata and controls

49 lines (32 loc) · 1.37 KB

Consume Tinybird API Endpoints in Next.js with JWTs

This repo contains a minimal example demonstrating:

  1. Generating self-signed JWTs for Tinybird
  2. 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.

Run the example locally

Prerequisites

Install dependencies

Install app dependencies. From the root of the repo:

pnpm install

Add your Tinybird parameters

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 the demo app

Run it locally:

pnpm run dev

Then open http://localhost:3000 with your browser.