-
Install
node_modules
, by running the following command (Note: package manager used for this project is npm)$ npm i
-
Create a
.env
file, with the following contents:PORT=5000 NODE_ENV='development' # would be subject to change.
-
Create
auth.env
with following contentEMAIL= <systemEmail> /* the email from which you want to send email */ PASSWORD = <systemEmailPassword> /* password of above email */
-
Install MySQL server and MySQL Workbench.
-
Create Database as per the URI set in the env
-
Apply migrations to database by running the following command:
$ npx prisma migrate dev
-
For development (You are most likely concerned with this command)
$ npm run dev
-
For non-daemon process
$ npm run start
- Make sure that you have populated the
DATABASE_URL
environment variable in your.env
file with a valid URL. - Populate the file
prisma/schema.prisma
with appropriate models. - Run the following command:
Here NAME is the name of the migration you wish to give.
$ npx prisma migrate dev --name <NAME>
- The above command takes care of 2 things:
- Makes appropriate changes to the database.
- generates
@prisma/client
which has typing and functions for each model as ORM.
- The
prisma/seed.js
file creates a Super Admin whenever we migrate prisma or we can do it manually by command:$ npx prisma db seed
-
Use kebab-case for URL paths.
- Undesirable Examples:
/user/forgotPassword
❌/User/Forgot-Password
❌/get_User_Details
❌
- Acceptable Examples:
/user/forgot-password
✅/get-user-details
✅
- Undesirable Examples: