partykit Command Line Interface allows you to develop, deploy and manage your PartyKit projects from your terminal, and automate deployment workflows in your Continuous Integration environments.
Install the PartyKit CLI with
npm (or substitute your preferred Node package manager):
npm install partykit@latest
This is a reference for the commands you can run in your terminal.
npx partykit init will add PartyKit to your existing
npm project. This will install the latest version of PartyKit into your project, create a
partykit.json configuration file, and example
server.ts you can use as starting points for your app.
It will use the name specified in your
package.json as the name of your project.
npx partykit dev will start a local development server. This will watch your code for changes, and automatically restart the server when you make changes.
It will use the file specified in the
main field in your
partykit.json file as the entry point for your project. Alternately, you can pass the entry point as an argument to the command, like this:
npx partykit dev src/server.ts
npx partykit deploy will deploy your code on to the PartyKit platform. It will use the file specified in the
main field in your
partykit.json file as the entry point for your project, and the
name field as the name of the project. Alternately, you can pass the entry point and name as arguments to the command, like this:
npx partykit deploy src/server.ts --name my-project
npx partykit tail will tail the logs for your project.
This is useful for debugging issues, while looking at live traffic including logs and errors. You can also pass the name of the project as an argument to the command, like this:
npx partykit tail --name my-project
npx partykit list will list all the projects that you’ve published on to the platform.
npx partykit delete will delete a project that you’ve published on to the platform.
You can also pass the name of the project as an argument to the command, like this:
npx partykit delete --name my-project
npx partykit env <command> commands allow you to manage environment variables available to PartyKit projects deployed via
For a more comprehensive guide, see Managing environment variables with PartyKit.
npx partykit env list will list all the environment variable keys you’ve configured in your project.
npx partykit env add <key> will create or update an environment variable. The name of the variable will be the value of the
key argument, and the CLI will prompt you for a value.
You need to run
npx partykit deploy again for the newly added variable to become available.
npx partykit env remove <key> will remove an environment variable from the PartyKit platform.
The value will continue to be available to previously deployed projects until you run
npx partykit deploy again.
npx partykit env pull [filename] will write all environment variable keys and values you’ve configured in your project into a JSON file.
filename is not provided,
env pull will update your
partykit.json configuration file.
npx partykit env push will read all environment variable keys and values you’ve configured in your
partykit.json and deploy them to the PartyKit platform.
You need to run
npx partykit deploy again for the newly pushed variables to take effect.
npx partykit login will authenticate you with the PartyKit service.
Running this command will open a browser window where you can authenticate yourself with your GitHub account.
npx partykit logout will log you out of the PartyKit service.
npx partykit whoami will display the currently logged in user.
npx partykit token generate will generate a new OAuth token you can use to grant access to deploy on your behalf. This is useful for tasks like deploying to PartyKit from GitHub Actions, or your Continuous Integration jobs. Each time you run the command, a new token will be generated.
Read more: Setting up CI/CD with GitHUb Actions