CLI
#
InstallationChoose an installation method below that best fits your project or system requirements.
- cURL
- Node
#
Linux#
macOS#
WindowsRun cmd.exe
as an administrator, then:
After installation, make sure that %ProgramFiles%\platter
is included in your %PATH%
for ease-of-use.
npm
#
yarn
#
Installing platter
globally (i.e. with the --global
flag) through npm
is not recommended. For Node projects, it's best to pin the platter
CLI version to a project and use npx
to invoke platter
, e.g.:
If you would like to use platter
outside of a Node project, use one of the cURL
installation methods.
#
Resource CommandsAll resources (e.g. postgres
) have their own set of common subcommands available. To see which subcommands are available, you can always use platter <resource> --help
.
Platter resources expose the same top-level commands, which can be invoked with platter <resource> <command>
, e.g. platter postgres create
. Supported commands:
create
#
Creates a new instance of a resource along with a trunk branch. When --client
s are included, client configurations are added to the configuration file and generated in configured target directories.
list
#
Lists active resource instances.
delete
#
Deletes a single resource instance by name.
#
Branch CommandsBranches of a resource can also be managed through a branch
subcommand, e.g. platter postgres branch create
. Supported commands:
create
#
Creates a new branch of an existing instance of a resource.
list
#
Lists active branches, grouped by resource instance.
delete
#
Deletes a single branch.
url
#
If a resource branch can be accessed directly without a client, then url
returns the stable URL for direct access. URLs are resource-specific, e.g. Postgres URLs are in standard Connection URI format of postgresql://[user[:password]@][host][:port][,...][/dbname][?param1=value1&...]
#
Client CommandsSome instances are connected to specific projects. The client
subcommands allows for different connection methods within a single project by handling configuration and client generation separately from instance creation.
Most clients will be created through the --client
flags in the create
command, but these commands exist separately where needed.
configure
#
Adds configuration for a single client to the configuration file.
generate
#
Generates clients that have been previously created and configured. This command accepts instance
and directory
filters for generating specific clients.
#
File CommandsSome instances are connected to specific non-JavaScript projects that require more flexibility than the built-in Node and Web clients allow. The file
subcommands allows for different connection methods within a single project by injecting branch URLs into configuration files. These command support either JSON or .env
/dotenv-style configuration files.
Most files will be created through the --file
flags in the create
command, but these commands exist separately where needed.
configure
#
Adds configuration for a single file to the configuration.
generate
#
Generates files that have been previously created and configured. This command accepts instance
, key
, and file
filters for generating specific files.
#
Development CommandsIn addition to resource management commands, the following commands are provided to help with generating clients in git
repositories with a platter
configuration entry in package.json
.
build
#
Builds new clients for a branch using the current active git
branch, falling back to git
's init.defaultbranch
configuration or to main
. Will fail if the branch does not already exist.
If <resource>
is omitted (i.e. platter build
), all configured clients across all resources are built.
watch
#
Runs branch create
and build
for each resource in the configuration file using the previous git
branch as the parent of new branches and the current git
branch as the name of new branches. The process is repeated every time the git
branch changes, making sure that your local clients, remote branches, and version control never get out of sync while building new features. For more information on the watch
command and auto-branching, see Branching.
#
Special Commandsidentity
is a special resource that only contains a login
command for logging in as a specific user. You should only need to use this command to change active users.