# Introducing Platform Environments URL: https://www.prisma.io/blog/introducing-platform-environments Published: 2024-02-22 Authors: Ankur Datta Tags: platform, announcement Description: Introducing Platform Environments & Early Access Prisma Data Platform integration to Prisma CLI. 🎉 We're thrilled to introduce Platform Environments and a new Early Access feature that enables accessing the Prisma Data Platform from the Prisma CLI! ## Design intuitive workflows with Platform Environments [#design-intuitive-workflows-with-platform-environments] Each Environment serves as an isolated space, enabling teams to build, test, and grow their projects across different stages of the development lifecycle. From initial experimentation to production, environments facilitate a seamless progression of application development. Ever thought how seamless your development could be with dedicated environments for your Prisma Data Platform projects? You're in good company! ![User requesting Environments](https://www.prisma.io/blog/introducing-platform-environments/imgs/f9a5925752a6c2fc40919aa77c4c648bcba905d4-1200x305.png) At Prisma, we're constantly striving to make your development journey smoother and more efficient. That's why we're excited to introduce Platform Environments 🎉. ### So what’s changed? [#so-whats-changed] Before Environments: ![Before Environments](https://www.prisma.io/blog/introducing-platform-environments/imgs/02e32d8486dc1aea98ab63bc49ca1d233e3186b7-1800x907.png) With Platform Environments, you can now create multiple environments within a single project, making it easier to manage various stages of your development lifecycle: ![After Environments](https://www.prisma.io/blog/introducing-platform-environments/imgs/9193bd9d3c0496e3e36f00bb6800dccf89f5d651-2155x907.png) This not only saves you time but also allows you to get more out of your existing projects. See the gains across all our plans: | Plan | Before Platform Environments | With Platform Environments | | ---------- | ---------------------------- | ---------------------------------------- | | Starter | 5 projects | 5 projects, 2 environments per project | | Pro | 10 projects | 10 projects, 6 environments per project | | Business | 15 projects | 15 projects, 12 environments per project | | Enterprise | Custom | Custom | > For more information on pricing, visit our [pricing page](https://www.prisma.io/pricing). ## Streamlining management of Prisma Data Platform projects from Prisma CLI ( Early Access ) [#streamlining-management-of-prisma-data-platform-projects-from-prisma-cli--early-access-] We're also excited to announce that the Prisma Data Platform is now accessible through the Prisma CLI, available in Early Access, offering programmatic access for streamlined management of platform resources and improved workflow efficiency. ![Prisma CLI x Prisma Data Platform](https://www.prisma.io/blog/introducing-platform-environments/imgs/8678791c42ed1bcbe418c3d592f64756a2e9a2cb-1344x1029.png) You can leverage the Prisma CLI to manage your databases for Prisma Accelerate and [Prisma Postgres](https://www.prisma.io/postgres). e.g. This works really well with workflows using branch-based databases. > What is Database branching? > Database branching lets you quickly create independent copies of your database for testing, development, data recovery, and other scenarios. Some popular database providers that allow you to add database branching in your workflows are [PlanetScale](https://planetscale.com/docs/concepts/branching), [Neon](https://neon.tech/docs/introduction/branching), and [Railway](https://docs.railway.app/guides/environments): ![Database branching](https://www.prisma.io/blog/introducing-platform-environments/imgs/a804b1270d904b50d3dd60d10d1e3a6cb80d6ac6-2380x907.png) Now let’s look at a simple example below. ### Enabling Prisma Accelerate for an environment using Prisma CLI [#enabling-prisma-accelerate-for-an-environment-using-prisma-cli] Let’s say you’re exploring caching to speed up your queries with Prisma Accelerate on a fresh feature branch. You want to ensure everything runs smoothly before rolling it out to production. Let's explore how to activate Prisma Accelerate for an Environment and tidy up resources effortlessly, all using the Prisma CLI. **Pre-requisites** Before diving in, ensure that you’ve installed the Prisma Accelerate client extension on the `feature` branch and meet all the [pre-requisites](https://www.prisma.io/docs/accelerate/getting-started#prerequisites) for using Prisma Accelerate. You also need to have [Prisma CLI](https://www.prisma.io/docs/orm/v7/reference/prisma-cli-reference) version **`5.10.0`** or later installed. You should also have a `.env` containing the `DATABASE_URL` : ```tsx DATABASE_URL="postgresql://janedoe:mypassword@localhost:5432/mydb?schema=sample" ``` **Access Prisma Data Platform** Let’s get started by authenticating into the Platform Console: ```tsx npx prisma platform auth login --early-access ``` > Note: The `--early-access` flag is essential until the feature is generally available. A browser window should pop-up prompting you to log in or create an account. Once authenticated, you will be instructed to head back to the CLI: ![Login pop-up](https://www.prisma.io/blog/introducing-platform-environments/imgs/8a292af17b608eb1a80eca022984869fe9a6d0a3-1920x1080.png) You can also check your login status by running: ```tsx npx prisma platform auth show --early-access ``` And the CLI should output: ```shell ## Output Currently authenticated as datta@prisma.io displayName : Ankur Datta id : clsdsdsdn0hadsdsd8yc email : datta@prisma.io ``` **Managing workspaces** With authentication complete, retrieve your workspace information: ```tsx npx prisma platform workspace show --early-access ``` You will get a list of all your workspaces: ```shell ## Output displayName : dev-adv-id id : $DEV_ADV_WORKSPACE_ID createdAt : 12/14/2023 displayName : test-workspace id : $TEST_WORKSPACE_ID createdAt : 2/23/2024 ``` Let’s use the workspace id for `test-workspace` for the demo. Store the `$TEST_WORKSPACE_ID` for the next step. **Exploring projects** View all projects within a workspace: ```tsx npx prisma platform project show --workspace $TEST_WORKSPACE_ID --early-access ``` The CLI will output the list of projects in the specified workspace ( `test-workspace` ): ```shell displayName : Glistening Purple Foal id : $PROJECT_ID_1 createdAt : 1/26/2024 displayName : Cuddly Azure Calf id : $PROJECT_ID_2 createdAt : 2/6/2024 displayName : Energetic Rose Dinosaur id : $PROJECT_ID_3 createdAt : 2/7/2024 displayName : Magical Ivory Pumpkin id : $PROJECT_ID_4 createdAt : 2/9/2024 displayName : Gift shop id : $PROJECT_ID_5 createdAt : 2/19/2024 ``` Now let’s set up a temporary environment in the `Gift shop` project. Store the project id (`$PROJECT_ID_5`), as we’ll also need that when creating a new environment. **Creating environments** To create an environment to test Prisma Accelerate, run: ```tsx npx prisma platform environment create --project $PROJECT_ID_5 --name "TEST PRISMA ACCELERATE" --early-access ``` And we should have an output confirming the successfully creation of the environment: ```shell Success! Environment TEST PRISMA ACCELERATE - $ENVIRONMENT_ID created. ``` Then copy the `$ENVIRONMENT_ID`, and then enable Prisma Accelerate for the `TEST PRISMA ACCELERATE` environment: ```tsx npx prisma platform accelerate enable -e $ENVIRONMENT_ID --url $PASTE_DATABASE_BRANCH_URL --region $REGION --apikey yes --early-access ``` > Setting the `apikey` to `yes` generates a new API key when Prisma Accelerate is enabled. The output should provide us with a Prisma Accelerate connection string. ```shell Success! Accelerate enabled. Use this Accelerate connection string to authenticate requests: prisma://accelerate.prisma-data.net?api_key=$PRISMA_ACCELERATE_API_KEY For more information, check out the Getting started guide here: https://pris.ly/d/accelerate-getting-started ``` **Testing Prisma Accelerate** Update the **`.env`** file with the Prisma Accelerate connection string: ```shell DATABASE_URL="prisma://accelerate.prisma-data.net/?api_key=__API_KEY__" ``` And then run your project and it should be working as expected! **Cleaning up** Once testing is complete, let’s delete the `TEST PRISMA ACCELERATE` environment, as deleting the environment removes associated resources. To tidy up resources, all you have to do is run: ```tsx npx prisma platform environment delete -p $INSERT_PROJECT_ID_5 -n "TEST PRISMA ACCELERATE" --early-access ``` Mission accomplished ✅! You can see that it was a breeze creating a new environment, enabling Prisma Accelerate and also cleaning up the resources. ## Explore and share your feedback! [#explore-and-share-your-feedback] To explore the comprehensive command list of the latest Prisma CLI integration, please refer to our documentation available [here](https://www.prisma.io/docs/cli/v7/console). Integrate the enhanced Prisma CLI into your workflow and share your experience with us via a [tweet](https://pris.ly/x), and if you encounter any challenges, don't hesitate to reach out in our [Discord](http://pris.ly/discord) and let us know!