Skip to content

Amith-Vignesh/task-manager-nodeJS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task Manager (Node.js)

A RESTful API built with Node.js and Express, designed to manage users and their tasks.
This project was developed as part of my Node.js learning journey and includes features like authentication, file uploads, and database integration with MongoDB.


🚀 Features

  • User Management

    • Register new users
    • Login / Logout
    • Update and delete user profile
    • Authentication using JWT
    • Password hashing for security
  • Task Management

    • Create new tasks
    • Read tasks (with filtering, pagination, and sorting)
    • Update tasks
    • Delete tasks
  • File Upload

    • Upload and manage user profile avatars (with validation)

🛠️ Tech Stack

  • Backend: Node.js, Express.js
  • Database: MongoDB, Mongoose
  • Authentication: JWT (JSON Web Token), bcrypt.js
  • Email Service: SendGrid
  • File Upload: Multer
  • Testing: Jest, Supertest

📂 Project Structure

task-manager/
│-- src/
│ │-- db/ # Database connection
│ │-- middleware/ # Authentication middleware
│ │-- models/ # User and Task models
│ │-- routers/ # Express route handlers
│ │-- emails/ # SendGrid email functions
│ |-- app.js 
| └-- index.js # App entry point
|  
│-- tests/ # Testing using jest
│-- .env # Environment variables
│-- package.json # Dependencies and scripts
└-- README.md

⚙️ Installation & Setup

  1. Clone the repository
    git clone https://github.com/<your-username>/task-manager-nodeJS.git
    cd task-manager-nodeJS
    
  2. Install dependencies
    npm install
    
  3. Setup environment variables Create a dev.env and test.env file in the root folder and add with different database name in test.env:
    PORT=3000
    MONGODB_URL=mongodb://127.0.0.1:27017/task-manager-api
    JWT_SECRET=your_jwt_secret
    SENDGRID_API_KEY=your_sendgrid_api_key
    
    
  4. Run the project
    npm run dev
    
    

📌 API Endpoints

  • 👤 Users

    • POST /users → Register a new user
    • POST /users/login → Login user
    • POST /users/logout → Logout user
    • GET /users/me → Get logged-in user profile
    • PATCH /users/me → Update user profile
    • DELETE /users/me → Delete user account
  • ✅ Tasks

    • POST /tasks → Create a task
    • GET /tasks → Get all tasks (with filtering, sorting, pagination)
    • GET /tasks/:id → Get task by ID
    • PATCH /tasks/:id → Update task
    • DELETE /tasks/:id → Delete task

🛠️ Technologies Used

  • Node.js + Express → Server & API
  • MongoDB + Mongoose → Database
  • JWT (jsonwebtoken) → Authentication
  • Multer → File uploads
  • SendGrid → Email service
  • bcryptjs → Password hashing
  • Jest + Supertest → testing

🧪 Testing

This project includes automated tests written with the Jest framework.
All major endpoints for Users and Tasks have been tested to ensure reliability.

  • Tests are located in the /tests folder.
  • Includes unit tests and integration tests for:
    • User authentication & profile management
    • Task creation, update, retrieval, and deletion
  • Uses supertest for API endpoint testing.

Run Tests

npm test

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •