{"id":29313745,"url":"https://github.com/yuvrajnode/todo-backend-with-database","last_synced_at":"2026-05-08T07:33:53.099Z","repository":{"id":303169002,"uuid":"1014611611","full_name":"yuvrajnode/todo-backend-with-database","owner":"yuvrajnode","description":"A secure Node.js API for user authentication and todo management using Express, MongoDB, and JWT.","archived":false,"fork":false,"pushed_at":"2025-07-09T18:13:26.000Z","size":4206,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-25T03:03:00.114Z","etag":null,"topics":["express","jwt-authentication","mongodb","nodejs"],"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/yuvrajnode.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,"zenodo":null}},"created_at":"2025-07-06T04:10:13.000Z","updated_at":"2025-10-03T18:17:29.000Z","dependencies_parsed_at":"2025-07-06T05:26:24.516Z","dependency_job_id":"5d1b0af0-f7dc-454f-831c-95526b0dd83a","html_url":"https://github.com/yuvrajnode/todo-backend-with-database","commit_stats":null,"previous_names":["yuvrajnode/todo-backend-with-database"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/yuvrajnode/todo-backend-with-database","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvrajnode%2Ftodo-backend-with-database","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvrajnode%2Ftodo-backend-with-database/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvrajnode%2Ftodo-backend-with-database/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvrajnode%2Ftodo-backend-with-database/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yuvrajnode","download_url":"https://codeload.github.com/yuvrajnode/todo-backend-with-database/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yuvrajnode%2Ftodo-backend-with-database/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32771069,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T02:36:36.067Z","status":"ssl_error","status_checked_at":"2026-05-08T02:36:07.210Z","response_time":54,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["express","jwt-authentication","mongodb","nodejs"],"created_at":"2025-07-07T10:12:43.989Z","updated_at":"2026-05-08T07:33:53.068Z","avatar_url":"https://github.com/yuvrajnode.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧠 Auth Todo API\n\nA simple RESTful backend API built with **Node.js**, **Express**, **MongoDB**, and **JWT** that allows users to register, log in, and manage their personal todo tasks.\n\n---\n\n## 🚀 Features\n\n- ✅ User Signup and Login  \n- 🔐 JWT-based Authentication using custom `token` header  \n- 📝 Create, fetch, update, and delete todos  \n- 🗃️ MongoDB with Mongoose schemas \u0026 models  \n- 📦 Clean JSON-based REST API  \n\n---\n\n## 📁 Project Structure\n\n```\n├── index.js         # Main server file (routes, middleware, logic)\n├── db.js            # MongoDB schemas and models\n├── package.json     # Project metadata and dependencies\n├── .gitignore       # Files to ignore in version control\n```\n\n---\n\n## 🛠️ Tech Stack\n\n- **Node.js**  \n- **Express.js**  \n- **MongoDB** with **Mongoose**  \n- **JWT** for authentication  \n- **bcrypt** for password hashing  \n- **zod** for request validation  \n\n---\n\n## 🧪 API Endpoints\n\n### 🔹 POST `/signup`  \nRegisters a new user.\n\n**Request Body:**\n```json\n{\n  \"email\": \"user@example.com\",\n  \"password\": \"yourpassword\",\n  \"name\": \"Yuvraj\"\n}\n```\n\n**Response:**\n```json\n{\n  \"message\": \"You are signed up\"\n}\n```\n\n---\n\n### 🔹 POST `/signin`  \nAuthenticates the user and returns a JWT token.\n\n**Request Body:**\n```json\n{\n  \"email\": \"user@example.com\",\n  \"password\": \"yourpassword\"\n}\n```\n\n**Response:**\n```json\n{\n  \"token\": \"JWT_TOKEN_HERE\"\n}\n```\n\n---\n\n### 🔹 POST `/todo`  \nCreates a new todo.\n\n**Headers:**\n```\ntoken: JWT_TOKEN_HERE\n```\n\n**Request Body:**\n```json\n{\n  \"title\": \"Learn Node.js\"\n}\n```\n\n**Response:**\n```json\n{\n  \"message\": \"Todo created\"\n}\n```\n\n---\n\n### 🔹 POST `/todos`  \nFetches all todos of the authenticated user.\n\n**Headers:**\n```\ntoken: JWT_TOKEN_HERE\n```\n\n**Response:**\n```json\n{\n  \"todos\": [\n    {\n      \"_id\": \"todoId\",\n      \"title\": \"Learn Node.js\",\n      \"done\": false,\n      \"userId\": \"userId\"\n    }\n  ]\n}\n```\n\n---\n\n### 🔹 PUT `/todo/:id`  \nUpdates a todo (e.g., mark as done).\n\n**Headers:**\n```\ntoken: JWT_TOKEN_HERE\n```\n\n**Request Body:**\n```json\n{\n  \"done\": true\n}\n```\n\n**Response:**\n```json\n{\n  \"message\": \"Todo updated\"\n}\n```\n\n---\n\n### 🔹 DELETE `/todo/:id`  \nDeletes a todo.\n\n**Headers:**\n```\ntoken: JWT_TOKEN_HERE\n```\n\n**Response:**\n```json\n{\n  \"message\": \"Todo deleted\"\n}\n```\n\n---\n\n## ⚙️ Setup Instructions\n\n1. **Clone the repository:**\n```bash\ngit clone https://github.com/yuvrajnode/todo-backend-with-database.git\ncd todo-backend-with-database\n```\n\n2. **Install dependencies:**\n```bash\nnpm install\n```\n\n3. **Configure MongoDB URI and secret (optional):**  \nIf using environment variables, create a `.env` file and add:\n```\nMONGO_URI=your_mongo_connection_string\nJWT_SECRET=your_secret\n```\n(Or keep them hardcoded in `index.js` as done currently.)\n\n4. **Start the server:**\n```bash\nnode index.js\n```\n\nServer will run at:  \n📍 `http://localhost:3000`\n\n---\n\n## 🙋‍♂️ Author\n\nMade with ❤️ by **Yuvraj Singh**  \nGitHub: [@yuvrajnode](https://github.com/yuvrajnode)\n\n---\n\n## 📜 License\n\nThis project is open source and free to use under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuvrajnode%2Ftodo-backend-with-database","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyuvrajnode%2Ftodo-backend-with-database","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyuvrajnode%2Ftodo-backend-with-database/lists"}