Todo App with Node.js — a practical guide to Node.js todo app with clear examples you can reuse in real projects.
Todo App with Node.js — 30/55 in the Node.js series. Full playlist companion: Node.js complete course on YouTube. Prefer one article? Read the complete Node.js tutorial.
Short description
A todo app is perfect for learning create/read/update/delete. Start with a JSON file store, then upgrade to MongoDB later.
JSON file todo helpers
const fs = require('fs').promises;
const FILE = './todos.json';
async function list() {
const raw = await fs.readFile(FILE, 'utf8').catch(() => '[]');
return JSON.parse(raw);
}
async function add(title) {
const todos = await list();
todos.push({ id: Date.now(), title, done: false });
await fs.writeFile(FILE, JSON.stringify(todos, null, 2));
}