Ai Coding Tools

How to Use GitHub Copilot to Build a Simple Web App in 2 Hours

By BTW Team3 min read

How to Use GitHub Copilot to Build a Simple Web App in 2026

If you’ve ever felt overwhelmed staring at a blank code editor, you're not alone. As indie hackers and side project builders, we often deal with the pressure of needing to code efficiently without spending days on trivial tasks. Enter GitHub Copilot, a powerful AI coding assistant that promises to accelerate your development process. In this guide, I’ll show you how to leverage GitHub Copilot to build a simple web app in just 2 hours.

Prerequisites

Before we dive in, here’s what you’ll need:

  • GitHub Copilot subscription: $10/month or $100/year.
  • A GitHub account: Free.
  • Code editor: Visual Studio Code (VS Code) - Free.
  • Node.js and npm: Free, necessary for running your web app locally.
  • Basic understanding of JavaScript: If you’re familiar with basic programming concepts, you’ll be fine.

Step 1: Set Up Your Environment

  1. Install Node.js: Download and install Node.js from nodejs.org. This will also install npm, which is essential for managing packages.

  2. Set Up VS Code: If you haven’t already, download and install Visual Studio Code from code.visualstudio.com.

  3. Install GitHub Copilot: In VS Code, go to Extensions (Ctrl+Shift+X) and search for "GitHub Copilot." Click “Install” and sign in with your GitHub account.

Step 2: Create Your Web App

  1. Create a New Directory: Open your terminal and run:

    mkdir simple-web-app
    cd simple-web-app
    
  2. Initialize the Project: Run:

    npm init -y
    

    This creates a package.json file with default settings.

  3. Install Express: We’ll use Express.js for our web server:

    npm install express
    

Step 3: Write Code with GitHub Copilot

Now comes the fun part—coding with Copilot!

  1. Create an index.js file in your project directory:

    touch index.js
    
  2. Start Writing Code: Open index.js in VS Code and type the following comment:

    // Create a simple Express server
    

    Copilot will suggest code snippets for your server setup. Accept the suggestions by hitting the Tab key.

  3. Basic Server Setup: Your code should look something like this:

    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}`);
    });
    
  4. Run Your Server: Back in the terminal, run:

    node index.js
    

    Visit http://localhost:3000 in your browser, and you should see "Hello World!"

Step 4: Add More Features

To enhance your web app, let’s add a simple route that returns JSON data.

  1. Add the Route: In index.js, add a new route:

    // API endpoint to fetch data
    app.get('/api/data', (req, res) => {
        res.json({ message: 'This is your data!' });
    });
    
  2. Test the API: Restart your server and visit http://localhost:3000/api/data to see the JSON response.

Troubleshooting: What Could Go Wrong

  • Copilot Suggesting Incorrect Code: Sometimes, Copilot might suggest outdated or incorrect code. Always double-check its suggestions.
  • Server Not Starting: Ensure that you have installed all necessary packages and that you are running the correct command in your terminal.

What's Next

With your basic web app up and running, consider expanding it by adding a frontend framework like React or Vue.js. You could also deploy it using services like Vercel or Heroku, which are both cost-effective options for indie projects.

Conclusion

Using GitHub Copilot can significantly speed up your development process, allowing you to focus on building rather than getting stuck on syntax. If you follow the steps outlined above, you can have a functional web app in about 2 hours.

Start Here: If you’re looking to dive deeper into AI coding tools and their practical applications, make sure to check out our weekly podcast, Built This Week, where we discuss tools we’ve tested, products we’re shipping, and lessons learned from building in public.

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 Beginners Overlook in 2026

10 AI Coding Tools Beginners Overlook in 2026 As a beginner in coding, diving into the vast ocean of AI tools can feel overwhelming. While flashy tools often grab the spotlight, ma

Oct 6, 20265 min read
Ai Coding Tools

5 Common Misconceptions About AI Coding Tools That Beginners Believe

5 Common Misconceptions About AI Coding Tools That Beginners Believe As a solo founder or indie hacker, diving into the world of AI coding tools can feel overwhelming, especially i

Oct 5, 20263 min read
Ai Coding Tools

5 Mistakes Every Beginner Makes When Using AI Coding Tools

5 Mistakes Every Beginner Makes When Using AI Coding Tools As a solo founder or indie hacker diving into the world of AI coding tools, it’s easy to get swept up in the excitement o

Oct 4, 20264 min read
Ai Coding Tools

10 Common Misconceptions About AI Coding Tools in 2026

10 Common Misconceptions About AI Coding Tools in 2026 As we dive into 2026, AI coding tools have become a staple in the developer toolkit. However, misconceptions still run rampan

Oct 4, 20264 min read
Ai Coding Tools

5 Mistakes to Avoid When Using AI Coding Tools for Real Projects

5 Mistakes to Avoid When Using AI Coding Tools for Real Projects As we dive deeper into 2026, AI coding tools have become an essential part of the developer's toolkit. However, usi

Oct 4, 20264 min read
Ai Coding Tools

5 Common Misconceptions About AI Coding Tools and Why They Matter

5 Common Misconceptions About AI Coding Tools and Why They Matter As a solo founder or indie hacker, you’re likely eyeing AI coding tools to boost your productivity and streamline

Oct 4, 20264 min read