![]() |
MantisBase v0.4.9
|
MantisBase has a comprehensive CLI built on argparse for server management, admin accounts, migrations, and schema operations.
Only one subcommand may be used per invocation: serve, admins, migrations, or schema.
These options can appear before the subcommand:
| Option | Alias | Description | Default | Env override |
|---|---|---|---|---|
| --migrations-dir <path> | --migrationsDir | Migrations directory | ./migrations | — |
| --data-dir <path> | --dataDir | Data storage directory | ./data | — |
| --public-dir <path> | --publicDir | Static file directory | ./public | — |
| --scripts-dir <path> | --scriptsDir | JavaScript extensions directory | ./scripts | — |
| --disable-scripting | --no-scripting | Skip JavaScript VM init and script load at runtime | off | MB_SCRIPTING_DISABLED=1 |
| --dev | Enable verbose development logging | off | MB_LOG_LEVEL | |
| --db <type> | MbDatabase type (sqlite3, postgresql, mysql) | sqlite3 | MB_DATABASE_TYPE | |
| --db_url <url> | MbDatabase connection string | (empty) | MB_DATABASE_URL |
When an environment variable is set, it overrides the matching CLI option. For logging, MB_LOG_LEVEL (trace, debug, info, warn, critical) overrides --dev.
Start the HTTP server.
| Option | Description | Default |
|---|---|---|
| --host | Bind address | 0.0.0.0 |
| --port | Listen port | 7070 |
| --pool-size | MbDatabase connection pool size (--poolSize) | 4 (sqlite3), 10 (postgresql) |
| --skip-admin-setup | Skip first-boot admin browser setup | off |
MB_SKIP_ADMIN_SETUP=1 also skips admin setup (even without the flag).
| Env variable | Description |
|---|---|
| MB_CORS_ORIGINS | Comma-separated browser origins allowed for cross-origin API requests with credentials. Merged with corsAllowedOrigins from app settings. Requires a server restart to pick up changes (unlike PATCH settings). Example: http://localhost:3000,https://app.example.com |
See REST API Reference — CORS for runtime updates via settings PATCH.
SMTP credentials are not an environment variable. Set them in the admin dashboard at /mb/settings, with PATCH /api/v1/sys/settings/config, or from a startup script with app.settings().set("smtp", ...). The mailer picks up the change immediately. See REST API Reference — SMTP.
Example:
Manage admin accounts. Exactly one of --add, --ls, or --rm is required.
| Option | Description |
|---|---|
| --add <email> <password> | Create a new admin user |
| --ls | List admin accounts |
| --rm <identifier> | Remove admin by email or id |
Examples:
Manage entity schemas locally (without the HTTP API). Exactly one of --ls, --rm, --add, or --update is required.
| Option | Description |
|---|---|
| --ls | List schemas in a table view |
| --rm <entity> | Drop entity schema and table |
| --add <json> | Create schema from JSON file or inline JSON |
| --update <entity> <json> | Update schema from JSON file or inline JSON |
Examples:
Exactly one of apply or schema is required.
Apply or rollback migrations from the migrations directory. Exactly one of --up or --down is required.
| Option | Description |
|---|---|
| --up | Apply sorted *.json migration files from --migrations-dir |
| --down | Rollback migrations (not yet implemented) |
Example:
Create or load schema dump from a given .json file. Exactly one of --to or --from is required.
NB: file.json can be an absolute path or a relative path.
| Option | Description |
|---|---|
| --to | Dump current schema to <file.json> |
| --from | Load schema from the provided <file.json> |
Example: