Prisma Environment

Prisma Environment

Table of Contents

Prisma seems interesting now I stumbled into PDP:

Mail says:

Welcome to Prisma Data Platform! 🎉

Thanks for signing up, we’re thrilled to have you on board.
What now?

🧑‍💻  Manage your projects and your account from the Platform Console

Get start with PRISMA https://www.prisma.io/docs/getting-started

alt text

Here you will find multiple of things!

Prisma Data Platform:

PDP is an ecosystem of products built on top of the Prisma ORM to simplify developing data-driven applications. Offering simple, managed solutions for complex problems, to help you build and grow applications, regardless of team size.

Step 1 SignUp:

https://console.prisma.io/sign-up

Step 2: The Dashboard:

alt text

Prisma Postgres® (Early Access)

alt text

To use PDP we need an existing database, those can be found at Neon.tech, Supabase, Vercel. But here Prisma is providing there own Postgres database server.

Let’s get started:

After clicking Get started, you’ll need to choose the region, currently there are 3 regions from which you can select.

alt text

Create Database!

alt text

alt text

Query your database

Run a sample query using the Prisma ORM to verify your database connection and add some sample data.

$ npm run queries

Explore your database in Prisma Studio

Open Prisma Studio to visually browse and interact with your newly seeded database.

$ npx prisma studio

Try caching with Prisma Accelerate

Run the following command to explore caching capabilities using Accelerate to boost your query performance. Run the script a few times to observe increased query performance.

$ npm run caching

Stream events with Prisma Pulse

Set up a real-time data stream with Pulse. Run the command below, then create a new user in Prisma Studio and watch the event in real-time.

$ npm run realtime

Setup Complete!

Testing the database:

npx try-prisma@latest --template databases/prisma-postgres --name hello-prisma --install npm

This will install all the dependencies and create sample project.

cd into the hello-prisma and add the variables to .env file

DATABASE_URL="" PULSE_API_KEY=""

After then run the migration:

npx prisma migrate dev --name init
Your database is now in sync with your schema.
npm run queries

Output from queries:

Created users: Alice (1 post) and Bob (2 posts) 
Retrieved all published posts: [{"id":1,"title":"Join the Prisma community on Discord","content":"https://pris.ly/discord","published":true,"authorId":1},{"id":2,"title":"Check out Prisma on YouTube","content":"https://pris.ly/youtube","published":true,"authorId":2}]
Created a new post: {"id":4,"title":"Join the Prisma Discord community","content":"https://pris.ly/discord","published":false,"authorId":1}
Published the newly created post: {"id":4,"title":"Join the Prisma Discord community","content":"https://pris.ly/discord","published":true,"authorId":1}
Retrieved all posts from a specific user: [{"id":1,"title":"Join the Prisma community on Discord","content":"https://pris.ly/discord","published":true,"authorId":1},{"id":4,"title":"Join the Prisma Discord community","content":"https://pris.ly/discord","published":true,"authorId":1}]

After verifying the setup you can navigate to workspace.

Here are the features available.

alt text

Examples to get started with the features.

alt text

Prisma Accelerate is a fully managed global connection pool and caching layer for your existing database, enabling query-level cache policies directly from the Prisma ORM.

1GB!

alt text

Tags :