- Node.js (version 18 or higher)
- npm
- Database provider you want to use. We currently support MongoDB, PostgreSQL, and MySQL. See supported databases version here.
-
Clone the repository
Use
git clone
command, to clone this repository using HTTPS or SSH. -
Install the dependencies
Use
npm install
command, to install all the dependencies. -
Configure the environment variables
-
Create
.env
file by simply copying the.env.example
file and rename it. -
Set the
APP_HOST
andAPP_PORT
. -
You can enable rate limiting by setting the
APP_ENABLE_THROTTLE
to betrue
. You also can customize theAPP_THROTTLE_TTL
andAPP_THROTTLE_LIMIT
as desired. -
You can also customize the pagination feature by setting the
APP_PAGINATION_MAX_PAGE_SIZE
andAPP_PAGINATION_DEFAULT_PAGE_SIZE
.[!NOTE] Set the
APP_PAGINATION_MAX_PAGE_SIZE
value wisely, as it will determine the amount of resource usage (the size of queries to the database). -
Set the
DB_PROVIDER
with the data source provider you want to use. Current supported providers: 'mongodb', 'postgresql', and 'mysql'. See the details here. -
Set the
DB_HOST
,DB_PORT
,DB_USERNAME
,DB_PASSWORD
,DB_USERNAME
, andDB_PASSWORD
. See the connection string documentation.If you use local database, you must grant read-write access to the database.
-
-
Generate the database
Run
npm run db:migrate
command to generate the database.You can use
npx prisma migrate deploy
command to run migration in non-development environments and if you are using any database providers other than MongoDB. See the details here. -
Seed the data
Run
npm run db:seed
command to seed the data. -
Run the app
Use
npm run start
command, to run the app.
We also provide Docker configuration with PostgreSQL database support.
-
Fork and clone this project.
-
Configure the environment variables.
DB_PROVIDER
must be set intopostgresql
.DB_HOST
must be set intodb
.
-
Run
docker compose up
command to build and run the app.If you change any environment variables, you need to rebuild the image using
docker compose up --build
command. -
Finish
To run the test, you can use the following command:
# Run unit tests
npm run test
# Run e2e test
npm run test:e2e
# Run coverage test
npm run test:cov