CLI
@loewen-digital/fullstack ships with a CLI for common development tasks: running migrations, seeding the database, generating code, and managing your stack.
Usage
bash
npx fullstack <command>Or install globally:
bash
npm install -g @loewen-digital/fullstack
fullstack <command>Database commands
migrate:generate
Generate a new migration file from your Drizzle schema changes:
bash
npx fullstack migrate:generate
# Creates: migrations/0001_add_posts_table.sqlmigrate:run
Apply all pending migrations:
bash
npx fullstack migrate:runmigrate:rollback
Roll back the most recently applied migration:
bash
npx fullstack migrate:rollbackmigrate:status
Show the status of all migrations (applied / pending):
bash
npx fullstack migrate:statusdb:seed
Run your seeder file to populate the database with development data:
bash
npx fullstack db:seeddb:fresh
Drop all tables, re-run migrations, and run seeders:
bash
npx fullstack db:freshCode generation
generate:factory
Generate a model factory for a database table:
bash
npx fullstack generate:factory users
# Creates: src/database/factories/userFactory.tsgenerate:seeder
Generate a seeder file:
bash
npx fullstack generate:seeder UsersSeeder
# Creates: src/database/seeders/UsersSeeder.tsConfiguration
The CLI reads your stack configuration from fullstack.config.ts (or .js) in your project root:
ts
// fullstack.config.ts
import { defineConfig } from '@loewen-digital/fullstack'
export default defineConfig({
db: {
driver: 'sqlite',
url: './app.db',
migrations: { dir: './migrations' },
},
})