Skip to content

Getting Started

Prerequisites

  • Node.js >= 24 or Bun >= 1.3
  • MySQL / PostgreSQL / SQLite (pick one)
  • Redis (optional, for cache/session/queue/realtime)

Create a Project

Nexgen ships as a scaffolding CLI called create-nexgen. It downloads the latest stable template from npm and sets up a ready-to-run project.

bash
npm create nexgen@latest my-project
bash
pnpm create nexgen@latest my-project
bash
yarn create nexgen@latest my-project
bash
bun create nexgen@latest my-project

TIP

npx nexgen@latest my-project also works for npm users without the create prefix.

Setup

bash
cd my-project
cp .env.example .env
npm install
bash
cd my-project
cp .env.example .env
pnpm install
bash
cd my-project
cp .env.example .env
yarn install
bash
cd my-project
cp .env.example .env
bun install

Package Manager Setup

npm and bun work out of the box — no extra configuration needed.

pnpm

pnpm 11+ blocks install scripts by default. Create a pnpm-workspace.yaml in the project root:

yaml
allowBuilds:
  esbuild: true
  "@parcel/watcher": true
  msgpackr-extract: true
  redis-commander: true
  bcrypt: true

Alternatively, run pnpm approve-builds during install to approve them interactively.

Yarn

Yarn 4.14+ disables build scripts and uses PnP by default. Create a .yarnrc.yml in the project root:

yaml
nodeLinker: node-modules

Also add dependenciesMeta to your package.json to allow build scripts for required packages:

json
{
  "dependenciesMeta": {
    "esbuild": { "built": true },
    "@parcel/watcher": { "built": true },
    "msgpackr-extract": { "built": true }
  }
}

Without .yarnrc.yml, you'll also need to install peer dependencies explicitly (e.g. @asteasolutions/zod-to-openapi, @bull-board/ui, @popperjs/core).

Configure Database

Edit .env and set your DATABASE_URL:

bash
# MySQL
DATABASE_URL=mysql://root:password@localhost:3306/nexgen

# PostgreSQL
DATABASE_URL=postgres://user:password@localhost:5432/nexgen

# SQLite
DATABASE_URL=sqlite:./src/storage/database/nexgen.sqlite

Setup Database

bash
npm run maker -- db:migrate --seed
bash
pnpm maker db:migrate --seed
bash
yarn maker db:migrate --seed
bash
bun maker db:migrate --seed

This generates the schema from your model files, runs migrations, and seeds the database — all in one step.

Start Development

The dev command starts everything you need at once:

bash
npm run maker dev
bash
pnpm maker dev
bash
yarn maker dev
bash
bun maker dev

This starts:

ComponentCommandAuto-enabled
API servermaker serve --srcAlways
Vue 3 UI (HMR)maker ui:devUnless UI=false
Queue worker (default + mail)maker queue:workUnless REDIS=false

All URLs are printed in the console when the dev server starts:

  • http://localhost:3000 — API server
  • http://localhost:3000/api-docs — API documentation (Scalar)
  • http://localhost:3000/queues — BullMQ queue dashboard (auto-enabled when Redis is on)
  • http://localhost:5173 — Vue 3 UI (hot reload)

Sidecar Tools

Add optional dev tools with --with|--view|--viewer:

bash
npm run maker dev -- --with=redis,maildev,studio
bash
pnpm maker dev --with=redis,maildev,studio
bash
yarn maker dev --with=redis,maildev,studio
bash
bun maker dev --with=redis,maildev,studio
ToolURLFlag
MailDev (email preview)http://localhost:1080--with=maildev
Redis Commanderhttp://localhost:1369--with=redis
Drizzle Studiohttps://local.drizzle.studio--with=studio

Run Components Individually

You don't have to run everything together. Each component can be started separately:

bash
# API server only
npm run maker serve -- --src

# Queue worker (background jobs)
npm run maker queue:work -- --queue=default,mail

# Scheduler (cron jobs)
npm run maker schedule:work

# Vue UI only
npm run maker ui:dev

# UI tools on demand
npm run maker maildev:view
npm run maker redis:view
bash
pnpm maker serve --src
pnpm maker queue:work --queue=default,mail
pnpm maker schedule:work
pnpm maker ui:dev
pnpm maker maildev:view
pnpm maker redis:view
bash
yarn maker serve --src
yarn maker queue:work --queue=default,mail
yarn maker schedule:work
yarn maker ui:dev
yarn maker maildev:view
yarn maker redis:view
bash
bun maker serve --src
bun maker queue:work --queue=default,mail
bun maker schedule:work
bun maker ui:dev
bun maker maildev:view
bun maker redis:view

This is useful when you want to run only the API server without the UI, or run the queue worker on a separate machine, or debug a specific component without the overhead of the full dev stack.

Production Mode

Run compiled (dist/) code for production-like testing:

bash
maker serve --prod --runtime=node
maker queue:work --queue=default,mail --prod --runtime=node
maker schedule:work --prod --runtime=node

The --prod flag uses the compiled JavaScript in dist/ instead of running from TypeScript source. The --runtime flag switches between node and bun.

Released under the MIT License.