CLI Reference
This page provides a complete reference for all FlashORM CLI commands.
Global Options
--config, -c: Specify config file path (default:./flash.toml)--force, -f: Skip confirmations--version, -v: Show CLI version--help, -h: Show help
Commands
flash init
Initialize a new FlashORM project.
flash init [flags]Flags:
--sqlite: Initialize for SQLite--postgresql: Initialize for PostgreSQL--mysql: Initialize for MySQL
Examples:
flash init --postgresql
flash init --sqlite
flash init --mysqlflash migrate
Create a new migration.
flash migrate [name] [flags]Flags:
--empty, -e: Create empty migration (no auto-generated SQL)--auto, -a: Auto-generate SQL from schema changes
Examples:
flash migrate "add user table"
flash migrate "update schema" --auto
flash migrate --empty "custom migration"flash apply
Apply pending migrations to the database.
flash apply [flags]Flags:
--force, -f: Skip confirmations
Examples:
flash apply
flash apply --forceflash down
Rollback migrations.
flash down [count] [flags]Parameters:
count: Number of migrations to rollback (default: 1)
Flags:
--force, -f: Skip confirmations
Examples:
flash down
flash down 3
flash down 1 --forceflash gen
Generate type-safe code from SQL queries.
flash genGenerates code based on your flash.toml configuration for Go, TypeScript/JavaScript, and Python.
flash studio
Launch FlashORM Studio web interface.
flash studio [URL] [flags]Flags:
--port, -p: Port to run studio on (default:5555)--browser, -b: Open browser automatically (default:true)--host: Host address to bind to (default:127.0.0.1)--auth-token: Bearer token required for all API requests. Required when--host 0.0.0.0is used.
Security
Binding to 0.0.0.0 (all interfaces) without --auth-token is refused at startup. Always set a token when exposing Studio on a network interface.
Examples:
# SQL Studio (PostgreSQL, MySQL, SQLite) — loads from config
flash studio
# Auto-detect studio type from URL protocol
flash studio "postgres://user:pass@localhost:5432/mydb"
flash studio "mysql://user:pass@localhost:3306/mydb"
flash studio "sqlite:///path/to/db.sqlite"
# MongoDB Studio — auto-detected from mongodb:// URL
flash studio "mongodb://localhost:27017/mydb"
flash studio "mongodb+srv://user:pass@cluster.mongodb.net/mydb"
# Redis Studio — auto-detected from redis:// URL
flash studio "redis://localhost:6379"
flash studio "redis://:password@localhost:6379" --port 3000
# Network-accessible with authentication
flash studio --host 0.0.0.0 --auth-token mysecrettoken
# Client request with token
curl -H "Authorization: Bearer mysecrettoken" http://HOST:5555/api/tablesflash pull
Pull schema from existing database.
flash pull [flags]Flags:
--db: Database URL to pull from--output, -o: Output directory for schema files
Examples:
flash pull --db "postgres://user:pass@localhost:5432/mydb"
flash pull --db "postgres://..." --output db/schema
flash pullflash export
Export data from database.
flash export [flags]Flags:
--format, -f: Export format (json, csv, sqlite)--output, -o: Output file path--table, -t: Specific table to export--query, -q: Custom SQL query for export
Examples:
flash export --format json --output data.json
flash export --table users --format csv
flash export --format sqlite --output dump.dbflash branch
Manage database schema branches.
flash branch [command]Subcommands:
create <name>: Create new branchswitch <name>: Switch to branchmerge <source>: Merge branchlist: List all branchesdelete <name>: Delete branch
Examples:
flash branch create feature-auth
flash branch switch feature-auth
flash branch list
flash branch merge feature-auth
flash branch delete feature-authflash status
Show current migration and branch status.
flash statusflash seed
Seed database with realistic fake data. Foreign key relationships are handled automatically.
flash seed [tables...] [flags]Arguments:
tables...: Optional list of tables with counts in formattable:count(e.g.,users:100 posts:500)
Flags:
--count, -c: Number of rows to generate per table (default: 10)--truncate, -t: Truncate tables before seeding--force, -f: Skip confirmation--dry-run, -d: Preview data without inserting--exclude, -x: Comma-separated tables to skip
Examples:
# Seed all tables with default count (10)
flash seed
# Seed all tables with 100 rows each
flash seed --count 100
# Seed specific tables
flash seed users posts
# Seed multiple tables with different counts
flash seed users:100 posts:500 comments:1000
# Truncate and reseed
flash seed --truncate --force
# Preview without inserting
flash seed --dry-run
# Exclude tables
flash seed --exclude logs,sessions
# E-commerce seeding
flash seed categories:10 products:100 orders:500
# Social media seeding
flash seed users:100 posts:500 likes:5000Smart Data Generation: FlashORM automatically generates appropriate data based on column names:
email→ realistic emailsusername→ unique usernamespassword→ secure random stringstoken,api_key→ hex tokensname,first_name,last_name→ human namesphone→ phone numbersurl,website→ URLsaddress,city,country→ location dataip_address→ IPv4 addressescolor→#RRGGBBhex colorscreated_at/updated_at→ coordinated timestampsis_active,has_permission,can_edit→ booleansprice,amount→ currency valuesmetadata→ JSON objects
flash reset
Reset database to clean state (drops all tables).
flash reset [flags]Flags:
--force, -f: Skip confirmation
Examples:
flash reset
flash reset --force
flash reset --force && flash apply && flash seed --count 50flash raw
Execute raw SQL commands.
flash raw [flags]Flags:
--file, -f: SQL file to execute--query, -q: Inline SQL query
Examples:
flash raw --file db/seeds/admin_users.sql
flash raw --query "SELECT * FROM users LIMIT 5"flash plugins
Manage FlashORM plugins.
flash plugins [command]Subcommands:
list: List installed pluginsadd <name>: Install pluginremove <name>: Remove plugin
flash add-plug
Install a plugin.
flash add-plug <plugin-name>Available plugins:
core: ORM, migrations, code generation, seeding. Auto-installs on first use.studio: Web-based visual database editor. Optional, install when needed.
Example:
flash add-plug studioflash rm-plug
Remove a plugin.
flash rm-plug <plugin-name>Example:
flash rm-plug studioflash update
Update installed plugins and optionally the flash binary itself.
flash update [flags]Flags:
--self: Update all plugins and the flash binary--self-only: Update only the flash binary, leave plugins untouched
Examples:
# Update all installed plugins
flash update
# Update plugins and the flash binary
flash update --self
# Update only the flash binary
flash update --self-onlyConfiguration
FlashORM uses flash.toml for configuration:
version = "2"
schema_dir = "db/schema"
queries = "db/queries/"
migrations_path = "db/migrations"
export_path = "db/export"
[database]
provider = "postgresql"
url_env = "DATABASE_URL"
[gen.go]
enabled = true
[gen.js]
enabled = false
out = "flash_gen"
[gen.python]
enabled = false
out = "flash_gen"
async = trueEnvironment Variables
DATABASE_URL: Database connection stringFLASH_CONFIG: Path to config file (alternative to --config)
Exit Codes
0: Success1: Error2: Plugin not found3: Migration conflict