Skip to main content

Frontend Hosting

NaijaBase Sites lets you deploy your frontend — static HTML, React, Next.js, Vue, or Nuxt — directly to Lagos.

No Vercel. No Netlify. No USD bills.

Quick start

  1. Go to your project dashboard
  2. Click Sites in the sidebar
  3. Click New Site
  4. Enter your GitHub repo (format: username/repo)
  5. Select your framework
  6. Click Create
  7. Click Deploy

Your site is live at:

yoursitename.sites.naijabase.dev

Option 2 — Zip upload

  1. Build your site locally:
npm run build
  1. Zip the output folder:
# React/Vite
zip -r site.zip dist/

# Next.js static
zip -r site.zip out/

# Plain HTML
zip -r site.zip index.html
  1. Go to Sites → your site → Settings tab
  2. Upload the zip file
  3. Click Upload and Deploy

Framework presets

FrameworkBuild commandOutput directory
Static HTML.
React / Vitenpm run builddist
Next.jsnpm run buildout (static) or auto-managed (SSR)
Vuenpm run builddist
Nuxtnpm run build.output/public
Node.jsoptional npm run build— (server process)

Node.js Apps (Express, Fastify, custom)

Deploy any Node.js HTTP server to Lagos.

Requirements

Your app must listen on process.env.PORT:

// Express
const port = process.env.PORT || 3000
app.listen(port, '0.0.0.0', () => {
console.log(`Server running on port ${port}`)
})

// Fastify
await fastify.listen({
port: process.env.PORT || 3000,
host: '0.0.0.0'
})

Your package.json must have a start script:

{
"scripts": {
"start": "node server.js"
}
}

Deploy

  1. Select framework: Node.js
  2. Connect your GitHub repo
  3. Click Deploy

NaijaBase installs dependencies, runs npm run build if a build script exists, starts your app with PM2, assigns a port automatically, and configures Nginx with SSL.

Build logs:

[NaijaBase] Installing dependencies...
[NaijaBase] Starting Node.js app on port 41xx...
[NaijaBase] Node.js app deployed on port 41xx ✓

PORT is injected automatically — do not hardcode it.


Next.js

NaijaBase supports both Next.js modes — static export and SSR — detected automatically at deploy time.

Static export

Add output: 'export' to your config:

// next.config.js
module.exports = {
output: 'export',
}

The built out/ directory is served by nginx directly.

Server-Side Rendering (SSR)

No configuration needed. If your next.config.js does not have output: 'export', NaijaBase detects SSR automatically and:

  1. Adds output: 'standalone' to your config during build
  2. Runs npm run build to produce .next/standalone/
  3. Starts a Node.js server process managed by PM2
  4. Configures nginx to proxy requests to that process
// next.config.js — no output: 'export' means SSR
module.exports = {
// your existing config
}

SSR sites support dynamic routes, API routes, server components, and getServerSideProps.

Build logs show:

[NaijaBase] Installing dependencies...
[NaijaBase] Building Next.js app (standalone)...
[NaijaBase] Next.js SSR started on port 41xx
[NaijaBase] SSR site deployed ✓

Environment variables

Add environment variables in Sites → your site → Settings → Environment Variables.

They are injected as .env at build time:

// In your React app
const apiUrl = import.meta.env.VITE_API_URL
const anonKey = import.meta.env.VITE_ANON_KEY
# In Settings → Environment Variables:
VITE_API_URL = https://api.naijabase.dev/projects/YOUR_PROJECT_ID/rest/v1
VITE_ANON_KEY = nb_anon_xxxx

Private GitHub repositories

Add your GitHub personal access token as an environment variable:

Key: GITHUB_TOKEN
Value: github_pat_xxxxxxxxxxxx

Get a fine-grained token at: github.com → Settings → Developer Settings → Fine-grained tokens → Contents: Read-only

The token is never shown in build logs and is excluded from your built app.

