CLI Reference

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

Running

Run

Runs your application.

$ encore run [--debug] [--watch=true] [flags]

Test

Tests your application

Takes all the same flags as go test.

$ encore test ./... [go test flags]

Check

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

$ encore check

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]

Init

Create a new Encore app from an existing repository

$ encore app init [name]

Link an Encore app with the server

$ encore app link [app-id]

Auth

Commands to authenticate with Encore

Login

Log in to Encore

$ encore auth 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.

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

Connection URI

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

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

Proxy

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

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

Reset

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

$ encore db reset [service-names...] [flags]

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 generates the API based on your primary environment. Use --env=local to generate it based on your local development version of the app.

Use --lang=<lang> to specificy 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>] [--services=foo,bar] [--excluded-services=baz,qux] [--lang=<lang>] [flags]

Logs

Streams logs from your application

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

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

Sets a secret value

$ 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>

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

VPN

VPN management commands

Start

Sets up a secure connection to private environments

$ encore vpn start

Status

Determines the status of the VPN connection

$ encore vpn status

Stop

Stops the VPN connection

$ encore vpn stop

Eject

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 eject docker

Flags --base string defines the base image to build from (default "scratch") --push pushes image to remote repository