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]

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 [service-name] [--env=local]

Connection URI

Outputs the database connection string

$ encore db conn-uri [servicename] [flags]

Proxy

Sets up a proxy tunnel to the database

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

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
$ encore gen client <app-id> [--env=prod] [flags]

Logs

Streams logs from your application

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

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.

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