Skip to main content

Quickstart

Get your app connected to NaijaBase in 5 minutes.

Step 1 — Create an account

Go to app.naijabase.dev/signup and create a free account. No credit card required.

Step 2 — Create a project

Click + New project, give it a name, and click Create. Your PostgreSQL database is ready in seconds.

Step 3 — Get your credentials

On your project page, go to the API tab and copy:

  • Project URL — e.g. https://api.naijabase.dev/v1/abc123
  • API Key — your anon/public key

Step 4 — Install the SDK

npm install @naijabase/js

Step 5 — Initialize the client

import { createClient } from '@naijabase/js'

const naijabase = createClient(
'https://api.naijabase.dev/v1/YOUR_PROJECT_ID',
'YOUR_ANON_KEY'
)

Step 6 — Query your database

const { data, error } = await naijabase
.from('users')
.select('*')

if (error) console.error(error)
console.log(data)

Step 7 — Insert data

const { data, error } = await naijabase
.from('products')
.insert({ name: 'Ankara Fabric', price: 5000 })

That's it. Your data is now stored in Lagos, Nigeria. 🇳🇬

Next steps