CLI Reference

The Encore CLI lets you run your local environment and much more.

Running

Run

Runs your application.

$ encore run [--debug] [--watch=true] [--port=4000] [--listen=<addr>] [flags]

Flags

FlagDescriptionDefault
-w, --watchWatch for changes and live-reloadtrue
--listenAddress to listen on (e.g. 0.0.0.0:4000)
-p, --portPort to listen on4000
--jsonDisplay logs in JSON formatfalse
-n, --namespaceNamespace to use (defaults to active namespace)
--colorWhether to display colorized outputauto-detected
--redactRedact sensitive data in traces when running locallyfalse
-l, --levelMinimum log level to display (trace\|debug\|info\|warn\|error)
--debugCompile for debugging (enabled\|break)
--browserOpen local dev dashboard in browser on startup (auto\|never\|always)auto

Test

Tests your application.

Runs the test script defined in your package.json.

$ encore test [flags]

Additional flags recognized by encore test:

FlagDescription
--codegen-debugDump generated code (for debugging Encore's code generation)
--preparePrepare for running tests without running them
--traceWrite trace information about the parse and compilation process to a file
--no-colorDisable colorized output

Check

Checks your application for compile-time errors using Encore's compiler.

$ encore check [flags]

Flags

FlagDescription
--codegen-debugDump generated code (for debugging Encore's code generation)
--testsParse tests as well

Exec

Runs executable scripts against the local Encore app.

Takes a command that it will execute with the local Encore app environment setup.

$ encore exec -- <command>

Flags

FlagDescription
-n, --namespaceNamespace to use (defaults to active namespace)
Example

Run a database seed script

$ encore exec -- npx tsx ./seed.ts

App

Commands to create and link Encore apps

Clone

Clone an Encore app to your computer

$ encore app clone [app-id] [directory]

Create

Create a new Encore app

$ encore app create [name] [flags]

Flags

FlagDescriptionDefault
--exampleURL to example code to use
-l, --langProgramming language to use for the app
-r, --llm-rulesInitialize the app with LLM rules for a specific tool
--platformWhether to create the app with the Encore Platformtrue

Init

Create a new Encore app from an existing repository

$ encore app init [name] [flags]

Flags

FlagDescription
-l, --langProgramming language to use for the app

Link an Encore app with the server

$ encore app link [app-id] [flags]

Flags

FlagDescription
-f, --forceForce link even if the app is already linked

Auth

Commands to authenticate with Encore

Login

Log in to Encore

$ encore auth login [flags]

Flags

FlagDescription
-k, --auth-keyAuth Key to use for login

Logout

Logs out the currently logged in user

$ encore auth logout

Signup

Create a new Encore account

$ encore auth signup

Whoami

Show the current logged in user

$ encore auth whoami

Daemon

Encore CLI daemon commands

Restart

If you experience unexpected behavior, try restarting the daemon using:

$ encore daemon

Env

Outputs Encore environment information

$ encore daemon env

Database Management

Database management commands

Connect to database via shell

Connects to the database via psql shell

Defaults to connecting to your local environment. Specify --env to connect to another environment.

Use --test to connect to databases used for integration testing. Use --shadow to connect to the shadow database, used for database drift detection when using tools like Prisma.

--test and --shadow imply --env=local.

$ encore db shell [DATABASE_NAME] [--env=<name>] [flags]

encore db shell defaults to read-only permissions. Use --write, --admin and --superuser flags to modify which permissions you connect with.

Flags

FlagDescriptionDefault
-n, --namespaceNamespace to use (defaults to active namespace)
-e, --envEnvironment name to connect tolocal
-t, --testConnect to the integration test database (implies --env=local)false
--shadowConnect to the shadow database (implies --env=local)false
--writeConnect with write privilegesfalse
--adminConnect with admin privilegesfalse
--superuserConnect as a superuserfalse

Connection URI

Outputs a database connection string. Defaults to connecting to your local environment. Specify --env to connect to another environment.

$ encore db conn-uri [<db-name>] [--env=<name>] [flags]

Flags

FlagDescriptionDefault
-n, --namespaceNamespace to use (defaults to active namespace)
-e, --envEnvironment name to connect tolocal
-t, --testConnect to the integration test database (implies --env=local)false
--shadowConnect to the shadow database (implies --env=local)false
--writeConnect with write privilegesfalse
--adminConnect with admin privilegesfalse
--superuserConnect as a superuserfalse

Proxy

Sets up local proxy that forwards any incoming connection to the databases in the specified environment.

$ encore db proxy [--env=<name>] [flags]

Flags

FlagDescriptionDefault
-n, --namespaceNamespace to use (defaults to active namespace)
-e, --envEnvironment name to connect tolocal
-p, --portPort to listen on (defaults to a random port)0
-t, --testConnect to the integration test database (implies --env=local)false
--shadowConnect to the shadow database (implies --env=local)false
--writeConnect with write privilegesfalse
--adminConnect with admin privilegesfalse
--superuserConnect as a superuserfalse

Reset

Resets the databases for the given services. Use --all to reset all databases.

$ encore db reset <database-names...|--all> [flags]

Flags

FlagDescriptionDefault
-n, --namespaceNamespace to use (defaults to active namespace)
--allReset all services in the applicationfalse
-t, --testReset databases in the test cluster insteadfalse
--shadowReset databases in the shadow cluster insteadfalse

Code Generation

Code generation commands

Generate client

Generates an API client for your app. For more information about the generated clients, see this page.

By default, encore gen client generates the client based on the version of your application currently running in your local environment. You can change this using the --env flag and specifying the environment name.

Use --lang=<lang> to specify the language. Supported language codes are:

  • go: A Go client using the net/http package
  • typescript: A TypeScript client using the in-browser Fetch API
  • javascript: A JavaScript client using the in-browser Fetch API
  • openapi: An OpenAPI spec
$ encore gen client [<app-id>] [--env=<name>] [--lang=<lang>] [flags]

Flags

FlagDescriptionDefault
-l, --langLanguage to generate code for
-o, --outputFilename to write the generated client code to
-e, --envEnvironment to fetch the API forlocal
-s, --servicesNames of the services to include in the output
-x, --excluded-servicesNames of the services to exclude in the output
-t, --tagsNames of endpoint tags to include in the output
--excluded-tagsNames of endpoint tags to exclude in the output
--openapi-exclude-private-endpointsExclude private endpoints from the OpenAPI specfalse
--ts:shared-typesImport types from ~backend instead of re-generating themfalse
--targetAn optional target for the client (leap)

Logs

Streams logs from your application

$ encore logs [--env=prod] [--json] [flags]

Flags

FlagDescription
-e, --envEnvironment name to stream logs from (defaults to the primary environment)
--jsonWhether to print logs in raw JSON format
-q, --quietWhether to print initial message when the command is waiting for logs

Kubernetes

Kubernetes management commands

Configure

Updates your kubectl config to point to the Kubernetes cluster(s) for the specified environment

$ encore k8s configure --env=ENV_NAME

Secrets Management

Secret management commands

Set

Set a secret value for a specific environment:

$ encore secret set --env <env-name> <secret-name>

Set a secret value for an environment type:

$ encore secret set --type <types> <secret-name>

Where <types> defines which environment types the secret value applies to. Use a comma-separated list of production, development, preview, and local. Shorthands: prod, dev, pr.

Examples

Entering a secret directly in terminal:

$ encore secret set --type dev MySecret
Enter secret value: ...
Successfully created secret value for MySecret.

Piping a secret from a file:

$ encore secret set --type dev,local MySecret < my-secret.txt
Successfully created secret value for MySecret.

Note that this strips trailing newlines from the secret value.

List

Lists secrets, optionally for a specific key

$ encore secret list [keys...]

Archive

Archives a secret value

$ encore secret archive <id>

Unarchive

Unarchives a secret value

$ encore secret unarchive <id>

Namespaces

Manage infrastructure namespaces for isolating local infrastructure. See Infrastructure Namespaces for more details.

List

List infrastructure namespaces

$ encore namespace list [--output=columns|json]

Create

Create a new infrastructure namespace

$ encore namespace create NAME

Delete

Delete an infrastructure namespace

$ encore namespace delete NAME

Switch

Switch to a different infrastructure namespace. Subsequent commands will use the given namespace by default.

Use - as the namespace name to switch back to the previously active namespace.

$ encore namespace switch [--create] NAME

Flags

FlagDescription
-c, --createCreate the namespace before switching

Config

Gets or sets configuration values for customizing the behavior of the Encore CLI.

Configuration options can be set both for individual Encore applications, as well as globally for the local user.

$ encore config <key> [<value>] [flags]

When running encore config within an Encore application, it automatically sets and gets configuration for that application. To set or get global configuration, use the --global flag.

Flags

FlagDescription
--allView all settings
--appSet the value for the current app
--globalSet the value at the global level

Telemetry

Reports the current telemetry status

$ encore telemetry

Enable

Enables telemetry reporting

$ encore telemetry enable

Disable

Disables telemetry reporting

$ encore telemetry disable

MCP

MCP (Model Context Protocol) commands for integrating with AI assistants. See MCP for more details.

Start

Starts an SSE-based MCP session and prints the SSE URL

$ encore mcp start [--app=<app-id>]

Run

Runs a stdio-based MCP session

$ encore mcp run [--app=<app-id>]

Random

Utilities for generating cryptographically secure random data.

UUID

Generates a random UUID (defaults to version 4)

$ encore rand uuid [-1|-4|-6|-7]

Flags

FlagDescription
-1, --v1Generate a version 1 UUID
-4, --v4Generate a version 4 UUID (default)
-6, --v6Generate a version 6 UUID
-7, --v7Generate a version 7 UUID

Bytes

Generates random bytes and outputs them in the specified format

$ encore rand bytes BYTES [-f <format>]

Flags

FlagDescriptionDefault
-f, --formatOutput format (hex\|base32\|base32hex\|base32crockford\|base64\|base64url\|raw)hex
--no-paddingOmit padding characters from base32/base64 outputfalse

Words

Generates random 4-5 letter words for memorable passphrases

$ encore rand words [--sep=SEPARATOR] NUM

Flags

FlagDescriptionDefault
-s, --sepSeparator between words (space)

Deploy

Deploy an Encore app to a cloud environment.

Requires either --commit or --branch to be specified.

$ encore deploy --env=<env-name> (--commit=<sha> | --branch=<name>) [flags]

Flags

FlagDescriptionDefault
--appApp slug to deploy to (defaults to current app)
-e, --envEnvironment to deploy to (required)
--commitCommit SHA to deploy
--branchBranch to deploy
-f, --formatOutput format (text\|json)text

Version

Reports the current version of the encore application

$ encore version

Update

Checks for an update of encore and, if one is available, runs the appropriate command to update it.

$ encore version update

Build

Generates an image for your app, which can be used to self-host your app.

Docker

Builds a portable Docker image of your Encore application.

$ encore build docker IMAGE_TAG [flags]

Flags

FlagDescriptionDefault
--baseBase image to build fromscratch
-p, --pushPush image to remote repositoryfalse
--cgoEnable cgofalse
--configInfra configuration file path
--skip-configDo not read or generate an infra configuration filefalse
--servicesServices to include in the image
--gatewaysGateways to include in the image
--osTarget operating systemlinux
--archTarget architecture (amd64\|arm64)amd64

LLM Rules

Generate LLM rules in an existing app

Init

Initialize the LLM rules files

$ encore llm-rules init [flags]

Flags

FlagDescription
-r, --llm-rulesInitialize the app with LLM rules for a specific tool (cursor\|claudecode\|vscode\|agentsmd\|zed)