{"id":17712620,"url":"https://github.com/nchimunyascripts/node-todo-list","last_synced_at":"2026-01-24T01:37:05.272Z","repository":{"id":258278573,"uuid":"870239364","full_name":"nchimunyascripts/node-todo-list","owner":"nchimunyascripts","description":"This project is a To-Do List application built using Node.js, Express, MongoDB, Redis, and JWT authentication. It allows users to register, log in, create, update, delete, and retrieve to-do items.","archived":false,"fork":false,"pushed_at":"2024-10-17T16:18:58.000Z","size":3567,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-19T12:12:46.613Z","etag":null,"topics":["api","api-rest","bycrpt","express","javascript","jwt","jwt-authentication","list","mongodb","mongoose","node","todo"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nchimunyascripts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-09T17:24:20.000Z","updated_at":"2024-10-17T16:19:02.000Z","dependencies_parsed_at":"2024-10-18T09:12:28.944Z","dependency_job_id":null,"html_url":"https://github.com/nchimunyascripts/node-todo-list","commit_stats":null,"previous_names":["nchimunyascripts/node-todo-list"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nchimunyascripts%2Fnode-todo-list","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nchimunyascripts%2Fnode-todo-list/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nchimunyascripts%2Fnode-todo-list/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nchimunyascripts%2Fnode-todo-list/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nchimunyascripts","download_url":"https://codeload.github.com/nchimunyascripts/node-todo-list/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229538752,"owners_count":18088899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-rest","bycrpt","express","javascript","jwt","jwt-authentication","list","mongodb","mongoose","node","todo"],"created_at":"2024-10-25T09:05:50.049Z","updated_at":"2026-01-24T01:37:05.227Z","avatar_url":"https://github.com/nchimunyascripts.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# To-Do List Application with Node.js, Express, MongoDB, and Redis\n\nThis project is a To-Do List application built using Node.js, Express, MongoDB, Redis, and JWT authentication. It allows users to register, log in, create, update, delete, and retrieve to-do items. The application also includes pagination for efficient data handling and Redis for caching and session management.\n\n## Table of Contents\n\n- [Project Overview](#project-overview)\n- [Features](#features)\n- [Technologies Used](#technologies-used)\n- [Project Structure](#project-structure)\n- [Getting Started](#getting-started)\n  - [Prerequisites](#prerequisites)\n  - [Installation](#installation)\n  - [Running the Application](#running-the-application)\n- [API Endpoints](#api-endpoints)\n- [Successes and Challenges](#successes-and-challenges)\n- [Next Steps](#next-steps)\n- [License](#license)\n\n## Project Overview\n\nThis is a full-stack To-Do List application where users can manage their tasks by performing CRUD operations. The app supports:\n- User authentication via JWT.\n- Secure password hashing with `bcryptjs`.\n- Session management and caching with Redis.\n- Pagination for managing a large number of tasks.\n- RESTful API structure.\n\n## Features\n\n- **User Registration and Authentication**: Users can register, log in, and manage their own tasks.\n- **Task Management**: Users can create, update, delete, and retrieve to-do items.\n- **Pagination**: Large task lists are paginated for optimized performance.\n- **Session Management with Redis**: User sessions are stored and managed using Redis for improved performance and scalability.\n- **JWT-based Authentication**: Secure user authentication via JWT tokens.\n\n## Technologies Used\n\n- **Node.js**: Server-side runtime environment.\n- **Express.js**: Framework for building RESTful APIs.\n- **MongoDB**: NoSQL database for storing users and tasks.\n- **Mongoose**: ODM for MongoDB.\n- **Redis**: In-memory data structure store used for session management and caching.\n- **JWT (jsonwebtoken)**: Authentication using JSON Web Tokens.\n- **bcryptjs**: For hashing user passwords.\n- **dotenv**: For managing environment variables.\n- **mongoose-paginate-v2**: Pagination support for MongoDB queries.\n- **express-session**: Session management middleware.\n\n## Project Structure\n\n```\n├── config\n│   └── db.js          # MongoDB and Redis configuration\n├── controllers\n│   ├── authController.js\n│   └── todoController.js\n├── middlewares\n│   └── auth.js        # Middleware for authentication\n├── models\n│   ├── User.js\n│   └── Todo.js\n├── routes\n│   ├── authRoutes.js\n│   └── todoRoutes.js\n├── .env               # Environment variables\n├── server.js          # Entry point of the application\n└── package.json       # Project dependencies\n```\n\n## Getting Started\n\n### Prerequisites\n\nEnsure you have the following software installed:\n- Node.js (version 14+)\n- MongoDB (local or Atlas)\n- Redis (local or remote instance)\n\n### Installation\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/nchimunyascripts/node-todo-list\n   cd node-todo-list\n   ```\n\n2. Install dependencies:\n\n   ```bash\n   npm install\n   ```\n\n3. Set up environment variables by creating a `.env` file:\n\n   ```bash\n   PORT=5000\n   MONGO_URI=mongodb://localhost:27017/todolist\n   REDIS_URL=redis://localhost:6379\n   JWT_SECRET=supersecretkey\n   ```\n\n### Running the Application\n\nStart the application:\n\n```bash\nnpm run start\n```\n\nOr to run the application with nodemon\n\n```bash\nnpm run dev\n```\n\nThe server will run on `http://localhost:5000`.\n\n## API Endpoints\n\n### User Authentication\n- `POST /api/auth/register`: Register a new user.\n- `POST /api/auth/login`: Log in a user and return a JWT token.\n\n### To-Do Operations\n- `GET /api/todos`: Get all to-dos for a logged-in user (supports pagination).\n- `POST /api/todos`: Create a new to-do.\n- `PUT /api/todos/:id`: Update an existing to-do by its ID.\n- `DELETE /api/todos/:id`: Delete a to-do by its ID.\n\n## Successes and Challenges\n\n### Successes\n- **Redis integration**: Efficient session management using Redis for storing user sessions.\n- **Pagination**: Successful implementation of pagination to handle large datasets in MongoDB.\n- **Authentication**: Secure authentication using JWT and password hashing with bcryptjs.\n\n### Challenges\n- **Redis v4+ Compatibility**: Faced challenges with configuring `connect-redis` with Redis v4+.\n- **Error Handling**: Handling different error cases, especially during authentication and CRUD operations, was complex and required extra attention.\n\n## Next Steps\n\n- **Add Role-based Access Control**: Implement roles like admin and user.\n- **Deploy to Production**: Deploy the app to cloud services such as AWS or Heroku.\n- **Real-time Features**: Introduce real-time task updates using WebSockets or Socket.io.\n- **Testing**: Add unit and integration tests to cover all API endpoints.\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnchimunyascripts%2Fnode-todo-list","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnchimunyascripts%2Fnode-todo-list","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnchimunyascripts%2Fnode-todo-list/lists"}