Quick start
From clone to running dev server in under 60 seconds.
Prerequisites
- Node.js 18.17 or later
- npm, yarn, or pnpm
- A Resend account (free tier works)
- An Upstash Redis database (free tier works)
- Your chosen database credentials (MongoDB Atlas / Supabase / Firebase)
1. Clone the repo
terminal
git clone https://github.com/Talhaahmad9/nextforge.git my-project cd my-project
2. Choose your database
Run the interactive setup script. This is a one-time operation.
terminal
node setup.mjs
The script presents:
terminal
┌──────────────────────────────────────────┐ │ NextForge - Database Setup │ └──────────────────────────────────────────┘ Which database backend do you want to use? 1) MongoDB (Mongoose) 2) Supabase (PostgreSQL) 3) Firebase (Firestore) Enter 1, 2, or 3: _
The script will:
- Copy the correct database files into place
- Remove unused variant dependencies from
package.json - Generate a
.env.local.examplewith only the env vars you need - Delete
_variants/andsetup.mjsitself - leaving a clean standard Next.js project
Run setup.mjs before npm install
setup.mjs patches package.json to remove unused database dependencies. If you run npm install first, you'll install packages for all three database variants unnecessarily.
3. Install dependencies
terminal
npm install
4. Configure environment variables
terminal
cp .env.local.example .env.local
Open .env.local and fill in your values. See the Environment variables reference for the complete list.
Generate AUTH_SECRET with:
terminal
openssl rand -base64 32
Never commit .env.local
.env.local is in .gitignore by default. Never remove it from .gitignore. Never hardcode secrets in source files.
5. Supabase only - run the schema
Skip this section if you chose MongoDB or Firebase.
- Open your Supabase project dashboard
- Navigate to SQL Editor
- Paste the contents of
lib/db/schema.sql - Click Run
schema.sql creates the users and otps tables with the correct columns, indexes, and an optional pg_cron cleanup job for expired OTPs.
6. Start the dev server
terminal
npm run dev
Open http://localhost:3000. The /register, /login, /verify-email, /forgot-password, and /reset-password routes are all live.