Skip to content

outerbase/starbasedb-next-rest

Repository files navigation

This is an example application highlighting the StarbaseDB REST API being utilized in NextJS 15.

Step 1: Add Connection Details

  • 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

Step 2: Database Setup

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');

Run Project

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.

About

StarbaseDB example with REST API

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published