TaskMaster is a web-based task management application that allows users to efficiently create, view, update, delete, and filter tasks. Users can also search for tasks based on specific keywords. This application leverages MongoDB for data storage and implements secure user authentication using JWT, bcrypt, and Express Validator. Additionally, it includes protection against XSS and SQL injection attacks.
- Features
- Tech Stack
- Getting Started
- Installation
- Environment Variables
- API Endpoints
- Usage
- Testing
- Security
- Deployment
- Contributing
- License
- User Authentication: Users can register, log in, and authenticate securely.
- Task Management:
- Create, update, and delete tasks.
- Each task includes attributes such as title, description, due date, and priority.
- Task Filtering: Filter tasks by priority or due date.
- Search Functionality: Search tasks based on keywords in the title or description.
- Responsive UI: A user-friendly and responsive front-end interface.
- Frontend: HTML, CSS, JavaScript
- Backend: Node.js, Express
- Database: MongoDB
- Authentication: JWT, bcrypt
- Security: Helmet, express-validator, sanitize-html
- Testing: Mocha, Chai, Sinon, Supertest
Follow these instructions to get a copy of TaskMaster up and running on your local machine.
-
Clone the repository:
git clone https://github.com/your-username/TaskMaster.git cd TaskMaster
-
Install dependencies:
npm install
-
Create a
.env
file in the root directory and configure the necessary environment variables (see below).
Set up the following variables in your .env
file:
PORT=3000
MONGODB_URI=<Your MongoDB URI>
JWT_SECRET=<Your JWT Secret Key>
- POST
/users/signup
- Register a new user - POST
/users/login
- Login with existing credentials
- POST
/tasks
- Create a new task - GET
/tasks
- Retrieve all tasks (with filtering and search options) - GET
/tasks/:id
- Retrieve a task by ID - PUT
/tasks/:id
- Update a task by ID - DELETE
/tasks/:id
- Delete a task by ID
- Create a Task:
- POST
/tasks
- Body:
{ "title": "Complete project report", "description": "Finish the report for project XYZ", "dueDate": "2024-12-31", "priority": "high", "userId": "<User ID>" }
- POST
To run the application locally:
npm start
The server will start on http://localhost:3000
(or the port you set in .env
).
TaskMaster includes unit tests for key functions. Run tests using:
npm test
TaskMaster includes basic security features to ensure data integrity and protection against common attacks:
- Input Validation: Uses
express-validator
to validate user inputs. - XSS Protection: Uses
sanitize-html
to prevent cross-site scripting. - SQL Injection Protection: MongoDB inherently protects against SQL injection, and user inputs are sanitized.
- Secure Headers: Uses
helmet
to set secure HTTP headers.
- Push your code to GitHub or another repository.
- Connect your repository to Vercel and configure environment variables.
- Deploy the application via Vercel.
- Install the Fly CLI and sign in.
- Initialize your project:
flyctl launch
- Deploy using:
flyctl deploy
Ensure that your environment variables are set in the Fly.io dashboard.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -am 'Add new feature'
). - Push the branch (
git push origin feature-branch
). - Open a Pull Request.
This project is licensed under the MIT License. See the LICENSE file for more information.
Happy task management with TaskMaster!