The project aims to create a standard boilerplate for backend projects that use NodeJs
. It uses a framework named NestJs
to ease the development process.
Feel free to raise a PR against the repository if you would like to contribute. You can take a look at the Issues tab to see what we are working on currently.
git clone <repository-url> // Use SSH one
npm install
.env
fileThe env file should contain the following details
DATABSE_URL=<connection string of your database provider>
JWT_ACCESS_TOKEN_SECRET=<A random set of characters that are hard to crack>
JWT_ACCESS_TOKEN_EXPIRES_IN=<keep this one small usually 1d>
JWT_REFRESH_TOKEN_SECRET=<A random set of characters that are hard to crack>
JWT_REFRESH_TOKEN_EXPIRES_IN=<keep this one big usually 30d>
SENDGRID_API_KEY=<the API Key you get from send grid developer settings>
EMAIL_FROM_ADDRESS=<the from address from which your emails will be sent. Usually the one verified on send grid>
We use Prisma
ORM for connecting to our database and we prefer using Postgres
for now. Feel free to make changes to /prisma/schema.prisma
if you have any other database providers.
npm run start:dev // for development
npm run start // for production
The project checks for lint errors (eslint) and runs all test cases(jest) on each commit via Husky
We like to maintain a Postman
collection that has the basic API endpoints in it.
Dockerfile
The application is available as a docker image too.
Download the docker image from docker hub
docker pull vjnvisakh/boilerplates-nestjs-api
.env
file to run. You will have to create .env
file in the root and add values as mentioned above.Once done you can use this command to start up the project
docker run
-v ./.env:/app/.env
-p 3000:3000
vjnvisakh/boilerplates-nestjs-api
The command basically mounts the .env
file created by you into the application's internal .env
file.