A comprehensive RESTful API for managing tasks with user authentication, built using Node.js, Express, and MongoDB.
https://github.com/AyushkhatiDev/Task-Management
- User authentication (register/login)
- JWT-based authorization
- Complete CRUD operations for tasks
- MongoDB database integration
- API documentation with Swagger
- Task categorization (work, personal, shopping, health, education)
- Task tagging system
- Task comments and discussions
- File attachments support
- Task assignments to multiple users
- Priority levels and status tracking
- Due dates and reminders
- Task completion tracking
- Detailed user profiles
- User settings and preferences
- Role-based access control
- Theme preferences
- Email notification settings
- Comprehensive task statistics
- Task timeline visualization
- Advanced search with multiple filters
- Tasks breakdown by category, priority, and status
- Node.js (v14 or higher)
- MongoDB (v4.4 or higher)
- npm or yarn
- Clone the repository:
git clone <repository-url>
cd task-management-api
- Install dependencies:
npm install
- Set up environment variables:
- Copy
.env.example
to.env
- Update the configuration in
.env
:
PORT=3000
NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017/task_management
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRES_IN=24h
- Start MongoDB:
- Make sure MongoDB is installed and running
- Default MongoDB URL: mongodb://localhost:27017
- Start the development server:
npm run dev
The API will be available at http://localhost:3000
Swagger documentation: http://localhost:3000/api-docs
- POST
/api/auth/register
- Register a new user - POST
/api/auth/login
- Login user
- GET
/api/tasks
- Get all tasks - GET
/api/tasks/:id
- Get specific task - POST
/api/tasks
- Create new task - PATCH
/api/tasks/:id
- Update task - DELETE
/api/tasks/:id
- Delete task
- GET
/api/stats/tasks
- Get task statistics - GET
/api/stats/search
- Search tasks with filters - GET
/api/stats/timeline
- Get task timeline
- Work
- Personal
- Shopping
- Health
- Education
- Other
- Low
- Medium
- High
- Todo
- In Progress
- Completed
- Archived
POST /api/tasks
{
"title": "Project Meeting",
"description": "Weekly team sync",
"category": "work",
"tags": ["meeting", "team"],
"priority": "high",
"dueDate": "2024-12-14T10:00:00Z",
"assignedTo": ["user_id1", "user_id2"]
}
GET /api/stats/search?query=project&category=work&priority=high&startDate=2024-12-01
GET /api/stats/tasks
The API uses standard HTTP status codes:
- 200: Success
- 201: Created
- 400: Bad Request
- 401: Unauthorized
- 403: Forbidden
- 404: Not Found
- 500: Internal Server Error
npm test
Create a .env
file with the following variables:
PORT=3000
NODE_ENV=development
MONGODB_URI=mongodb://localhost:27017/task_management
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRES_IN=24h
MIT