Ai Coding Tools

How to Use Cursor to Build a Simple Web App in Under 2 Hours

By BTW Team4 min read

How to Use Cursor to Build a Simple Web App in Under 2 Hours

Building a web app can feel like a daunting task, especially if you’re a solo founder or indie hacker juggling multiple projects. But what if I told you that you could create a simple web app in under two hours using Cursor, an AI-powered coding tool? In this guide, I’ll walk you through the process, share what you need to get started, and highlight the limitations of using Cursor.

Time Estimate: 2 Hours

You can finish this project in about two hours if you follow the steps closely. Cursor simplifies the coding process, but you'll still need some foundational knowledge of web development concepts.

Prerequisites

Before diving in, make sure you have:

  • A Cursor account (Free tier available)
  • Basic understanding of HTML, CSS, and JavaScript
  • Node.js installed on your machine
  • A code editor (like Visual Studio Code)

Step-by-Step Guide to Build Your Web App

Step 1: Set Up Your Project

  1. Create a New Directory: Open your terminal and create a new folder for your project.

    mkdir my-web-app
    cd my-web-app
    
  2. Initialize a Node.js Project: Run the following command to set up your Node.js project.

    npm init -y
    
  3. Install Express: To create a simple server, install Express.

    npm install express
    

Step 2: Use Cursor to Generate Code

  1. Open Cursor: Launch the Cursor app and start a new coding session.

  2. Generate Basic Server Code: Input a prompt like "Create a basic Express server that serves a web page." Cursor will generate the code for you.

    Example output:

    const express = require('express');
    const app = express();
    const PORT = process.env.PORT || 3000;
    
    app.get('/', (req, res) => {
        res.send('Hello, World!');
    });
    
    app.listen(PORT, () => {
        console.log(`Server is running on http://localhost:${PORT}`);
    });
    
  3. Copy the Generated Code: Paste this code into a new file named server.js in your project directory.

Step 3: Create Your Frontend

  1. Create an HTML File: In your project directory, create a file named index.html and use Cursor to generate some basic HTML code.

    Example prompt: "Create a simple HTML page with a title and a button."

    Example output:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>My Web App</title>
    </head>
    <body>
        <h1>Welcome to My Web App</h1>
        <button onclick="alert('Button clicked!')">Click Me!</button>
    </body>
    </html>
    
  2. Serve the HTML File: Update your server code to serve the HTML file.

    app.use(express.static('public'));
    

    Move your index.html file into a new folder named public.

Step 4: Run Your Web App

  1. Start the Server: In your terminal, run:

    node server.js
    
  2. Open Your Browser: Go to http://localhost:3000 to see your web app in action!

Troubleshooting

  • If the server doesn't start: Check for errors in your terminal. Ensure that all packages are installed correctly.
  • If the HTML page doesn't load: Make sure your index.html file is in the public folder and that you have the correct file path in your server code.

What's Next?

Once you've built this simple web app, consider expanding its functionality. You could add a database, implement user authentication, or even integrate with third-party APIs. The possibilities are endless!

Conclusion

Cursor is a powerful tool for indie hackers and solo founders looking to build web apps quickly. While it makes the coding process much easier, remember that it’s not a magic bullet. There are limitations, especially when it comes to complex logic or custom features. But for simple projects, it can be a game-changer.

What We Actually Use

In our experience, we use Cursor for rapid prototyping. However, for more complex applications, we often switch to traditional coding because Cursor can struggle with nuanced requirements.

If you're ready to dive in and build your first web app with Cursor, give it a shot! It could be the start of something great.

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

Is GitHub Copilot Really Worth the $10/Month in 2026?

Is GitHub Copilot Really Worth the $10/Month in 2026? As a solo founder or indie hacker, you’re always on the lookout for tools that can save you time and money. GitHub Copilot, th

Mar 23, 20264 min read
Ai Coding Tools

The $100 Challenge: Which AI Coding Tool Delivers the Best Value?

The $100 Challenge: Which AI Coding Tool Delivers the Best Value? (2026) As indie hackers and solo founders, we often grapple with the challenge of choosing the right tools for our

Mar 23, 20264 min read
Ai Coding Tools

How to Integrate GitHub Copilot for Maximum Productivity in 30 Minutes

How to Integrate GitHub Copilot for Maximum Productivity in 30 Minutes As indie hackers and solo founders, we’re always on the lookout for tools that can save us time and boost our

Mar 23, 20263 min read
Ai Coding Tools

How to Create Your First App Using AI Coding Tools in Just 3 Days

How to Create Your First App Using AI Coding Tools in Just 3 Days Building your first app can feel like climbing Mount Everest, especially if you're not a seasoned coder. But what

Mar 23, 20264 min read
Ai Coding Tools

How to Integrate AI Tools for Coding Projects in 30 Minutes

How to Integrate AI Tools for Coding Projects in 30 Minutes Integrating AI tools into your coding projects can feel like a daunting task, especially if you’re a solo founder or ind

Mar 23, 20264 min read
Ai Coding Tools

Bolt.new vs GitHub Copilot: Which AI Coding Tool Offers More Value in 2026?

Bolt.new vs GitHub Copilot: Which AI Coding Tool Offers More Value in 2026? As indie hackers and solo founders, we’re always on the lookout for tools that can streamline our coding

Mar 23, 20263 min read