This is a ToDo application API built using NestJS, and MongoDB. The application serves endpoints for managing tasks, users, and authentication. For protecting the endpoints, authentication is done with the help of short-living access-token, and long-living refresh-token. It also provides Swagger documentation for the API.
-
Clone the repository:
git clone https://github.com/bjspatel/todo-api.git cd todo-api
-
Install the dependencies:
npm install
-
Make sure you have MongoDB running on local machine or on the free MongoDB Atlas cluster.
-
Create a
.env
file in the root directory of the project and add the following environment variables (modify the values as needed):MONGODB_URI=mongodb://localhost:27017/todo FRONTEND_URL=http://localhost:5173 PORT=8080
MONGODB_URI
is the connection string for MongoDB.FRONTEND_URL
is used for CORS configuration.PORT
is the port on which the application will run.
-
Start the application:
npm run start
-
The application will be running on
http://localhost:8080
.
The API is documented using the Swagger module. Once the application is running, you can access the Swagger documentation at http://localhost:8080/api
.
TODO/
├── src/
│ ├── auth/ # Authentication module
│ ├── decorators/ # Custom decorators
│ ├── task/ # Task module
│ ├── user/ # User module
│ ├── app.module.ts # Root module
│ └── main.ts # Entry point
├── .env # Environment variables file
...