- Typescript
- NodeJs
- Express
- Prisma
If you want to use the database with Prisma, If you want to use the database with Prisma, you will first have to decide what type of database you want to use (mysql, postgresql, mongodb, etc...)
To do this, you will first need to configure your database, (In the case of a "mysql" database):
-
Go to the ./prisma/schema.prisma file, and configure your database as follows:
datasource db { provider = "mysql" url = env("DATABASE_URL") }
-
Create an ".env" file then add an environment variable "DATABASE_URL" with the value of your database uri as follows:
DATABASE_URL=<PROTOCOL>://<ID>:<PASSWORD>@localhost:3306/<DATABASE_NAME>
-
Design your database schema on the ./prisma/schema.prisma
-
You can seed your database from a ./prisma/seed.ts file
Then run:
pnpm build:dev:db || npm run build:dev:db
You can take a look at the prisma documentation here -> Prisma Documentation
Run:
pnpm build:dev || npm run build:dev
The boilerplate uses express-session middleware (session cookie) with mysql, for client-side connection persistence.
It does not use jwt, because security level I do not recommend it.
I advise you to read this article, which explains in a very charming way the reason -> Stop using JWT for sessions