Ai Coding Tools

How to Build a Simple Todo App Using Cursor in Under 2 Hours

By BTW Team3 min read

How to Build a Simple Todo App Using Cursor in Under 2 Hours

If you're a beginner looking to dip your toes into coding, you might feel overwhelmed by the myriad of tools and frameworks out there. But what if I told you that you could build a functional Todo app in under two hours using Cursor, an AI-powered coding tool? In 2026, Cursor has made significant strides in simplifying the coding process, making it a great choice for indie hackers and side project builders.

Prerequisites

Before we dive into building the app, here’s what you’ll need:

  • Cursor: Sign up for a free account to get started (basic features available).
  • Basic understanding of JavaScript: This will help you grasp the concepts quicker.
  • Node.js: Make sure you have Node.js installed on your machine to run the app locally.

Step 1: Set Up Your Environment

First, create a new directory for your project:

mkdir todo-app
cd todo-app

Then, initialize a new Node.js project:

npm init -y

Next, install the necessary dependencies:

npm install express body-parser cors

Expected Output: You should see a package.json file and a node_modules directory created.

Step 2: Create Your Server

In your project directory, create a new file called server.js. This will be the backbone of your Todo app. Here’s a simple server setup using Express:

const express = require('express');
const bodyParser = require('body-parser');
const cors = require('cors');

const app = express();
app.use(cors());
app.use(bodyParser.json());

let todos = []; // This will act as our database

app.get('/todos', (req, res) => {
    res.json(todos);
});

app.post('/todos', (req, res) => {
    const todo = { id: todos.length + 1, text: req.body.text };
    todos.push(todo);
    res.json(todo);
});

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
    console.log(`Server running on port ${PORT}`);
});

Expected Output: When you run node server.js, you should see a message indicating the server is running.

Step 3: Build the Frontend

Now, create an index.html file in your project directory. Here’s a simple HTML structure with a bit of JavaScript to fetch and display your todos:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Todo App</title>
</head>
<body>
    <h1>Todo List</h1>
    <input type="text" id="todo-input" placeholder="Add a new todo">
    <button onclick="addTodo()">Add Todo</button>
    <ul id="todo-list"></ul>

    <script>
        async function fetchTodos() {
            const response = await fetch('http://localhost:3000/todos');
            const todos = await response.json();
            const todoList = document.getElementById('todo-list');
            todoList.innerHTML = '';
            todos.forEach(todo => {
                const li = document.createElement('li');
                li.textContent = todo.text;
                todoList.appendChild(li);
            });
        }

        async function addTodo() {
            const input = document.getElementById('todo-input');
            const response = await fetch('http://localhost:3000/todos', {
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json',
                },
                body: JSON.stringify({ text: input.value }),
            });
            input.value = '';
            fetchTodos();
        }

        fetchTodos();
    </script>
</body>
</html>

Expected Output: Open index.html in your browser, and you should see your Todo app where you can add and view todos.

Troubleshooting

  • CORS Issues: If you run into CORS errors, ensure CORS is enabled in your server setup.
  • Server Not Running: Double-check that your server is running and listening on the correct port.

What’s Next?

Once you have your Todo app up and running, consider expanding its functionality. Here are a few ideas:

  • Add a Delete Functionality: Allow users to remove todos.
  • Persist Data: Use a database like MongoDB to save todos instead of keeping them in memory.
  • User Authentication: Make it a personal todo list by adding user accounts.

Conclusion

Building a simple Todo app with Cursor doesn’t have to be daunting. With just two hours, you can create a functional app that lays the groundwork for more advanced projects. Start with this basic setup, and as you get comfortable, enhance it with more features.

If you're looking for a straightforward way to start coding and building, Cursor is a solid choice to consider.

Follow Our Building Journey

Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.

Subscribe

Never miss an episode

Subscribe to Built This Week for weekly insights on AI tools, product building, and startup lessons from Ryz Labs.

Subscribe
Ai Coding Tools

10 AI Coding Tools That Will Drastically Reduce Your Debugging Time

10 AI Coding Tools That Will Drastically Reduce Your Debugging Time As a developer, whether you're just starting out or have years of experience, debugging can feel like a neverend

Oct 16, 20265 min read
Ai Coding Tools

10 Common Mistakes When Integrating AI Coding Tools into Your Workflow

10 Common Mistakes When Integrating AI Coding Tools into Your Workflow As developers, we’re always on the lookout for ways to streamline our workflow and boost productivity. Enter

Oct 14, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools That Could Hurt Your Development Process

5 Myths About AI Coding Tools That Could Hurt Your Development Process As a solo founder or indie hacker, you might be lured by the promises of AI coding tools that claim to simpli

Oct 13, 20264 min read
Ai Coding Tools

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026

5 Common Mistakes Developers Make When Using AI Coding Tools in 2026 As AI coding tools have become an integral part of a developer's toolkit in 2026, many are still stumbling over

Oct 12, 20264 min read
Ai Coding Tools

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026

5 Myths About AI Coding Tools: What Every Developer Should Know in 2026 As we dive into 2026, the landscape of AI coding tools has evolved significantly, yet many developers still

Oct 11, 20263 min read
Ai Coding Tools

Why AI Coding Assistants Are Overrated for Beginners in 2026

Why AI Coding Assistants Are Overrated for Beginners in 2026 As a solo founder or indie hacker, it’s tempting to think that AI coding assistants are the silver bullet to jumpstart

Oct 10, 20263 min read