Member-only story
Benchmark Prisma ORM in NextJS
Check with push, pull, and drop
Let’s get started!
Let's begin with creating a folder, as I use WSL2 with Ubuntu. I will use the terminal.
mkdir test-prisma-orm
Open up the VSCode and it’s terminal
npx create-next-app@latest ./
Make sure that you have the Docker, cause we will use it.
docker
Let’s create the docker-compose.yml for running the Postgresql inside the container. Be careful, I use another port for the reason the 5432 is allocated in my machine. We will use 5433.
version: "3.8"
services:
db:
image: postgres:latest
container_name: nextjs_prisma_postgres
environment:
POSTGRES_USER: myuser
POSTGRES_PASSWORD: mypassword
POSTGRES_DB: mydatabase
ports:
- "5433:5432"
volumes:
- pgdata:/var/lib/postgresql/data
networks:
- db-network
volumes:
pgdata:
networks:
db-network:
Let’s create the .env file
DATABASE_URL="postgresql://myuser:mypassword@localhost:5433/mydatabase?schema=public"
The rest is as simple as possible. For convenience, I will use yarn package manager, you can use whatever package you want.