Skip to content

CLI

CLI

@loewen-digital/fullstack ships with a CLI for common development tasks: running migrations, seeding the database, generating code, and managing your stack.

Usage

Terminal window
npx fullstack <command>

Or install globally:

Terminal window
npm install -g @loewen-digital/fullstack
fullstack <command>

Database commands

migrate:generate

Generate a new migration file from your Drizzle schema changes:

migrations/0001_add_posts_table.sql
npx fullstack migrate:generate

migrate:run

Apply all pending migrations:

Terminal window
npx fullstack migrate:run

migrate:rollback

Roll back the most recently applied migration:

Terminal window
npx fullstack migrate:rollback

migrate:status

Show the status of all migrations (applied / pending):

Terminal window
npx fullstack migrate:status

db:seed

Run your seeder file to populate the database with development data:

Terminal window
npx fullstack db:seed

db:fresh

Drop all tables, re-run migrations, and run seeders:

Terminal window
npx fullstack db:fresh

Code generation

generate:factory

Generate a model factory for a database table:

Terminal window
npx fullstack generate:factory users
# Creates: src/database/factories/userFactory.ts

generate:seeder

Generate a seeder file:

Terminal window
npx fullstack generate:seeder UsersSeeder
# Creates: src/database/seeders/UsersSeeder.ts

Configuration

The CLI reads your stack configuration from fullstack.config.ts (or .js) in your project root:

fullstack.config.ts
import { defineConfig } from '@loewen-digital/fullstack'
export default defineConfig({
db: {
driver: 'sqlite',
url: './app.db',
migrations: { dir: './migrations' },
},
})