Use Supra with Next.js
Learn how to create a Supra project, add some sample data to your database, and query the data from a Next.js app.
Set up a Supra project with sample data
Create a new project in the Supra Dashboard.
After your project is ready, create a table in your Supra database using the SQL Editor in the Dashboard.
Use the following SQL statement to create a countries table with some sample data.
Create a Next.js app
Use the create-next-app command and the with-supra template, to create a Next.js app pre-configured with:
Declare Supra Environment Variables
Rename .env.local.example to .env.local and populate with your project's URL and Anon Key.
Query Supra data from Next.js
Create a new file at app/countries/page.tsx and populate with the following.
This will select all the rows from the countries table in Supra and render them on the page.
Start the app
Run the development server, go to http://localhost:4000/countries in a browser and you should see the list of countries.