Skip to content

CLI ​

The package installs a fullstack binary. It reads fullstack.config.ts from the current directory, needs its db section (and drizzle-orm plus better-sqlite3 installed), and runs migrations, seeds and scaffolds against that database.

Usage ​

bash
npx fullstack <command>

npx fullstack help prints the list below.

Commands ​

CommandDoes
migrateRuns the pending migrations from db.migrations (default ./drizzle) with Drizzle's migrator
migrate:rollbackRemoves the last entry from Drizzle's migration journal. It does not undo the SQL; that is yours
migrate:statusLists the applied migrations with their timestamps
seed [file]Runs a seed file: the given path, or database/seeds/index.ts (a .js next to it wins)
generate migration <name>Writes drizzle/migrations/<timestamp>_<name>.ts with empty up and down functions
generate factory <name>Writes database/factories/<name>.factory.ts with a defineFactory scaffold
generate seed <name>Writes database/seeds/<name>.seed.ts with a default-exported seed function

generate refuses to overwrite an existing file.

Migrations ​

migrate is db.migrate() from the db module: it applies the SQL migrations and journal that drizzle-kit generate writes into db.migrations. The workflow is Drizzle Kit's:

bash
npx drizzle-kit generate
npx fullstack migrate
npx fullstack migrate:status

The file generate migration scaffolds is a TypeScript up/down pair; migrate does not run it. Use it for data migrations you run yourself, or generate schema migrations with Drizzle Kit.

Seeds ​

A seed file exports a function that takes the DbInstance, as a default export or as seed; generate seed writes that shape. seed without an argument runs database/seeds/index.ts.

ts
// database/seeds/index.ts
import type { DbInstance } from '@loewen-digital/fullstack/db'

export default async function seed(db: DbInstance): Promise<void> {
  await db.seed(async () => {
    // insert through db.drizzle, or call the seed files of this folder in order
  })
}
bash
npx fullstack seed
npx fullstack seed database/seeds/users.seed.ts

The file is loaded with a dynamic import, so a .ts seed runs on Node 24's type stripping; a .js build next to it is preferred when present.

Configuration ​

loadConfig() imports fullstack.config.ts (or .js) from the working directory; db is the only section the CLI reads.

ts
// fullstack.config.ts
import { defineConfig } from '@loewen-digital/fullstack'

export default defineConfig({
  db: { driver: 'sqlite', url: './app.db', migrations: './drizzle' },
})
KeyUsed byDescription
db.driver, db.urlall commandsThe database, sqlite only
db.migrationsmigrate, migrate:statusDrizzle Kit's output folder, default ./drizzle