The disc command-line interface provides tools for project initialization, schema management, code generation, database administration, and server operation.
See also: Getting Started | Migrations | Codegen | Server | Bundled PostgreSQL
These options apply to most commands:
-h, --help Show help message
-v, --version Show version information
-s, --schema <file> Schema file path (single-file mode)
--schema-dir <dir> Schema directory for multi-file discovery (default: ./dbschema)
-c, --config <file> Configuration file path
--backend-dsn <url> Use external PostgreSQL (skip bundled)
--database-url <url> PostgreSQL connection URL
disc initInitialize a new Disc project. Creates the project directory, scaffolds schema files, generates configuration, and optionally sets up a bundled PostgreSQL instance.
disc init [name] [options]
| Argument | Description | Default |
|---|---|---|
name |
Project name | disc-project |
| Flag | Description | Default |
|---|---|---|
--template <type> |
Schema template: minimal, basic, or full |
basic |
--database-url <url> |
PostgreSQL connection URL for the project | postgresql://localhost:5432/disc_dev |
--backend-dsn <url> |
Use an external PostgreSQL instead of bundled | -- |
--skip-postgres |
Skip bundled PostgreSQL setup | false |
--force |
Overwrite existing project directory | false |
--directory <dir> |
Parent directory for the project | . (current directory) |
module default {} schema. Start from scratch.User type with name, email (exclusive constraint), and createdAt. Good starting point for most projects.User type and a Post type with a link between them. Demonstrates relationships, constraints, and defaults.# Create a new project with the default (basic) template
disc init my-project
# Create a project with the full template
disc init my-app --template full
# Initialize without bundled PostgreSQL (use an external one)
disc init my-app --backend-dsn "postgres://user:pass@host:5432/mydb"
# Initialize without any PostgreSQL setup
disc init my-app --skip-postgres
my-project/
schema.disc # Schema definition
deno.json # Deno configuration with tasks
.env # Environment variables
.gitignore # Git ignore rules
mod.ts # Module entry point
README.md # Project readme
migrations/ # Migration directory
disc.toml # Disc instance configuration (when using bundled PG)
Project name rules: Lowercase letters, numbers, and hyphens only. Cannot start or end with a hyphen.
disc migrateGenerate and apply schema migrations. Compares the current schema definition against the stored migration history to detect changes, then generates and executes the necessary DDL statements.
disc migrate [options]
| Flag | Description | Default |
|---|---|---|
-s, --schema <file> |
Path to the schema file | ./dbschema/default.disc |
--dry-run |
Show what would be done without executing | false |
--auto-approve |
Skip confirmation prompts | false |
--create |
Create migration files without applying them | false |
--status |
Show migration status (applied count, latest migration) | |
--rollback |
Rollback the most recent migration (requires --force) |
|
--rollback-to <id> |
Rollback all migrations after the specified ID (requires --force) |
|
--squash |
Squash multiple migrations into one | |
--squash-from <id> |
Start of the squash range (inclusive) | |
--squash-to <id> |
End of the squash range (inclusive) | |
--force |
Required for destructive operations (rollback) | false |
--unsafe |
Permit unsafe/ambiguous operations (DropType, DropProperty, RecreateScalar, ambiguous classifications) |
false |
--backend-dsn <url> |
PostgreSQL connection URL | DATABASE_URL env var or postgresql://localhost:5432/disc_dev |
# Apply pending migrations
disc migrate
# Preview changes without applying
disc migrate --dry-run
# Apply without confirmation prompts
disc migrate --auto-approve
# Create migration files without applying
disc migrate --create
# Check migration status
disc migrate --status
# Rollback the most recent migration
disc migrate --rollback --force
# Rollback to a specific migration
disc migrate --rollback-to m20240101T100000_abc123 --force
# Squash all migrations into one
disc migrate --squash
# Squash a specific range
disc migrate --squash --squash-from m001 --squash-to m005
Migration Status
Applied migrations: 5
Current schema hash: a1b2c3d4
Latest migration:
ID: m20240315T140000_add_posts
Name: add_posts
Applied at: 2024-03-15T14:00:00.000Z
Schema status: 2 pending operation(s)
- [safe] AddProperty
- [ambiguous] ChangeType
Run `disc migrate` to apply.
The "Schema status" line is a drift check: disc migrate --status parses the SDL file on disk, runs it through the diff engine against the applied state, and surfaces pending operations with their safety classification (safe/unsafe/ambiguous). When the SDL matches the applied state the line reads Schema status: in sync. (gh/geldata#8899)
Pre-migrate preflight (running-server detection). Before each live migration the CLI scans pg_stat_activity for connections tagged application_name = "disc-server". If any are found, it warns:
⚠ Detected 1 active Disc server connection(s) on this database.
Migrate will succeed, but the server’s in-memory schema cache will be stale until reload.
Trigger a schema reload (admin UI Diff page → Apply, or restart the server) after migration.
The migration still proceeds — this is an advisory, not a refusal. After applying, trigger a schema reload via the admin UI’s Diff page (Apply Migration), or restart the server. Best-effort: silently no-ops if pg_stat_activity is restricted on the deployment. (gh/geldata#9034)
Rollback safety: Rollback is a destructive operation. Rolling back a DROP TABLE migration cannot restore lost data. The --force flag is required to acknowledge this risk.
disc serveStart the Disc server. Starts the bundled PostgreSQL instance, loads the project schema, and serves the HTTP API and optional binary wire protocol.
disc serve [options]
| Flag | Description | Default |
|---|---|---|
--port <port> |
HTTP server port | 5656 |
--host <host> |
Host to bind to | localhost |
--jwt-secret <key> |
JWT signing secret for authentication | |
--enable-auth |
Enable the authentication system | false |
--enable-access-policies |
Enable object-level access policy enforcement | false |
--binary-port <port> |
Start binary wire protocol server on this port | |
--tls-cert <path> |
Path to TLS certificate file | |
--tls-key <path> |
Path to TLS private key file | |
--no-ui |
Start server without serving UI assets | false |
--require-auth |
Reject unauthenticated requests on protected routes (gh/geldata#5234) | false |
--read-only |
Refuse INSERT/UPDATE/DELETE/DDL at the AST level | false |
--trust-proxy |
Trust X-Forwarded-For / X-Forwarded-Proto headers for client IP |
false |
# Start with defaults (port 5656, localhost)
disc serve
# Start on a custom port
disc serve --port 8080
# Start with authentication
disc serve --jwt-secret "your-secret-key" --enable-auth
# Start with authentication and access policies
disc serve --jwt-secret "your-secret-key" --enable-auth --enable-access-policies
# Start with TLS
disc serve --tls-cert /path/to/cert.pem --tls-key /path/to/key.pem
# Start with binary protocol on a separate port
disc serve --binary-port 5657
# Bind to all interfaces (production)
disc serve --host 0.0.0.0
./dbschema/default.discEnvironment variables: The following environment variables are also recognized and can be used instead of CLI flags:
DISC_JWT_SECRET -- JWT signing secretDISC_ENABLE_AUTH -- Set to "true" to enable authDISC_ENABLE_ACCESS_POLICIES -- Set to "true" to enable access policiesDISC_TLS_CERT -- Path to TLS certificateDISC_TLS_KEY -- Path to TLS private keyDATABASE_URL -- PostgreSQL connection URLDISC_TLS_CERT_ENV -- Name of an env var holding PEM cert contents (for K8s/Fly.io/Render env-only secret injection); materializes to a 0600 temp fileDISC_TLS_KEY_ENV -- Name of an env var holding PEM key contentsDISC_REQUIRE_AUTH -- Set to "true" / "1" / "yes" to require auth on protected routes (mirrors --require-auth)DISC_READ_ONLY -- Set to "true" / "1" / "yes" to enable read-only mode (mirrors --read-only)DISC_TRUST_PROXY -- Set to "true" / "1" / "yes" to trust forwarded headers (mirrors --trust-proxy)DISC_ENABLE_DATA_WATCH -- Set to "false" to disable the live-data subscription endpoint (/admin/data-watch); default trueDISC_ENABLE_REST -- Set to "false" to disable the schema-derived REST surface; default trueDISC_SHUTDOWN_DRAIN_TIMEOUT -- Milliseconds to wait for in-flight connections to drain on SIGTERMdisc shellOpen an interactive EdgeQL REPL. Connects to a running Disc instance (or starts one) and provides a prompt for executing queries.
disc shell [options]
| Flag | Description | Default |
|---|---|---|
--host <host> |
Database host | localhost |
-p, --port <port> |
Database port | 5656 |
--database <name> |
Database name | disc |
-s, --schema <file> |
Load a schema file on startup | |
--non-interactive |
Disable interactive mode | false |
--execute <query> |
Execute a single query and exit |
# Open interactive REPL
disc shell
# Execute a single query
disc shell --execute "select User { email, name };"
# Connect to a specific database
disc shell --database my_app
# Load a schema file on startup
disc shell --schema ./dbschema/default.disc
| Command | Description |
|---|---|
\? or \help |
Show help |
\q or \quit |
Quit shell |
\d |
List tables |
\dt |
List tables with details (size, description) |
\c <database> |
Connect to a different database |
\i <file> |
Execute queries from a file |
\timing |
Toggle query timing display |
\history |
Show command history |
\clear |
Clear the screen |
The same table appears in
docs/getting-started.md. Keep them in sync — column widths included — so agit diffinstantly flags drift.
Multiline queries: Queries that do not end with a semicolon are treated as multiline input. The prompt changes to ... until a semicolon terminates the query.
disc> select User {
... email,
... name
... };
disc codegenGenerate types, query builders, and client code from your schema, in TypeScript (default), Rust (--rust), or Go (--go). Supports both single-file and multi-file schema discovery.
disc codegen [options]
| Flag | Description | Default |
|---|---|---|
-s, --schema <file> |
Single schema file path | |
--schema-dir <dir> |
Schema directory for multi-file discovery | ./dbschema |
-o, --output <dir> |
Output directory for generated code | ./dbschema/disc-client |
-t, --target <type> |
Codegen target: client, server, or both |
client |
--rust |
Emit a Rust client crate instead of TypeScript | false (out: ./dbschema/disc-client-rust) |
--go |
Emit a Go client package instead of TypeScript | false (out: ./dbschema/disc-client-go) |
--no-queries |
Skip query builder generation | false |
--no-mutations |
Skip mutation method generation | false |
--no-client |
Skip client library generation | false |
--no-format |
Skip output formatting | false |
--js |
Reserved: generate JavaScript output | false (not implemented yet — tracked in backlog) |
# Generate from default schema directory (./dbschema/)
disc codegen
# Generate from a single schema file
disc codegen --schema ./schema.disc
# Generate from a custom schema directory
disc codegen --schema-dir ./schema
# Custom output directory
disc codegen --output ./src/generated
# Generate server-side types only
disc codegen --target server
# Generate types without query builders
disc codegen --no-queries --no-mutations
# Generate a Rust client crate
disc codegen --rust
# Generate a Go client package into a custom directory
disc codegen --go --output ./internal/discclient
--rust and --go replace the TypeScript output rather than adding to it -- run the command once per language. --rust wins if both are passed. The --target, --no-queries, --no-mutations, and --no-client toggles apply to every language. See Codegen → Architecture & Language Targets for the generated crate/package layout and cardinality mappings.
Multi-file discovery: When using --schema-dir, Disc discovers all .disc files in the directory and merges them into a unified schema before generating code.
dbschema/disc-client/
client.ts # DiscClient class
index.ts # Client entry point
queries.ts # Type-safe query builder functions
types.ts # TypeScript type definitions
import { DiscClient } from "./dbschema/disc-client/index.ts";
const client = new DiscClient({ baseUrl: "http://localhost:5656" });
const users = await client.user.select();
disc watchWatch schema files for changes and automatically run migrations (dry-run) and regenerate TypeScript types. Designed for development workflows.
disc watch [options]
| Flag | Description | Default |
|---|---|---|
-s, --schema <file> |
Schema file to watch | ./schema.disc |
-o, --output <dir> |
Output directory for generated types | ./generated |
# Watch the default schema file
disc watch
# Watch a specific schema file
disc watch --schema ./dbschema/default.disc
# Watch with custom output directory
disc watch --schema ./schema.disc --output ./src/generated
.disc file changesSIGINT (Ctrl+C) or SIGTERMIf the schema file does not exist, the watcher creates a default schema with a basic User type.
disc startStart the bundled PostgreSQL instance for the current project. Creates the instance if it does not exist.
disc start [options]
| Flag | Description | Default |
|---|---|---|
-p, --port <port> |
PostgreSQL port | 5432 |
--no-monitor |
Disable health monitoring | false |
# Start PostgreSQL
disc start
# Start on a custom port
disc start --port 5433
# Start without health monitoring
disc start --no-monitor
PostgreSQL started successfully
PID: 12345
Port: 5432
Data: /Users/you/.disc/instances/my-project/data
DSN: postgresql://disc@localhost:5432/disc
disc stopStop the bundled PostgreSQL instance for the current project.
disc stop
disc restartRestart the bundled PostgreSQL instance for the current project. Stops the running instance and starts it again.
disc restart
disc statusShow the status of the bundled PostgreSQL instance for the current project, including health check information when available.
disc status
PostgreSQL Status for project: my-project
Status: Running
PID: 12345
Port: 5432
Started: 3/20/2026, 2:30:00 PM
Health Check:
Healthy: Yes
Connections: 3
Latency: 2ms
Uptime: 120 minutes
Data Directory: /Users/you/.disc/instances/my-project/data
Socket Path: /Users/you/.disc/instances/my-project/socket
Version: PostgreSQL 18.4
PostgreSQL Status for project: my-project
Status: Stopped
Data Directory: /Users/you/.disc/instances/my-project/data
Socket Path: /Users/you/.disc/instances/my-project/socket
Version: PostgreSQL 18.4
disc uiOpen the Disc admin UI in the default browser. Requires the UI to be built first.
disc ui [options]
| Flag | Description | Default |
|---|---|---|
-p, --port <port> |
Port the server is running on | 5656 |
# Open admin UI
disc ui
# Open admin UI for a server on a custom port
disc ui --port 8080
The UI must be built before use. If it is not built, the command outputs instructions:
cd ui && npm install && npm run build
disc buildCompile Disc into a self-contained binary using deno compile. Supports cross-compilation to multiple platforms.
disc build [options]
| Flag | Description | Default |
|---|---|---|
--platform <platform> |
Target platform for cross-compilation | Current platform |
-o, --output <path> |
Output binary path | ./disc (or ./disc-<platform> for cross-compile) |
--lite |
Skip UI assets in the build (reserved for future use) | false |
| Platform | Deno Target |
|---|---|
darwin-arm64 |
aarch64-apple-darwin |
darwin-x64 |
x86_64-apple-darwin |
linux-arm64 |
aarch64-unknown-linux-gnu |
linux-x64 |
x86_64-unknown-linux-gnu |
windows-x64 |
x86_64-pc-windows-msvc |
Windows ARM64 has no
deno compiletarget and no Zonky PG build, sowindows-x64is the only Windows target. Windows-on-ARM runs it under x64 emulation. The compiled binary is written with a.exeextension (disc-windows-x64.exe).
# Build for the current platform
disc build
# Build for Linux x64
disc build --platform linux-x64
# Build with a custom output path
disc build --output ./my-disc
# Cross-compile for Linux ARM64
disc build --platform linux-arm64 --output ./disc-linux-arm64
When --platform <p> is set, disc build stages the target platform’s PostgreSQL distribution into dist/embedded-pg/<platform>/<version>/ before regenerating the embedded-PG manifest. The resulting binary embeds the right PG for its target — without this step, the build machine’s host PG would be embedded into every cross-compiled binary, breaking on extraction. Per-platform staging caches are reused across builds, so producing every platform binary from a single CI runner only downloads each PG distribution once.
Building Disc binary...
Output: ./disc
Command: deno compile --allow-net --allow-read --allow-write --allow-env --allow-run --output ./disc cli/main.ts
Build complete!
Binary: ./disc (45.23 MB)
disc deployGenerate deployment artifacts for production environments. Scaffolds Dockerfiles, docker-compose configurations, systemd service units, or environment variable templates.
disc deploy --format <format> [options]
| Flag | Description | Default |
|---|---|---|
--format <format> |
Deployment format (required): docker, compose, systemd, or env |
-- |
-o, --output <dir> |
Output directory for generated files | ./deploy |
Generates a Dockerfile based on the official Deno image. Exposes port 5656 and expects DATABASE_URL to be set at runtime.
disc deploy --format docker
Generated file: ./deploy/Dockerfile
Generates a docker-compose.yml with a Disc service and a PostgreSQL 16 service. Includes health checks and volume persistence.
disc deploy --format compose
Generated file: ./deploy/docker-compose.yml
Generates a disc.service unit file for running Disc as a systemd service. Includes security hardening directives.
disc deploy --format systemd
Generated file: ./deploy/disc.service
Installation:
sudo cp deploy/disc.service /etc/systemd/system/disc.service
sudo systemctl daemon-reload
sudo systemctl enable disc
sudo systemctl start disc
Generates a .env.production template with all documented environment variables, organized by category: database, server, authentication, logging, rate limiting, cache, TLS, and metrics.
disc deploy --format env
Generated file: ./deploy/.env.production
# Generate a Dockerfile
disc deploy --format docker
# Generate docker-compose.yml
disc deploy --format compose
# Generate a systemd service unit
disc deploy --format systemd
# Generate an environment variable template
disc deploy --format env
# Generate into a custom directory
disc deploy --format docker --output ./infra
disc db createCreate a new Disc-managed database. Creates a PostgreSQL database with the disc_ prefix.
disc db create <name> [options]
| Argument | Description |
|---|---|
name |
Database name (lowercase letters, digits, and underscores; must start with a letter) |
| Flag | Description | Default |
|---|---|---|
--database-url <url> |
PostgreSQL connection URL | DATABASE_URL env var or postgresql://localhost:5432/disc |
# Create a database named "my_app" (PG name: disc_my_app)
disc db create my_app
# Create using a specific connection
disc db create staging --database-url "postgres://admin:pass@db:5432/disc"
Naming rules: Database names must start with a lowercase letter and contain only lowercase letters, digits, and underscores. The actual PostgreSQL database is created with a disc_ prefix to avoid collisions with system databases.
disc db listList all Disc-managed databases (those with the disc_ prefix).
disc db list [options]
| Flag | Description | Default |
|---|---|---|
--database-url <url> |
PostgreSQL connection URL | DATABASE_URL env var or postgresql://localhost:5432/disc |
disc db list
Disc-managed databases:
NAME
------------------------------
my_app
staging
test
3 database(s) total.
disc db dropDrop a Disc-managed database. This operation is irreversible and requires the --force flag.
disc db drop <name> --force [options]
| Argument | Description |
|---|---|
name |
Database name to drop |
| Flag | Description | Default |
|---|---|---|
--force |
Required. Confirms the irreversible operation. | |
--database-url <url> |
PostgreSQL connection URL | DATABASE_URL env var or postgresql://localhost:5432/disc |
# Drop the "test" database
disc db drop test --force
Restrictions: The default disc database cannot be dropped.
disc db importImport a Gel CSV export into an already-migrated Disc database, preserving the original object UUIDs.
disc db import <dir> [options]
| Argument | Description |
|---|---|
dir |
Directory containing the Gel CSV export (*.csv) |
| Flag | Description | Default |
|---|---|---|
--on-conflict <mode> |
On a duplicate id / junction row: error (abort) or skip |
error |
--backend-dsn <url> |
Target database DSN (external PostgreSQL; overrides project) | |
--database-url <url> |
Target database DSN (alias for --backend-dsn) |
DATABASE_URL env var or project disc.toml |
# Import an export directory into the current project's database
disc db import ./gel-export/data
# Re-import idempotently, skipping rows that already exist
disc db import ./gel-export/data --on-conflict skip
# Import into an external PostgreSQL
disc db import ./gel-export/data --backend-dsn "postgres://user:pass@host:5432/disc"
The directory must contain a Gel CSV export in relational backing form — one CSV per type and per multi-link, named <module>_<TypeName>[.<linkName>].csv:
id, __type__, the type’s scalar properties, and a <link>_id column for each single link (e.g. public_Video.csv with id,__type__,title,channel_id).source,target rows (e.g. public_Video.tags.csv)..esdl files) and uses it to map each CSV column to its table column and coercion type.id on insert overrides the column default, so every <link>_id FK and junction source/target resolves directly — there is no old→new ID remapping.--on-conflict skip appends ON CONFLICT DO NOTHING, making re-imports safe. Counts in the summary then reflect rows attempted, not net-new inserts.The command prints a per-table count summary and the total, lists skipped files, and exits non-zero on any error (unclassifiable file, FK cycle, or failed transaction).
disc pg logView PostgreSQL logs for the current project’s bundled instance.
disc pg log [options]
| Flag | Description | Default |
|---|---|---|
-f, --follow |
Follow log output (like tail -f) |
false |
--lines <n> |
Number of recent log lines to show | 50 |
--level <level> |
Filter logs by level: ERROR, WARNING, LOG, FATAL, PANIC |
(show all) |
--name <project> |
Project name (overrides auto-detection) | Current directory name |
# View the last 50 lines of PostgreSQL log
disc pg log
# Follow log output in real-time
disc pg log -f
# Show the last 100 lines
disc pg log --lines 100
# Show only errors
disc pg log --level ERROR
# Show only errors and follow
disc pg log --level ERROR -f
Log location: Logs are stored at ~/.disc/instances/<project>/logs/postgresql.log. If no log file exists, the command reports an error suggesting that PostgreSQL may not be running.
Follow mode: Press Ctrl+C to stop following. The command polls for new content every 500 milliseconds.
disc pg upgradeUpgrade the bundled PostgreSQL instance to a newer version. Uses a pg_dumpall/pg_restore strategy with automatic backup and rollback on failure.
disc pg upgrade --target-version <version> [options]
| Flag | Description | Default |
|---|---|---|
--target-version <version> |
Target PostgreSQL version (required) | |
--dry-run |
Show the upgrade plan without executing | false |
--name <project> |
Project name (overrides auto-detection) | Current directory name |
Available versions: 16.4, 17.0, 18.4 (default)
# Preview the upgrade plan
disc pg upgrade --target-version 17.0 --dry-run
# Perform the upgrade
disc pg upgrade --target-version 17.0
PostgreSQL Upgrade Plan:
Project: my-project
Current version: 18.4
Target version: 17.0
Strategy: pg_dump/pg_restore
Backup: yes
Dry run complete. No changes were made.
pg_dumpallversion.jsonIf any step after the dump fails, the upgrade process automatically attempts to:
The target version must be newer than the current version. Downgrading is not supported.
Every CLI command automatically resolves the project it belongs to. No manual DSN configuration or flags are needed when working inside a project directory.
When you run any disc command, the CLI:
disc.toml (like git finds .git/).disc.toml for the project name, database settings, and server configuration.~/.disc/instances/{instance_name}/.serve, migrate, shell, start), auto-starts the managed instance if it is not already running.This means disc serve, disc migrate, and disc shell all work from any subdirectory of a project with zero configuration.
Commands resolve the database connection in this order:
--backend-dsn CLI flag (explicit external PostgreSQL)DATABASE_URL environment variabledisc.toml project context (managed socket DSN or backend_dsn)postgresql://localhost:5432/disc_devdisc.tomlThe disc.toml file is created automatically by disc init:
name = "my-project"
version = "0.1.0"
[database]
managed = true
instance_name = "my-project"
# backend_dsn = "postgresql://user:pass@host:5432/db" # for external PG
[server]
host = "localhost"
port = 5656
# require_auth = true
# read_only = false
# enable_cors = true
# cors_origins = ["https://app.example.com", "https://*.example.com"]
# cors_allow_credentials = true
# trust_proxy = true
# enable_websockets = true
# enable_metrics = true
# max_request_body_bytes = 4194304
# request_timeout = 30000
# rate_limit_rpm = 600
| Section | Key | Default | Description |
|---|---|---|---|
| (top) | name |
(required) | Project name |
[database] |
managed |
true |
Use bundled PostgreSQL |
[database] |
instance_name |
same as name | Instance directory under ~/.disc/instances/ |
[database] |
backend_dsn |
(none) | External PostgreSQL connection string |
[server] |
host |
"localhost" |
Server bind host |
[server] |
port |
5656 |
Server bind port |
[server] |
require_auth |
false |
Reject data-plane requests without a valid Authorization header |
[server] |
read_only |
false |
Reject INSERT/UPDATE/DELETE/CONFIGURE and migrations |
[server] |
enable_cors |
true |
Emit CORS headers on HTTP responses |
[server] |
cors_origins |
(any) | Allowlist of origins; entries may use https://*.example.com |
[server] |
cors_allow_credentials |
false |
Emit Access-Control-Allow-Credentials: true (requires allowlist) |
[server] |
trust_proxy |
false |
Honor X-Forwarded-For/X-Real-IP/X-Forwarded-Proto |
[server] |
enable_websockets |
true |
Accept WebSocket upgrades on the HTTP port |
[server] |
enable_metrics |
false |
Expose Prometheus metrics on /metrics |
[server] |
max_request_body_bytes |
4194304 |
Reject POST /query bodies larger than this with 413 |
[server] |
request_timeout |
(none) | Per-request timeout in ms |
[server] |
rate_limit_rpm |
(none) | Per-client rate limit in requests/minute |
When no disc.toml is found, commands fall back to the current directory name as the project name. CLI flags always win over disc.toml, which wins over environment variables.
| Variable | Description | Used by |
|---|---|---|
DATABASE_URL |
PostgreSQL connection string | migrate, serve, db commands |
DISC_CACHE_MAX_SIZE |
Maximum query cache size | serve |
DISC_ENABLE_ACCESS_POLICIES |
Enable access policies (true/false) |
serve |
DISC_ENABLE_AUTH |
Enable authentication (true/false) |
serve |
DISC_ENABLE_METRICS |
Enable Prometheus metrics endpoint | serve |
DISC_HOST |
Server bind host | serve |
DISC_JWT_SECRET |
JWT signing secret | serve |
DISC_LOG_FORMAT |
Log format: text, json |
serve |
DISC_LOG_LEVEL |
Log level: debug, info, warn, error |
serve |
DISC_PORT |
Server bind port | serve |
DISC_RATE_LIMIT_REQUESTS |
Max requests per rate limit window | serve |
DISC_RATE_LIMIT_WINDOW_MS |
Rate limit window in milliseconds | serve |
DISC_SLOW_QUERY_MS |
Slow query threshold in milliseconds | serve |
DISC_TLS_CERT |
Path to TLS certificate | serve |
DISC_TLS_KEY |
Path to TLS private key | serve |
| Code | Meaning |
|---|---|
0 |
Success |
1 |
General error (invalid arguments, command failure, missing requirements) |
| Command | Description |
|---|---|
disc init [name] |
Initialize a new project |
disc start |
Start bundled PostgreSQL |
disc stop |
Stop bundled PostgreSQL |
disc restart |
Restart bundled PostgreSQL |
disc status |
Show PostgreSQL status and health |
disc migrate |
Generate and apply schema migrations |
disc serve |
Start the Disc server (includes PostgreSQL) |
disc shell |
Open interactive EdgeQL REPL |
disc codegen |
Generate a typed client (TypeScript, Rust, or Go) |
disc watch |
Watch schema files and auto-rebuild |
disc ui |
Open admin UI in browser |
disc build |
Compile to self-contained binary |
disc deploy --format <fmt> |
Generate deployment artifacts |
disc db create <name> |
Create a Disc-managed database |
disc db list |
List Disc-managed databases |
disc db drop <name> --force |
Drop a Disc-managed database |
disc db wipe <name> --force |
Drop and recreate a database (wipe to empty) |
disc db dump <name> |
Dump a database to stdout or a file |
disc db restore <name> |
Restore a database from stdin or a file |
disc db import <dir> |
Import a Gel CSV export (preserves UUIDs) |
disc db push --force |
Push schema directly (no migration history) |
disc schema export |
Export the current schema as a single SDL file |
disc schema introspect |
Generate SDL from an existing PostgreSQL database |
disc admin <subcommand> |
Manage users, roles, and access policies |
disc lsp |
Run the Disc language server (stdio JSON-RPC) |
disc pg log |
View PostgreSQL logs |
disc pg upgrade --target-version <v> |
Upgrade PostgreSQL version |
Every disc <command> invocation routes through one implementation (cli/commands.ts), and a stable subset of that surface is re-exported for use from Deno scripts -- CI pipelines, setup scripts, and test fixtures that need to drive Disc without spawning subprocesses.
import { CLI } from "disc";
await CLI.init({ name: "my-project", template: "basic" });
await CLI.migrate({ schema: "./dbschema/default.disc" });
await CLI.serve({ port: 5656, requireAuth: true });
| Function | Options type | Equivalent command |
|---|---|---|
CLI.build(opts) |
BuildOptions |
disc build |
CLI.deploy(opts) |
DeployOptions |
disc deploy |
CLI.init(opts) |
InitOptions |
disc init |
CLI.migrate(opts?) |
(inline, below) | disc migrate |
CLI.pgLog(opts) |
PgLogOptions |
disc pg log |
CLI.pgUpgrade(opts) |
PgUpgradeOptions |
disc pg upgrade |
CLI.serve(opts) |
ServeOptions |
disc serve |
CLI.shell(opts) |
ShellOptions |
disc shell |
CLI.watch(opts) |
WatchOptions |
disc watch |
Each Options interface is re-exported alongside its function, so editors resolve the shape without reaching into individual command modules:
import { CLI, type ServeOptions } from "disc";
const options: ServeOptions = { port: 5656, requireAuth: true };
await CLI.serve(options);
CLI.migrate() takes an inline options bag rather than a named interface, because the binary entry point passes it the positional-argument shape:
await CLI.migrate({
"backend-dsn": "postgres://user:pass@host:5432/disc", // optional
"dry-run": true, // generate without applying
quiet: true,
schema: "./dbschema/default.disc",
"schema-dir": "./dbschema"
});
All functions return Promise<void> and throw on failure -- there is no exit-code translation, so wrap calls in try/catch rather than checking a status.
Commands that take the bag-style CLIArgs shape -- the disc db subcommands, codegen, status, schema, admin, lsp -- are intentionally left out. They target operator workflows where the binary's argv parsing is the right interface. To script those, exec the binary.
The surface is a re-export, not a wrapper: adding a command here is non-breaking, while renaming or removing one is a breaking change. The binary's argv parser (cli/main.ts) is unaffected by anything on this page -- if you exec disc from CI today, nothing about that path changes.
(cli/api.ts, gh/geldata#5911)