Custom domains

Connect your own domain to NaijaBase Sites:

1. Add a CNAME record at your DNS provider:

TypeNameValueTTL
CNAME@ or wwwyoursite.sites.naijabase.dev300

2. Connect in the dashboard:

  1. Go to Sites → your site → Domains tab
  2. Enter your domain
  3. Click Verify and Connect
  4. NaijaBase checks DNS and issues SSL automatically

Your domain is live with SSL in ~2 minutes.

Plan requirement

Custom domains require the Growth plan (₦25,000/month) or above.

Deploying with a NaijaBase backend

Connect your NaijaBase backend to your hosted frontend using environment variables:

# In Sites → Settings → Environment Variables:
NEXT_PUBLIC_NAIJABASE_URL = https://api.naijabase.dev/projects/YOUR_PROJECT_ID
NEXT_PUBLIC_NAIJABASE_ANON_KEY = nb_anon_xxxx
// In your frontend app:
import { createClient } from '@naijabase/js'

const naijabase = createClient(
import.meta.env.NEXT_PUBLIC_NAIJABASE_URL,
import.meta.env.NEXT_PUBLIC_NAIJABASE_ANON_KEY
)

const { data } = await naijabase
.from('products')
.select('*')

Backend and frontend — both in Lagos. Both in naira. Both NDPA compliant.

Monorepo support

For projects where your app lives in a subdirectory (e.g. server/, apps/api/):

  1. Set Root Directory in site settings:

    server

    (the path to the folder containing your package.json)

  2. NaijaBase runs all commands from that directory:

    • npm install
    • npm run build
    • npm start (or custom start command)

Custom start command

Override the default npm start with any command:

node dist/main.js
npx ts-node src/index.ts
node -r tsconfig-paths/register dist/main.js

Set it in Sites → your site → Settings → Start Command.

NestJS monorepo example

Settings:

Root Directory: server
Build Command: npm run build
Start Command: node dist/main.js
Install Command: npm install

Your server/package.json build script:

{
"scripts": {
"build": "nest build && npx prisma generate",
"start": "node dist/main.js"
}
}

Your app must listen on process.env.PORT:

// main.ts
async function bootstrap() {
const app = await NestFactory.create(AppModule)
await app.listen(process.env.PORT || 3000, '0.0.0.0')
}
bootstrap()

Build logs for a monorepo deploy:

[NaijaBase] Cloning duro1983/my-monorepo (branch: main)...
[NaijaBase] Using root directory: server
[NaijaBase] Installing dependencies...
[NaijaBase] Building app...
[NaijaBase] Starting with custom command: node dist/main.js
[NaijaBase] Node.js app deployed on port 41xx ✓

Build logs

Every deployment shows real-time build logs:

Sites → your site → Deployments → click any deployment → View Logs

[NaijaBase] Build started at 2026-07-24T12:00:00.000Z
[NaijaBase] Cloning username/repo (branch: main)...
$ git clone --depth 1 --branch main ...
[NaijaBase] Installing dependencies...
$ npm install
[NaijaBase] Building...
$ npm run build
[NaijaBase] Configuring web server...
[NaijaBase] Deployed in 33s ✓

Rollback

Every deployment is saved. Roll back to any previous version instantly:

Sites → your site → Deployments → click Rollback on any past deployment

Plan limits

PlanSitesCustom domains
Starter (₦0)1
Growth (₦25,000/mo)3
Scale (₦60,000/mo)10
Business (₦75,000/mo)Unlimited

NaijaBase Sites vs Vercel

FeatureVercelNaijaBase Sites
Hosting locationUSA / Global CDNLagos, Nigeria
BillingUSDFixed naira
NDPA compliantNoYes
Backend includedNo (separate)Yes (same platform)
Custom domainsYesYes (Growth+)
SSLYesYes (automatic)
Deploy from GitHubYesYes
Deploy from zipNoYes
Free tierYesYes