An Express - Prisma ORM boilerplate
Clone the project
git clone https://github.com/dj0nny/express-prisma-boilerplate.gitGo to the project directory
cd express-prisma-boilerplateInstall dependencies
npm installStart the server
npm run devTo run this project, you will need to edit the following environment variables to your .env file
DATABASE_URL
For this boilerplate, the default database client is Postgres.
You can clean up the example migration with rm -rf ./prisma/migrations command.
Before running this boilerplate, you need to update your schema.prisma located in the ./prisma folder.
Inside this file will go the model definitions of your database tables. Once you update the models, you can update the database running npx prisma migrate dev --name migration-name.
This command is going to do two things:
- It creates a new SQL migration file for this migration
- It runs the SQL migration file against the database
Whenever you make changes to your Prisma schema in the future, you manually need to invoke prisma generate in order to accommodate the changes in your Prisma Client API.
This boilerplate provides a seed.js file located in the ./prisma folder. You can run it using npx prisma db seed.
Node.js, Express, Prisma.js, Postgres