Skip to content

CLI Commands

This is the full reference for every command available in the shipq CLI.

Initialize a new ShipQ project in the current directory.

Terminal window
shipq init

What it does:

  • Creates go.mod if one doesn’t exist
  • Creates shipq.ini with default [db] and [typescript] sections
  • Updates .gitignore to exclude .shipq/

Generate a shell.nix file pinned to the latest stable nixpkgs.

Terminal window
shipq nix

Provides a reproducible development environment with all required tooling via Nix.


Generate production Dockerfiles for your application.

Terminal window
shipq docker

What it generates:

  • Dockerfile (or Dockerfile.server) — multi-stage build for the HTTP server
  • Dockerfile.worker — multi-stage build for the background worker (if workers are configured)

Set up the database and write the connection URL into shipq.ini.

Terminal window
shipq db setup

Behavior:

  • Uses DATABASE_URL from your environment if set
  • Otherwise auto-detects: MySQL if mysqld is on PATH, Postgres if postgres is on PATH, otherwise SQLite
  • Creates both dev and test databases
  • Writes [db] database_url into shipq.ini

Safety guard: For Postgres and MySQL, DATABASE_URL must point to localhost.


Generate type-safe query runner code from user-defined query definitions.

Terminal window
shipq db compile

What it does:

  1. Generates a temporary Go program that imports your querydefs/ packages
  2. Serializes the query registry (each query’s AST, return type, parameters)
  3. Compiles each AST to dialect-specific SQL (Postgres, MySQL, SQLite)
  4. Generates typed query runner code in shipq/queries/

Output:

  • shipq/queries/types.go — shared parameter and result types
  • shipq/queries/<dialect>/runner.go — dialect-specific query runner

Drop and recreate dev and test databases, then re-run all migrations.

Terminal window
shipq db reset

This is an alias for shipq migrate reset.


Create a new migration file.

Terminal window
shipq migrate new <table_name> [columns...] [--global]

Column syntax: name:type or name:references:table

Supported types:

TypeDescription
stringShort text (VARCHAR)
textLong text (TEXT)
intInteger
bigintLarge integer
boolBoolean
floatFloating point
decimalFixed-precision decimal
datetimeDate and time
timestampAlias for datetime
binaryBinary data
jsonJSON data

References: column_name:references:other_table creates a foreign key.

Flags:

FlagDescription
--globalSkip 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:

Terminal window
shipq migrate new users name:string email:string
shipq migrate new posts title:string body:text published:bool
shipq migrate new comments body:text post_id:references:posts
shipq migrate new countries name:string code:string --global

Run all pending migrations (triggers the schema compiler).

Terminal window
shipq migrate up

What it does:

  1. Embeds ShipQ runtime libraries into shipq/lib/... and rewrites imports
  2. Discovers all migrations/*.go files
  3. Generates a temporary Go program to execute migrations and build a canonical MigrationPlan
  4. Writes the plan to shipq/db/migrate/schema.json
  5. Generates typed schema bindings in shipq/db/schema/schema.go
  6. Applies the plan against both dev and test databases

Drop and recreate dev and test databases, then re-run all migrations from scratch.

Terminal window
shipq migrate reset

Generate the base authentication system.

Terminal window
shipq auth

What it generates:

  • Migrations for organizations, accounts, and sessions tables
  • 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 = true in shipq.ini

Add Google OAuth login to an existing auth system.

Terminal window
shipq auth google

Generates OAuth endpoints at /auth/google and /auth/google/callback.

Required environment variables: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REDIRECT_URL


Add GitHub OAuth login to an existing auth system.

Terminal window
shipq auth github

Generates OAuth endpoints at /auth/github and /auth/github/callback.

Required environment variables: GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, GITHUB_REDIRECT_URL


Generate a signup/registration handler. Must be run after shipq auth.

Terminal window
shipq signup

Generates a POST /auth/signup handler that creates an organization and account in a single transaction.


Add email verification and password reset flows. Requires shipq auth and shipq workers to have been run first.

Terminal window
shipq email

Generates email verification and password reset handlers that send emails asynchronously via the worker queue.


Generate CRUD handler(s) for a database table.

Terminal window
shipq resource <table> <operation> [--public]

Operations:

OperationMethodRouteDescription
createPOST/<table>Create handler + test
get_oneGET/<table>/:idGet-one handler + test
listGET/<table>List handler + test (with pagination)
updatePATCH/<table>/:idUpdate handler + test
deleteDELETE/<table>/:idSoft-delete handler + test
allAll of the aboveAll of the aboveAll 5 CRUD handlers + tests + register.go

Flags:

FlagDescription
--publicSkip 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 compile automatically

Examples:

Terminal window
shipq resource pets all
shipq resource pets create
shipq resource books all --public

Generate CRUD handlers for a table (without running handler compile).

Terminal window
shipq handler generate <table>

Generates handler files in api/<table>/ including:

  • create.go — POST handler
  • get_one.go — GET handler
  • list.go — GET (list) handler
  • update.go — PATCH handler
  • soft_delete.go — DELETE handler
  • register.go — handler registration function

Compile the handler registry and run all code generation.

Terminal window
shipq handler compile

What it does:

  1. Discovers all handler registrations across api/ packages
  2. Extracts full metadata (HTTP method, path, request/response types, auth requirements)
  3. Generates all downstream artifacts

Output:

  • cmd/server/main.go — runnable HTTP server
  • OpenAPI 3.1 JSON spec (served at GET /openapi in dev/test)
  • Docs UI (served at GET /docs in dev/test)
  • Admin UI (OpenAPI-driven)
  • HTTP test client and harness
  • Integration tests (RBAC, tenancy, 401 tests)
  • TypeScript HTTP client (and optional framework helpers)

Generate the S3-compatible file upload system. Requires shipq auth to have been run first.

Terminal window
shipq files

What it generates:

  • Migrations for managed_files and file_access tables
  • 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


Bootstrap the full workers/channels system. Requires shipq auth, redis-server, and centrifugo on PATH.

Terminal window
shipq workers

What it does:

  1. Verifies prerequisites
  2. Writes [workers] section into shipq.ini
  3. Generates and applies a job_results migration
  4. Compiles querydefs and handler registry
  5. Generates typed channel Go code
  6. Generates cmd/worker/main.go
  7. Generates centrifugo.json
  8. Generates TypeScript channel clients (shipq-channels.ts)
  9. Generates tests

Recompile channel codegen without the full bootstrap.

Terminal window
shipq workers compile

Performs 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.


Start a development service.

Terminal window
shipq start <service>

Available services:

ServiceDescription
postgresStart a PostgreSQL server
mysqlStart a MySQL server
sqliteInitialize the SQLite database file
redisStart a Redis server
minioStart a MinIO S3-compatible object store
centrifugoStart Centrifugo (WebSocket hub)
serverRun the application server (go run ./cmd/server)
workerRun the background worker (go run ./cmd/worker)

Run all seed files in the seeds/ directory.

Terminal window
shipq seed

Kill the process bound to a specific TCP port.

Terminal window
shipq kill-port <port>

Sends SIGTERM to the process on the specified port. Sends SIGKILL if the process doesn’t exit within 3 seconds.


Kill all processes on default ShipQ development service ports.

Terminal window
shipq kill-defaults