A NestJS project demonstrating JWT authentication, role-based access control, and API documentation using Swagger.
Before starting, make sure you have at least these components on your workstation:
- An up-to-date release of NodeJS such as 20.x and NPM
Start by cloning this project on your workstation.
git clone git@bitbucket.org:mmohitssingla/books.gitThe next thing will be to install all the dependencies of the project.
cd ./books
npm installOnce the dependencies are installed, you can now configure your project by creating a new .env file containing the environment variables used for development.
cp .env.example .env
Define a JWT_SECRET to sign the JWT tokens and MONGODB_URI to connect to MongoDB database.
Now you need to seed the database using the following command.
npm run seed
You are now ready to launch the NestJS application using the command below.
# Launch the development server
npm run start:devYou can now head to http://localhost:3000/api and see your API Swagger docs.
The goal of this project is to provide a clean and up-to-date "starter pack" for REST API projects that are built with NestJS.
Feel free to suggest an improvement, report a bug, or ask something.