-
Install
node_modules
, by running the following command (Note: package manager used for this project is yarn)yarn install
-
Create a
.env
file, with the following contents:PORT=5000 CLIENT_URL=<enter the client url> APP_URL=<enter the app client url> NODE_ENV='development' # would be subject to change. # Database settings DATABASE_URL='mysql://<url-encoded USERNAME>:<url-encoded PASSWORD>@<HOSTNAME>:<PORT>/<DATABASE>' # JWT secret TOKEN_SECRET=<super secret something> # Mailing credentials MAILING_EMAIL=<mailing email> MAILING_PASSWORD=<mailing password> # Super Admin credentials SUPER_ADMIN_EMAIL=<super-admin email> SUPER_ADMIN_PASSWORD=<super-admin password> # Redis DB URL REDIS_URL=<redis db url> # Google maps API GOOGLE_MAPS_API_KEY=<google-maps api key>
-
Install the Redis server.
-
$ docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest
- For Debian-based Linux distributions, the following command should do:
sudo apt install redis-server
- For macOS users, with homebrew installed:
brew install redis-server
- For Windows users, since there doesn't seem to be any support. You might wanna install WSL2. Refer this.
-
-
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:
yarn run prisma migrate dev
-
Run the following command:
$ yarn run fmt $ yarn run fmt-check $ yarn run lint
-
Please ensure that above commands return with exit-code 0. (PS: warnings from
eslint
are acceptable)
- Basic
yarn run start
- For development
yarn run dev
- 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.
yarn run 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.
- Make sure that
SUPER_ADMIN_EMAIL
andSUPER_ADMIN_PASSWORD
exist as environment variables, they act as the credentials for logging in as the super admin.
-
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: