Global Flags
These flags are available for all commands and should be specified before the command name.The PocketBase data directory where your database, migrations, and settings are stored.
The environment variable name whose value (32 characters) will be used as the encryption key for app settings.
Enable development mode, which prints logs and SQL statements to the console for debugging.
The default timeout for SELECT queries in seconds.
serve
Starts the PocketBase web server with optional automatic HTTPS via Let’s Encrypt.Usage
Flags
TCP address to listen for HTTP requests.
- Default (no domains):
127.0.0.1:8090 - Default (with domains):
0.0.0.0:80
TCP address to listen for HTTPS requests with automatic TLS certificate management via Let’s Encrypt.
- Default (no domains): empty (no TLS)
- Default (with domains):
0.0.0.0:443
CORS allowed domain origins list. Use this to restrict which domains can access your PocketBase API.
Domain Parameters
When you provide domain names as arguments, PocketBase automatically:- Obtains and manages Let’s Encrypt TLS certificates
- Sets default HTTP address to
0.0.0.0:80 - Sets default HTTPS address to
0.0.0.0:443 - Redirects HTTP traffic to HTTPS
For automatic HTTPS to work, your domain(s) must point to your server’s public IP address and ports 80 and 443 must be accessible.
superuser
Manage superuser accounts for administrative access to your PocketBase instance.superuser create
Creates a new superuser account.superuser update
Changes the password of an existing superuser.superuser upsert
Creates a new superuser or updates the password if the email already exists.superuser delete
Deletes an existing superuser account.superuser otp
Creates a new one-time password (OTP) for the specified superuser account.OTP authentication must be enabled for the
_superusers collection for this command to work. The OTP length and validity duration are configured in the collection settings.migrate
Executes database migration scripts. This command is available when themigratecmd plugin is registered.
Usage
Commands
up
Runs all available migrations that haven’t been applied yet.
down [number]
Reverts the last
[number] applied migrations.create [name]
Creates a new blank migration template file with the specified name.
collections
Creates a new migration file with a snapshot of the current collections configuration.This is useful for version controlling your schema changes.
history-sync
Ensures that the
_migrations history table doesn’t have references to deleted migration files.Examples
Migration files are created in the
migrations/ directory by default (Go templates) or pb_migrations/ (JavaScript templates). The directory can be customized via plugin configuration.update
Automatically updates the current PocketBase executable with the latest available version from GitHub releases. This command is available when theghupdate plugin is registered.
Flags
Creates a backup of the
pb_data directory at the end of the update process.Process
When you run the update command, PocketBase will:- Fetch the latest release information from GitHub
- Compare versions and skip if already up to date
- Download the appropriate release for your platform
- Extract the new executable
- Replace the current executable
- Create a backup (if
--backup=true) - Display release notes