V2

Getting Started with Triplit Cloud v2

⚠️

Triplit Cloud is currently in preview. There may be bugs, breaking changes, and other issues. Please report any issues you encounter or any feedback you have to our Github (opens in a new tab) or Discord (opens in a new tab).

ℹ️

To get access to Triplit Cloud, join our waitlist (opens in a new tab).

This tutorial will show you how to deploy a project to Triplit Cloud. It will cover

  1. How to authenticate with Triplit Cloud using the CLI
  2. How to deploy a project to Triplit Cloud
  3. How to monitor your deployment with the Triplit dashboard

Prerequisites

  • A Triplit project. If you don't have one, you can create one by following the Getting Started with Triplit guide.
  • The Triplit CLI. You can install it by running npm install -g @triplit/cli.

Authenticate with Triplit Cloud

To authenticate with Triplit Cloud, run the following command from inside your project directory:

triplit login

This will ask you to enter an email, and will send a one-time password to your email. After entering the one-time password, you will be authenticated with Triplit Cloud.

ℹ️

If you already have access to the Triplit Dashboard (opens in a new tab), make sure you enter the same email you used to sign up for the dashboard.

You'll also be asked to select an organization or create a new one. If you're part of an organization, you can select it from the list. If you're not part of an organization, you can create a new one.

Choose an organization to work with:

? Select an organization › - Use arrow-keys. Return to submit.
❯   Create a new organization

You can then run triplit whoami to verify that you are authenticated.

You're logged in as phil@superdev.com
You're currently working with the organization Super Dev Team
ℹ️

If you want to set up multiple organizations and switch between them, run triplit org.

Create and link to a cloud project

⚠️

If you've used Triplit Cloud in its prior iteration, your existing projects will be marked as "Legacy" in the dashboard and are wholly separate from the deploy flow described here. If you have any questions or need help, please reach out to us on Discord (opens in a new tab).

To deploy a project to Triplit Cloud, you need to create a cloud project. To create a cloud project, run the following command:

triplit project create

This will create a project in Triplit Cloud that will be associated with the current organization you're working with. This command will also create a triplit.config.json file in your project directory that looks like this:

triplit.config.json
{
  "id": "project-1234",
  "name": "my-project"
}
ℹ️

If at any time you want to change the cloud project that your local project is linked to, run triplit project link.

Copy in your environment variables

To connect the Triplit Client in your App to the Triplit Cloud project you created, you'll need to have a properly configured .env file in your project. You can view the environment variables from the Triplit Cloud project by running the following command:

triplit project manage

This will print a url to the Triplit Cloud dashboard where you can manage your project. You can then copy the environment variables from the dashboard and paste them into your .env file.

The Triplit Dashboard (overview page)

Deploy your project

This part's easy: just run triplit deploy. This will bundle your project, including it's ./triplit/schema.ts file, and deploy it to Triplit Cloud.

triplit deploy

If you've used a previous iteration of Triplit Cloud and are expecting to run various triplit migrate commands, these are no longer necessary. If you update your schema, simply run triplit deploy again and your changes will be reflected in the cloud.

Viewing your deployments

You can view your deployments in the Triplit Cloud dashboard. To open the dashboard, run the following command again:

triplit project manage

Go to the "Deployments" tab to see all of your deployments.

The Triplit Dashboard (deployments page)