trail CLI provides commands for managing your TrailBase server, users, migrations, and more.
Installation
Thetrail binary is included in TrailBase releases:
Global Options
These options work with all commands:Server Commands
Start Server
Start the HTTP server:First Run: On first startup, TrailBase creates admin credentials and displays them in the terminal. Save these to access the admin UI at
http://localhost:4000/_/admin.Server Options
Migration Commands
Create Migration
Generate a new migration file:traildepot/migrations/main/U1234567890__create_table_posts.sql
View Applied Migrations
Check which migrations have been applied:User Management
Create User
Add a new verified user:Users created via CLI are automatically verified and can log in immediately.
Change Password
Change Email
Verify Email
Manually verify a user’s email:Delete User
Invalidate Session
Force a user to re-login:Mint Auth Token
Generate an auth token for a user (useful for automation):Import Users
Import users from Auth0 or other providers:Admin Management
List Admins
Promote User to Admin
Demote Admin to User
You cannot demote yourself. Use another admin account or direct database access.
Schema Commands
Export JSON Schema
Generate JSON Schema for a table:Export OpenAPI Spec
Generate OpenAPI specification:Email Commands
Send emails programmatically:Email settings must be configured in
traildepot/config.textproto or via environment variables.Component Management
List Available Components
Show first-party WASM components:Install Component
List Installed Components
Update Components
Update all installed first-party components:Remove Component
Common Workflows
Development Setup
1
Start Server
2
Create Admin User
3
Create Schema
4
Generate Types
Production Deployment
1
Set Environment Variables
2
Run Server
3
Configure Reverse Proxy
Use nginx, Caddy, or similar to handle:
- TLS termination
- Request compression
- Static file caching
- Rate limiting
Database Backup
TrailBase automatically creates backups in
traildepot/backups/. These are SQLite database files that can be restored by copying them to traildepot/data/.Reset Admin Password
If you lose admin credentials:Test Configuration
Environment Variables
Override CLI options with environment variables:Configuration File
Main configuration file:traildepot/config.textproto
Example configuration:
traildepot/config.textproto
Logging
TrailBase logs to:traildepot/logs/trailbase.log- Main application logtraildepot/logs/access.log- HTTP access logstderr- With--stderr-loggingflag
Debugging
Verbose Logging
Test Database Queries
Health Check
Systemd Service
Run TrailBase as a systemd service:/etc/systemd/system/trailbase.service
Docker
Run TrailBase in Docker:docker-compose.yml
Next Steps
First App
Build your first application
Migrations
Learn about database migrations
Authentication
Manage users and auth
WASM Runtime
Extend with WebAssembly