CLI Reference¶
The plattr CLI is the developer interface to the platform. Install it with npm install -g @plattr/cli.
Commands¶
plattr init¶
Initialize a new app for the platform.
Interactive prompts:
1. App name (lowercase alphanumeric with hyphens)
2. Framework (auto-detected: nextjs, rails, static, docker)
3. Enable database?
4. Enable storage?
5. Enable authentication?
6. Enable Redis cache?
7. Enable OpenSearch?
Creates:
- plattr.yaml — app configuration
- .github/workflows/plattr-deploy.yml — CI/CD pipeline
plattr dev¶
Set up local infrastructure and prepare the environment for development.
| Option | Description | Default |
|---|---|---|
-p, --port <port> |
Port hint (reserved for future use) | 3000 (or local.port from config) |
What it does:
- Creates a local Kind cluster (if not already running)
- Starts a local container registry on port 5050
- Applies Kubernetes manifests for enabled services (PostgreSQL, PostgREST, MinIO, Keycloak, Redis, OpenSearch)
- Waits for all services to be ready
- Sets up database schema and roles
- Creates storage buckets
- Starts detached
kubectl port-forwardprocesses - Writes environment variables to
.plattr/{appName}.env - Prints export commands and service URLs
Important: plattr dev does not start your application's dev server. After it completes, source the env file and start your dev server manually:
Services started (conditional on plattr.yaml):
| Service | Port | Condition |
|---|---|---|
| PostgreSQL | 5432 | Always |
| PostgREST | 3001 | database.enabled: true |
| MinIO | 9000, 9001 | storage.enabled: true |
| Keycloak | 8080 | auth.enabled: true |
| Redis | 6379 | redis.enabled: true |
| OpenSearch | 9200 | search.enabled: true |
| OpenSearch Dashboards | 5601 | search.enabled: true |
State files (in .plattr/ directory):
- {appName}.env — environment variables (sourceable)
- {appName}.pids — port-forward process IDs
plattr test¶
Run tests against local infrastructure.
| Option | Description | Default |
|---|---|---|
--ci |
Run Dagger-based ephemeral tests (clean state) | false |
Without --ci (default): Auto-detects the test runner and runs tests locally using the environment from .plattr/{appName}.env. Checks that infrastructure is running before starting.
Supported test runners (auto-detected):
- Vitest — detects vitest.config.{ts,js,mts}
- Jest — detects jest.config.{ts,js,mjs}
- npm test — uses package.json test script (if it exists and isn't the default)
- RSpec — detects spec/**/*.rb (Rails)
- Minitest — detects test/**/*.rb (Rails)
With --ci: Runs dagger call test --source=. for fully ephemeral tests with clean database state.
Example:
# Run local tests (requires plattr dev running)
plattr test
# Run ephemeral tests via Dagger
plattr test --ci
plattr build¶
Build a production container image.
Runs dagger call build --source=. to produce an optimized production image based on the detected framework.
plattr deploy local¶
Build, test, scan, and deploy the app to the local Kind cluster.
| Option | Description | Default |
|---|---|---|
-p, --port <port> |
Port for the deployed app | 3000 (or local.port from config) |
--skip-tests |
Skip the test step | false |
--skip-scan |
Skip the Trivy security scan | false |
--fail-on-scan |
Exit with error if vulnerabilities found (no prompt) | false |
Pipeline steps:
- Tests — Auto-detects and runs tests (skippable with
--skip-tests) - Build — Builds production image via Dagger
- Push — Pushes image to local registry (
localhost:5050) - Security Scan — Runs Trivy scan for HIGH/CRITICAL vulnerabilities (skippable with
--skip-scan) - Deploy — Applies Kubernetes manifests (ConfigMap, Deployment, Service) and waits for rollout
- Port-forward — Starts a detached port-forward to the deployed app
Example:
# Full pipeline
plattr deploy local
# Quick deploy (skip tests and scan)
plattr deploy local --skip-tests --skip-scan
# CI-style (fail on vulnerabilities)
plattr deploy local --fail-on-scan
plattr undeploy local¶
Remove the app deployment from the local Kind cluster.
Kills tracked port-forward processes and deletes the Deployment, Service, and ConfigMap from the cluster. Does not remove the infrastructure (PostgreSQL, MinIO, etc.) — use plattr infra destroy for that.
plattr infra status¶
Show local infrastructure status.
Displays all pods in the plattr-local namespace.
plattr infra stop¶
Stop local infrastructure (data preserved).
Kills port-forward processes and scales all deployments to zero replicas. Data in persistent volumes is preserved. Run plattr dev to restart.
plattr infra start¶
Start local infrastructure.
Scales all deployments back to one replica. Use this after plattr infra stop to resume without a full plattr dev cycle.
plattr infra destroy¶
Delete local cluster and all data.
Kills port-forward processes, clears all state files (.plattr/), deletes the Kind cluster, and removes the local container registry. All data is lost. Run plattr dev to recreate from scratch.
plattr preview start¶
Start a local preview environment for a pull request.
| Option | Description | Default |
|---|---|---|
--pr <number> |
Pull request number (required) | — |
-p, --port <port> |
Port for the preview app | 3100 |
Creates an isolated environment with PR-specific database schema and storage.
Example:
plattr preview list¶
List active remote preview environments.
Output:
PR App Phase URL Expires
42 my-app Running https://pr-42.my-app.preview.company.dev 2024-01-15T12:00:00Z
Queries PreviewEnvironment CRDs via kubectl.
plattr db migrate¶
Run database migrations.
| Option | Description | Default |
|---|---|---|
--engine <engine> |
Migration engine: prisma, knex, raw |
Auto-detect |
Engines:
- prisma — runs npx prisma migrate deploy
- knex — runs npx knex migrate:latest
- raw — executes .sql files from the migrations directory
Example:
plattr db seed¶
Seed the database with test data.
| Option | Description | Default |
|---|---|---|
--file <path> |
Path to seed file | seed.sql |
Example:
plattr db shell¶
Open an interactive psql shell connected to the local database.
plattr db connect¶
Connect to a remote database via psql.
| Option | Description | Default |
|---|---|---|
--env <environment> |
Target environment | production |
Retrieves the DATABASE_URL from the Kubernetes Secret ({appName}-db) and opens an interactive psql session.
Example:
plattr db reset¶
Reset the local database (deletes all data).
Deletes the persistent volume claim and restarts the PostgreSQL deployment. Run plattr dev to recreate schemas.
plattr redis reset¶
Reset local Redis (deletes all data).
Deletes the persistent volume claim and restarts the Redis deployment.
plattr search reset¶
Reset local OpenSearch (deletes all data).
Deletes the persistent volume claim and restarts the OpenSearch deployment.
plattr status¶
Show application status and conditions.
| Option | Description | Default |
|---|---|---|
--env <environment> |
Target environment | production |
--pr <number> |
PR number (for preview envs) | — |
Output:
Application: my-app
Environment: production
Phase: Running
URL: https://my-app.platform.company.dev
Conditions:
DatabaseReady
StorageReady
AuthReady
DeploymentReady
IngressReady
Example:
plattr logs¶
Stream application logs.
| Option | Description | Default |
|---|---|---|
--env <environment> |
Target environment | production |
-f, --follow |
Stream logs continuously | false |
--tail <lines> |
Number of recent lines to show | All |
--pr <number> |
PR number (for preview envs) | — |
Runs kubectl logs with --all-containers to include both app and PostgREST sidecar logs.
Example:
plattr env set¶
Set one or more environment variables.
| Option | Description | Default |
|---|---|---|
--env <environment> |
Target environment | production |
Creates or updates a ConfigMap ({appName}-env) and restarts the Deployment to apply changes.
Example:
plattr env set API_KEY=abc123
plattr env set API_KEY=abc123 FEATURE_FLAG=true
plattr env set --env staging DEBUG=true
plattr env list¶
List all environment variables (Plattr-managed and user-defined).
| Option | Description | Default |
|---|---|---|
--env <environment> |
Target environment | production |
Example:
plattr env unset¶
Remove an environment variable.
| Option | Description | Default |
|---|---|---|
--env <environment> |
Target environment | production |
Removes the key from the ConfigMap and restarts the Deployment.
Example:
Environment Resolution¶
Commands that accept --env map environment names to Kubernetes namespaces:
--env value |
Namespace | Resource Name |
|---|---|---|
production |
production |
{appName} |
staging |
staging |
{appName} |
uat |
uat |
{appName} |
preview (with --pr) |
preview-{appName}-pr-{N} |
{appName}-pr{N} |
The app name is read from plattr.yaml in the current directory.