Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
Node.js

Todo App with Node.js

Create a file-based todo CLI/API to practice CRUD without a database first.

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));
}

Leave a reply

Your email address will not be published. Required fields are marked *