This content originally appeared on DEV Community and was authored by Thomas Bnt ☕
Introduction
On October 29, Prisma announced Prisma Postgres. Don't hesitate to read the blog, useful information! 🙌
It is built from the ground up and deployed via unikernels (think: hyper-specialized OS) that are running as ultra-lightweight microVMs on our own bare metal servers.
Thanks to that architecture, we’re able to offer unique benefits that you don’t get anywhere else:
- A “serverless” database with pay-as-you-go pricing but no cold starts.
- A generous free tier that you can use to explore the service and build small projects.
- Thanks to the first-class integration with other Prisma products, you also get the following features out-of-the-box:
- Real-time database event streams
- Connection pooling
- Caching
- Query analysis and recommendations
Quick video presentation
How to use Prisma Postgres
Getting started: Get a new database
If you want, you have the Quickstart documentation about installing Prisma.
- Login into your Prisma Console account (it's free)
- Create a new project by clicking on the New project button
- Give it a beautiful name
- In the Prisma Postgres section, click to Get started
- Select a region, and click to Create project
- You now have your database ! 🥳
Setup your project
- Open your terminal
-
Execute this command if you want a template
npx try-prisma@latest --template databases/prisma-postgres --name hello-prisma --install npm
-
Install dependencies
thomasbnt@thomasbnt:~/lab$ npx try-prisma@latest --template databases/prisma-postgres --name beautiful-project --install npm Need to install the following packages: try-prisma@1.0.58 Ok to proceed? (y) y ✔ Loaded 59 templates ✔ Downloaded and extracted the databases/prisma-postgres project in ./beautiful-project. ✔ Installed packages in ./beautiful-project. The project is good to go! Next steps: 1. Navigate into ./beautiful-project to begin. 2. Refer to the project README for detailed instructions on running the project: https://github.com/prisma/prisma-examples/tree/latest/databases/prisma-postgres If you have any feedback about this specific template, we want to hear it! Submit any feedback here: https://pris.ly/prisma-examples-feedback thomasbnt@thomasbnt:~/lab$ cd beautiful-project/
Click on Generate database credentials and copying and pasting into your
.env
file in your project folder, but keep it private!
-
You can setup your database with a migration
npx prisma migrate dev --name init
Optional: If you want sample data:
npm run queries
You can now see your database with the
npx prisma studio
🚀
Useful links
Note: Some links are affiliate links. I may receive a commission when you take a paid offer.
This content originally appeared on DEV Community and was authored by Thomas Bnt ☕
Thomas Bnt ☕ | Sciencx (2024-10-31T18:00:00+00:00) How to use Prisma Postgres 🚀. Retrieved from https://www.scien.cx/2024/10/31/how-to-use-prisma-postgres-%f0%9f%9a%80/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.