Ai Coding Tools

How to Build a Simple Web App with AI Coding Assistance in Just 2 Hours

By BTW Team4 min read

Comparing tools? See the AI tools tested on the show.

In short

A step-by-step tutorial on leveraging AI coding tools to create a fully functional web application in only 2 hours, perfect for those new to coding.

Building a web app can often feel like an overwhelming task, especially for indie hackers and solo founders who are juggling multiple responsibilities. The good news? With the rise of AI coding tools, you can now build a simple web app in about 2 hours—yes, really. In this guide, I’ll walk you through the process, share the tools that will help you, and provide honest insights from our own experience.

Prerequisites: What You Need Before Starting

Before diving into the development process, make sure you have the following:

  1. A Code Editor: We recommend Visual Studio Code (VSCode) for its extensive plugin support.
  2. Basic HTML, CSS, and JavaScript Knowledge: You don’t need to be an expert, but familiarity helps.
  3. An OpenAI Account: If you want coding assistance, sign up for OpenAI’s API for GPT-3.5 or later.
  4. Node.js Installed: This is essential for running your web app locally.

Step 1: Define Your Web App Idea

Take a moment to outline what your web app will do. Keep it simple. For example, let’s say you want to build a "To-Do List" app. This keeps the scope manageable and allows you to focus on execution.

Step 2: Set Up Your Development Environment

  1. Create a New Project Folder: This will hold all your files.
  2. Initialize Node.js: Run npm init -y in your terminal to create a package.json file.
  3. Install Dependencies: Use the command npm install express to set up a server quickly.

Step 3: Use AI Coding Assistance to Generate Code

This is where the magic happens. Using OpenAI’s API or a tool like GitHub Copilot, you can generate code snippets.

Example Code Snippet for a Simple Server:

const express = require('express');
const app = express();
const PORT = process.env.PORT || 3000;

app.use(express.json());

app.get('/', (req, res) => {
    res.send('Hello, World!');
});

app.listen(PORT, () => {
    console.log(`Server is running on port ${PORT}`);
});

Tool Comparison Table

| Tool | Pricing | Best For | Limitations | Our Take | |--------------------|---------------------------|------------------------------------|------------------------------------------|----------------------------------| | OpenAI (GPT-3.5) | Free tier + $0.03/1k tokens | Code generation and assistance | Limited by token usage | We use this for generating code snippets | | GitHub Copilot | $10/mo | Real-time code suggestions | Limited to supported languages | We like Copilot for its context awareness | | Replit | Free tier + $20/mo | Collaborative coding | Performance issues on complex apps | Great for quick prototypes | | Codeium | Free | Code suggestions | Less refined than others | We use this for quick fixes | | Tabnine | Free tier + $12/mo | AI-powered autocompletion | Limited support for some frameworks | Good for standard coding tasks | | Sourcery | Free + $12/mo for Pro | Code reviews and improvements | Limited to Python | Not our primary choice |

Step 4: Build Your Frontend

For the frontend, you can use simple HTML and CSS. Here’s a basic structure for your To-Do List app:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>To-Do List</title>
</head>
<body>
    <h1>My To-Do List</h1>
    <input type="text" id="task" placeholder="Add a new task">
    <button onclick="addTask()">Add</button>
    <ul id="taskList"></ul>
    <script src="app.js"></script>
</body>
</html>

Step 5: Connect Frontend and Backend

Using Fetch API, you can connect your frontend to the backend. Here's an example of how to add a task:

function addTask() {
    const taskInput = document.getElementById('task').value;
    fetch('/add-task', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({ task: taskInput })
    }).then(response => response.json())
      .then(data => console.log(data));
}

Troubleshooting: What Could Go Wrong

  1. API Key Issues: Make sure your OpenAI API key is set up correctly.
  2. CORS Errors: If you encounter issues with fetch, check your server settings for CORS.
  3. Syntax Errors: Double-check your JavaScript for any typos.

What’s Next?

Once you have your simple web app running, consider these next steps:

  • Deploy Your App: Use platforms like Vercel or Heroku to host your app.
  • Add Features: Enhance your app with user authentication or database integration.
  • Gather Feedback: Share your app with friends or on forums to receive constructive criticism.

Conclusion: Start Here

If you’re looking to build a simple web app quickly, leveraging AI coding tools can significantly speed up the process. Start with a clear idea, use the right tools, and don’t hesitate to iterate based on user feedback.

What We Actually Use

In our experience, we rely heavily on OpenAI for generating code snippets and GitHub Copilot for real-time suggestions. This combo allows us to focus on building rather than getting bogged down in syntax.

Watch real AI builds every week

Built This Week is a weekly podcast where Jordan Metzner and Sam Nadler build something real with AI every episode, test new AI tools and talk with founders who build with AI.

See the tools

Watch real AI builds every week

Built This Week is a weekly podcast where Jordan Metzner and Sam Nadler build something real with AI every episode, test new AI tools and talk with founders who build with AI.

See the tools
Ai Coding Tools

3 AI Coding Tools That Are Overrated (and Why You Should Avoid Them)

3 AI Coding Tools That Are Overrated (and Why You Should Avoid Them) In the everevolving landscape of AI coding tools, it's easy to get swept up in the hype. As indie hackers and s

Nov 30, 20263 min read
Ai Coding Tools

5 Ways AI Coding Tools Can Accelerate Your MVP Development in 2026

5 Ways AI Coding Tools Can Accelerate Your MVP Development in 2026 In 2026, the landscape for indie hackers and solo founders has evolved significantly, especially with the advent

Nov 26, 20264 min read
Ai Coding Tools

5 AI Coding Tools That Make Legacy Code Feel Brand New in 2026

5 AI Coding Tools That Make Legacy Code Feel Brand New in 2026 If you’re a developer stuck maintaining legacy code, you know the frustration. It’s like navigating a maze blindfolde

Nov 23, 20264 min read
Ai Coding Tools

10 AI Coding Tools That Will Save You Hours of Debugging in 2026

10 AI Coding Tools That Will Save You Hours of Debugging in 2026 Debugging can feel like a neverending cycle of frustration. Whether you're a solo founder or an indie hacker, spend

Nov 18, 20265 min read
Ai Coding Tools

10 Common Mistakes When Using AI Coding Tools for MVP Development

10 Common Mistakes When Using AI Coding Tools for MVP Development As a founder in 2026, you’re likely aware that AI coding tools can significantly speed up the MVP development proc

Nov 16, 20264 min read
Ai Coding Tools

5 AI Coding Myths Every Beginner Developer Should Ditch in 2026

5 AI Coding Myths Every Beginner Developer Should Ditch in 2026 As a beginner developer, you’ve probably come across a ton of buzz surrounding AI coding tools. But with all the hyp

Nov 12, 20263 min read