- JavaScript (MDN) docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript
- ECMAScript (spec, ECMA-262) docs: https://www.ecma-international.org/publications-and-standards/standards/ecma-262/
A lightweight, high-performance RESTful API built with pure Node.js for managing todos, demonstrating the power of Node.js without external dependencies.
- Zero Dependencies: Built using only Node.js built-in modules
- JSON Storage: Persistent data storage using JSON file system
- RESTful Architecture: Following REST principles for API design
- Error Handling: Comprehensive error handling and status codes
- CRUD Operations: Complete Create, Read, Update, Delete functionality
- Flexible Querying: Search todos by ID or title
- Duplicate Prevention: Built-in title uniqueness validation
- Async/Await Pattern: Modern asynchronous code practices
- Clean Architecture: Well-organized and maintainable codebase
- Clone the repository:
git clone https://github.com/md-abu-kayser/vanilla-node-todo.gitcd vanilla-node-todo
- Start the server:
node server.js
- The server will start on
http://127.0.0.1:5000
The API can be tested using any HTTP client (cURL, Postman, or your preferred tool). Below are some example requests:
curl -X POST http://127.0.0.1:5000/todos/create-todo \
-H "Content-Type: application/json" \
-d '{"title": "Learn Node.js", "body": "Study Node.js fundamentals"}'curl http://127.0.0.1:5000/todos| Method | Endpoint | Description |
| ------ | ------------------------------------ | ---------------------------------- |
| GET | `/todos` | Retrieve all todos |
| GET | `/todo?id=123` or `/todo?title=Task` | Get a specific todo by ID or title |
| POST | `/todos/create-todo` | Create a new todo |
| PATCH | `/todos/update-todo?id=123` | Update an existing todo |
| DELETE | `/todos/delete-todo?id=123` | Delete a todo |- Description: Retrieves all todos
- Response: Array of todo objects
- Status Codes:
- 200: Success
- 500: Server error
- Description: Get a specific todo by ID or title
- Query Parameters:
id: Todo ID (optional)title: Todo title (optional)
- Status Codes:
- 200: Success
- 404: Todo not found
- 500: Server error
- Description: Create a new todo
- Body:
{ "title": "string", "body": "string" } - Status Codes:
- 201: Created
- 400: Invalid request
- 409: Duplicate title
- 500: Server error
- Description: Update a todo's body
- Query Parameters:
id: Todo ID (optional)title: Todo title (optional)
- Body:
{ "body": "string" } - Status Codes:
- 200: Success
- 400: Invalid request
- 404: Todo not found
- 500: Server error
- Description: Delete a todo
- Query Parameters:
id: Todo ID (optional)title: Todo title (optional)
- Status Codes:
- 200: Success
- 400: Invalid request
- 404: Todo not found
- 500: Server error
Each todo object has the following structure:
{
"id": "1699123456789-1234",
"title": "Example Todo",
"body": "Todo description",
"createdAt": "11/10/2025, 12:00:00 PM"
}The API implements comprehensive error handling:
- Input validation
- Duplicate entry prevention
- Resource not found handling
- Invalid JSON payload detection
- Internal server error handling
All errors return appropriate HTTP status codes and JSON responses with error messages.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- This project is licensed under the terms of the MIT License.
- You may replace or update the license as needed for client or proprietary projects.
- Project: vanilla-node-todo
- Name: Md Abu Kayser - Full-Stack Engineer
- Maintainer: md-abu-kayser
- Email: abu.kayser.official@gmail.com
- GitHub: github.com/abu.kayser-official
If you’d like this README tailored for a specific purpose - such as hiring managers, open-source contributors, or client deliverables - feel free to request a custom tone or format.
It’s designed to be clean, well-structured, and pleasant to explore - perfect for interviews, portfolio showcases, or professional demos. Thank you for reviewing this project!