OneBitDeploy

Quickstart: Next.js + Postgres + .ng

Get from zero to a live Next.js app with a managed Postgres database and a .ng domain on OneBit — for most developers this takes under 15 minutes.

Get from zero to a live app with a database and a .ng domain on OneBit — for most developers this takes under 15 minutes.

Before you start: You need an OneBit account. Register & Deploy (₦) → deploy.onebit.ng/register

1. Get your Next.js project ready

Start from your own Next.js app on GitHub (or a new one from npx create-next-app@latest, pushed to a GitHub repository). Add the pg package (npm install pg) and a health route that checks the database, at app/api/health/route.ts:

import { Pool } from "pg";

export const dynamic = "force-dynamic";

const pool = new Pool({ connectionString: process.env.ONEBIT_DATABASE_URL });

export async function GET() {
  try {
    await pool.query("select 1");
    return Response.json({ status: "ok", db: "connected" });
  } catch {
    return Response.json({ status: "error", db: "unreachable" }, { status: 500 });
  }
}

List the key in a .env.example (ONEBIT_DATABASE_URL=, no value) so the next person knows it is needed, then commit and push.

2. Create a managed Postgres database

  1. Sign in at deploy.onebit.ng. You land on Apps in the console at code.onebit.ng
  2. Press Add app, then, under "Need a database or WordPress?", press Add database (databases come with the Hobby and Enterprise plans; on another plan the page says so and links to See plans)
  3. Under Engine choose PostgreSQL, give it a Name, keep the Version and press Create database

PROVISIONING DATABASE — this usually takes 30–60 seconds. Open the database from Apps; its page shows Running when it's ready.

  1. Open the database. Under Connection, copy All of it as one line (what most tools call a connection URL) (format: postgres://...). This is your ONEBIT_DATABASE_URL.

3. Add your database secret to the panel

  1. On Apps, open your app (if it is not there yet, add it first as in step 4 below; the key belongs to the app)
  2. Open its Environment tab
  3. Under Add variable: Name ONEBIT_DATABASE_URL, Value the connection string you copied, then press Add
  4. Saving restarts the app so it picks the value up.

Note: Never commit your ONEBIT_DATABASE_URL to git. Keep .env.example to the name only, with no value.

4. Push to deploy

Connect your repo to OneBit push-to-deploy:

  1. On Apps, press Add app and open the GitHub account tab
  2. Press Connect GitHub and let OneBit see your project's repository
  3. Pick that repo, choose main under Branch, press Use this project, then Deploy
  4. From then on, push any commit to main and it goes online by itself

DEPLOYING APP — this can take up to 90 seconds. The app page shows each step, and the build log is on its Logs tab under Build. Live confirms the deploy succeeded.

Your app will be live at the free web address shown on the app's Overview, under Domains.

5. Claim or purchase a .ng domain and point it to your app

  1. In the console, open Domains
  2. Under Register a domain, type your desired name (e.g. myapp), pick the ending (e.g. .com.ng) and press Search
    • If it is free, press Get it and pay in naira on the domain shop that opens, then come back to Domains
    • If you already own the domain somewhere else, press Connect domain and copy the lines it shows into your current provider
  3. Open the name and press Set target, then pick your app. OneBit issues the SSL certificate (SSL) by itself

CONFIGURING DOMAIN — DNS propagation can take 1–5 minutes. The name's page shows how far it is under Is it working yet?; press Check again to look again.

  1. Once the name shows Working, your app is live at your .ng address. 🎉

Verify your deploy

Open https://yourdomain.ng/api/health in a browser. You should see:

{ "status": "ok", "db": "connected" }

If you see an error, check:

  • ONEBIT_DATABASE_URL is set correctly on the app's Environment tab
  • The database's page (open it from Apps) shows Running

What's next?

  • Add more API routes in app/api/
  • Reach the database from a laptop tool: on its page, under Use it from a laptop or another tool, press Enable external access (there are no automated backups yet, so export important data yourself)
  • Share your .ng link — tag @OneBitNG

Note on billing flows: Any Paystack or payment steps are not synthetically verified in this quickstart — test those flows in your own environment before going live.


Register & Deploy (₦) → deploy.onebit.ng/register

On this page