Skip to content

Backend tasks application made with Nest JS and MongoDB with JWT authentication and authorization, hashed passwords for security and secure information using environment variables.

Notifications You must be signed in to change notification settings

contawo/nest_js_backend_task_application

Repository files navigation

Nest Logo

Task Management Backend Application

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.

Table of Contents

  1. Features
  2. Endpoints
  3. Improvements
  4. Installation
  5. Environment Variables
  6. Usage
  7. Technologies Used
  8. License

Features

  • 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.

Endpoints

Authentication

  • POST /auth/signup: Register a new user.
  • POST /auth/login: Login a user.
  • POST /auth/logout: Logout a user and delete the session key.

Tasks

  • 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.

Improvements

  • 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.

Installation

  1. Clone the repository:
    git clone https://github.com/contawo/Nest_JS_Backend_Task_Application
  2. Navigate to the project directory:
    cd Nest_JS_Backend_Task_Application
  3. Install the dependencies:
    npm install

Environment Variables

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

Usage

  1. Make sure that you have Redis installed in your device and start the Redis server:
    redis-server
  2. Run the application:
    npm run start:dev

The server will be running on http://localhost:8000.

Technologies Used

License

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.

About

Backend tasks application made with Nest JS and MongoDB with JWT authentication and authorization, hashed passwords for security and secure information using environment variables.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published