CLI Commands
This is the full reference for every command available in the shipq CLI.
Project Setup
Section titled “Project Setup”shipq init
Section titled “shipq init”Initialize a new ShipQ project in the current directory.
shipq initWhat it does:
- Creates
go.modif one doesn’t exist - Creates
shipq.iniwith default[db]and[typescript]sections - Updates
.gitignoreto exclude.shipq/
shipq nix
Section titled “shipq nix”Generate a shell.nix file pinned to the latest stable nixpkgs.
shipq nixProvides a reproducible development environment with all required tooling via Nix.
shipq docker
Section titled “shipq docker”Generate production Dockerfiles for your application.
shipq dockerWhat it generates:
Dockerfile(orDockerfile.server) — multi-stage build for the HTTP serverDockerfile.worker— multi-stage build for the background worker (if workers are configured)
Database
Section titled “Database”shipq db setup
Section titled “shipq db setup”Set up the database and write the connection URL into shipq.ini.
shipq db setupBehavior:
- Uses
DATABASE_URLfrom your environment if set - Otherwise auto-detects: MySQL if
mysqldis on PATH, Postgres ifpostgresis on PATH, otherwise SQLite - Creates both dev and test databases
- Writes
[db] database_urlintoshipq.ini
Safety guard: For Postgres and MySQL, DATABASE_URL must point to localhost.
shipq db compile
Section titled “shipq db compile”Generate type-safe query runner code from user-defined query definitions.
shipq db compileWhat it does:
- Generates a temporary Go program that imports your
querydefs/packages - Serializes the query registry (each query’s AST, return type, parameters)
- Compiles each AST to dialect-specific SQL (Postgres, MySQL, SQLite)
- Generates typed query runner code in
shipq/queries/
Output:
shipq/queries/types.go— shared parameter and result typesshipq/queries/<dialect>/runner.go— dialect-specific query runner
shipq db reset
Section titled “shipq db reset”Drop and recreate dev and test databases, then re-run all migrations.
shipq db resetThis is an alias for shipq migrate reset.
Migrations
Section titled “Migrations”shipq migrate new
Section titled “shipq migrate new”Create a new migration file.
shipq migrate new <table_name> [columns...] [--global]Column syntax: name:type or name:references:table
Supported types:
| Type | Description |
|---|---|
string | Short text (VARCHAR) |
text | Long text (TEXT) |
int | Integer |
bigint | Large integer |
bool | Boolean |
float | Floating point |
decimal | Fixed-precision decimal |
datetime | Date and time |
timestamp | Alias for datetime |
binary | Binary data |
json | JSON data |
References: column_name:references:other_table creates a foreign key.
Flags:
| Flag | Description |
|---|---|
--global | Skip scope column injection (when [db] scope is configured) |
Auto-injected columns: Every table automatically gets id, public_id, created_at, updated_at, and deleted_at.
Scope injection: If [db] scope = organization_id is set in shipq.ini, the scope column is auto-injected unless --global is passed.
Examples:
shipq migrate new users name:string email:stringshipq migrate new posts title:string body:text published:boolshipq migrate new comments body:text post_id:references:postsshipq migrate new countries name:string code:string --globalshipq migrate up
Section titled “shipq migrate up”Run all pending migrations (triggers the schema compiler).
shipq migrate upWhat it does:
- Embeds ShipQ runtime libraries into
shipq/lib/...and rewrites imports - Discovers all
migrations/*.gofiles - Generates a temporary Go program to execute migrations and build a canonical
MigrationPlan - Writes the plan to
shipq/db/migrate/schema.json - Generates typed schema bindings in
shipq/db/schema/schema.go - Applies the plan against both dev and test databases
shipq migrate reset
Section titled “shipq migrate reset”Drop and recreate dev and test databases, then re-run all migrations from scratch.
shipq migrate resetAuthentication
Section titled “Authentication”shipq auth
Section titled “shipq auth”Generate the base authentication system.
shipq authWhat it generates:
- Migrations for
organizations,accounts, andsessionstables - Login, logout, and session management handlers in
api/auth/ - Cookie-based session management (signed cookies via
COOKIE_SECRET) and auth middleware - Tests in
api/auth/spec/ - Sets
[auth] protect_by_default = trueinshipq.ini
shipq auth google
Section titled “shipq auth google”Add Google OAuth login to an existing auth system.
shipq auth googleGenerates OAuth endpoints at /auth/google and /auth/google/callback.
Required environment variables: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REDIRECT_URL
shipq auth github
Section titled “shipq auth github”Add GitHub OAuth login to an existing auth system.
shipq auth githubGenerates OAuth endpoints at /auth/github and /auth/github/callback.
Required environment variables: GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, GITHUB_REDIRECT_URL
shipq signup
Section titled “shipq signup”Generate a signup/registration handler. Must be run after shipq auth.
shipq signupGenerates a POST /auth/signup handler that creates an organization and account in a single transaction.
shipq email
Section titled “shipq email”Add email verification and password reset flows. Requires shipq auth and shipq workers to have been run first.
shipq emailGenerates email verification and password reset handlers that send emails asynchronously via the worker queue.
Resources & Handlers
Section titled “Resources & Handlers”shipq resource
Section titled “shipq resource”Generate CRUD handler(s) for a database table.
shipq resource <table> <operation> [--public]Operations:
| Operation | Method | Route | Description |
|---|---|---|---|
create | POST | /<table> | Create handler + test |
get_one | GET | /<table>/:id | Get-one handler + test |
list | GET | /<table> | List handler + test (with pagination) |
update | PATCH | /<table>/:id | Update handler + test |
delete | DELETE | /<table>/:id | Soft-delete handler + test |
all | All of the above | All of the above | All 5 CRUD handlers + tests + register.go |
Flags:
| Flag | Description |
|---|---|
--public | Skip auth protection for generated routes |
What it generates:
- Handler files in
api/<table>/ - Query definitions in
querydefs/ - Test files in
api/<table>/spec/ - Runs
shipq handler compileautomatically
Examples:
shipq resource pets allshipq resource pets createshipq resource books all --publicshipq handler generate
Section titled “shipq handler generate”Generate CRUD handlers for a table (without running handler compile).
shipq handler generate <table>Generates handler files in api/<table>/ including:
create.go— POST handlerget_one.go— GET handlerlist.go— GET (list) handlerupdate.go— PATCH handlersoft_delete.go— DELETE handlerregister.go— handler registration function
shipq handler compile
Section titled “shipq handler compile”Compile the handler registry and run all code generation.
shipq handler compileWhat it does:
- Discovers all handler registrations across
api/packages - Extracts full metadata (HTTP method, path, request/response types, auth requirements)
- Generates all downstream artifacts
Output:
cmd/server/main.go— runnable HTTP server- OpenAPI 3.1 JSON spec (served at
GET /openapiin dev/test) - Docs UI (served at
GET /docsin dev/test) - Admin UI (OpenAPI-driven)
- HTTP test client and harness
- Integration tests (RBAC, tenancy, 401 tests)
- TypeScript HTTP client (and optional framework helpers)
File Uploads
Section titled “File Uploads”shipq files
Section titled “shipq files”Generate the S3-compatible file upload system. Requires shipq auth to have been run first.
shipq filesWhat it generates:
- Migrations for
managed_filesandfile_accesstables - Upload/download/delete handlers in
api/managed_files/ - Query definitions for file operations
- TypeScript helpers (
shipq-files.ts) - Tests for file endpoints
Required environment variables: S3_BUCKET, S3_REGION, S3_ENDPOINT, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
Workers & Channels
Section titled “Workers & Channels”shipq workers
Section titled “shipq workers”Bootstrap the full workers/channels system. Requires shipq auth, redis-server, and centrifugo on PATH.
shipq workersWhat it does:
- Verifies prerequisites
- Writes
[workers]section intoshipq.ini - Generates and applies a
job_resultsmigration - Compiles querydefs and handler registry
- Generates typed channel Go code
- Generates
cmd/worker/main.go - Generates
centrifugo.json - Generates TypeScript channel clients (
shipq-channels.ts) - Generates tests
shipq workers compile
Section titled “shipq workers compile”Recompile channel codegen without the full bootstrap.
shipq workers compilePerforms only codegen steps: channel discovery, typed channels, worker main, Centrifugo config, TypeScript client, querydefs compilation, and handler registry compilation. Skips migrations, prerequisite checks, and library embedding.
Services
Section titled “Services”shipq start
Section titled “shipq start”Start a development service.
shipq start <service>Available services:
| Service | Description |
|---|---|
postgres | Start a PostgreSQL server |
mysql | Start a MySQL server |
sqlite | Initialize the SQLite database file |
redis | Start a Redis server |
minio | Start a MinIO S3-compatible object store |
centrifugo | Start Centrifugo (WebSocket hub) |
server | Run the application server (go run ./cmd/server) |
worker | Run the background worker (go run ./cmd/worker) |
Utilities
Section titled “Utilities”shipq seed
Section titled “shipq seed”Run all seed files in the seeds/ directory.
shipq seedshipq kill-port
Section titled “shipq kill-port”Kill the process bound to a specific TCP port.
shipq kill-port <port>Sends SIGTERM to the process on the specified port. Sends SIGKILL if the process doesn’t exit within 3 seconds.
shipq kill-defaults
Section titled “shipq kill-defaults”Kill all processes on default ShipQ development service ports.
shipq kill-defaults