Skip to main content

CLI

Stoker provides a CLI for working with your app.

This page provides an overview of the available CLI commands.

For details on the options for each command, run stoker <COMMAND> --help

Project Commands

These commands are covered in the Getting Started guide.

CommandDescription
init [options]Bootstrap a new Stoker project
set-projectSelect a project to work with. Must be used in conjunction with export GCP_PROJECT="<PROJECT_NAME>"
emulator-dataCopy live app data into the Firebase Emulator Suite
start [options]Start the Firebase Emulator Suite
start-web-appStart the web app Firebase Emulator Suite
build-web-appBuild the web app
applyApply schema to local environment
add-project [options]Add a Google Cloud project
delete-project [options]Delete a Google Cloud project. Be careful!
add-tenantAdd a tenant to a project
delete-tenant [options]Delete a tenant from a project. Be careful!

Custom Domain

custom-domain [options]

Set a custom domain for the project

tip

We recommend enabling DNSSEC and HSTS preload for your domain. These security features are configured outside of Stoker.

Data Commands

CommandDescription
exportExport Firestore data to Cloud Storage
bigquery [options]Export a Firestore collection to BigQuery
seed-data [options]Seed test data

CRUD Commands

CommandDescription
add-record [options]Add a record
add-record-prompt [options]Add a record to a collection using terminal prompts
update-record [options]Update a record. You only need to provide the fields that you want to update. To delete a field, set the field value to "_DELETE_FIELD"
delete-record [options]Delete a record
get-one [options]Get a record
get-some [options]Get multiple records

Audit Commands

CommandDescription
audit-permissions [options]Detect non-default permissions for roles
audit-denormalized [options]Audit denormalized data integrity
audit-relations [options]Audit relations data integrity
explain-preload [options]Explain / analyze preload cache queries

Google Cloud / Firebase Commands

CommandDescription
list-projectsList Google Cloud projects
set-user-role [options]Set the "role" custom claim for a user
set-user-collection [options]Set the "collection" custom claim for a user
set-user-document [options]Set the "doc" custom claim for a user
get-user [options]Retrieve a Firebase user
get-user-record [options]Retrieve a Firestore user record
get-user-permissions [options]Retrieve a Firestore user permissions record

Deployment Commands

These commands are run automatically when needed as part of stoker deploy.

CommandDescription
lint-schemaLint the Stoker schema
security-reportRun the security report
deployment [options]Toggle deployment status
maintenance [options]Toggle maintenance mode
live-update [options]Trigger a live update
persist-schemaPersist schema to Firebase
deploy-ttlsDeploy Firestore TTLs
generate-firestore-indexesGenerate Firestore indexes
generate-firestore-rulesGenerate Firestore security rules
generate-storage-rulesGenerate Cloud Storage security rules
migrateMigrate the database
deploy [options]Deploy project