This is a backend application built with NestJS that allows users to create, view, and delete tasks. The application uses JWT tokens and cookies for authentication and authorization. User passwords are hashed using Argon2, MongoDB is used as the database, and Redis is used for caching.
- User signup and login with JWT-based authentication.
- Task management: add, view, and delete tasks.
- Password hashing using Argon2 for enhanced security.
- Efficient data handling with caching and Redis.
- MongoDB for data storage.
POST /auth/signup
: Register a new user.POST /auth/login
: Login a user.POST /auth/logout
: Logout a user and delete the session key.
GET /task/all
: Fetch all tasks for the authenticated user.DELETE /task/delete
: Delete a specified task.POST /task/add
: Add a new task to the database.
- Store the user ID in the JWT payload instead of the user email.
- Use a guard to check if there is data in the cookies before transferring the request to the route handler.
- Clone the repository:
git clone https://github.com/contawo/Nest_JS_Backend_Task_Application
- Navigate to the project directory:
cd Nest_JS_Backend_Task_Application
- Install the dependencies:
npm install
Create a .env
file in the root directory and add the following variables:
MONGODB_URL=mongodb://localhost:27017/nest_tasks
AUTH_SECRET=secret_key
APP_PORT=8000
REDIS_HOST=localhost
REDIS_PORT=6379
- Make sure that you have Redis installed in your device and start the Redis server:
redis-server
- Run the application:
npm run start:dev
The server will be running on http://localhost:8000
.
This project is licensed under the MIT License. See the LICENSE file for details.
If you encounter any issues or have questions, feel free to open an issue on the GitHub repository.