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 API keys
On your project page, go to the API tab. You'll find two keys:
Public (anon) key — use this in your frontend app:
const naijabase = createClient(PROJECT_URL, ANON_KEY)
Safe to include in browser and mobile code. RLS policies control what data users can access.
Secret (service) key — use this on your server only:
// Only in backend/server code — never in the browser
const adminClient = createClient(PROJECT_URL, SERVICE_KEY)
Bypasses RLS and has full database access. Never expose in frontend code.
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/projects/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. 🇳🇬
Ready-made templates
Skip the boilerplate. Use our pre-built integration templates for common Nigerian integrations:
- Paystack payments — accept naira with one click
- Flutterwave payments — multi-currency including NGN
- User authentication — signup, login, RLS policies
- SMS with Termii — send SMS to Nigerian numbers
- File uploads — store files in Lagos
- Real-time subscriptions — live database updates
Next steps
- Core Concepts — learn about projects, keys, and RLS
- Database — connect and query your database
- Authentication — add user sign-in to your app
- Storage — upload and serve files