This is an example application highlighting the StarbaseDB REST API being utilized in NextJS 15.
- Create a
.env
file at the root level of the project - Insert the following contents into the file, filling in your details
API_BASE_URL=https://YOUR-IDENTIFIER.outerbase.workers.dev API_TOKEN=INSERT_CLIENT_TOKEN
For this project example to work as-is, you will need to run the below SQL statement on your StarbaseDB instance to create a friends
table with some rows included.
CREATE TABLE IF NOT EXISTS friends ( id INTEGER PRIMARY KEY, name TEXT NOT NULL ); INSERT INTO friends (id, name) VALUES ('1', 'George'); INSERT INTO friends (id, name) VALUES ('1', 'Annie'); INSERT INTO friends (id, name) VALUES ('1', 'Susan'); INSERT INTO friends (id, name) VALUES ('1', 'Frank');
First, run the development server:
npm run dev # or yarn dev # or pnpm dev # or bun dev
Open http://localhost:3000 with your browser to see the result.