How to Use GitHub Copilot to Write a Simple Web App in 2 Hours
How to Use GitHub Copilot to Write a Simple Web App in 2026
If you're a solo founder or indie hacker, chances are you've encountered the daunting task of building a web app from scratch. The coding part can feel like a mountain to climb, especially if you're short on time or experience. Enter GitHub Copilot: an AI-powered coding assistant that can help you write a simple web app in about two hours. Sounds too good to be true? Let’s break down how to leverage this tool effectively.
Time Estimate and Prerequisites
Time: You can finish this in about 2 hours if you follow along closely.
Prerequisites:
- A GitHub account (Free tier available)
- Visual Studio Code (VS Code) installed
- GitHub Copilot subscription (Free trial available, then $10/month)
- Basic understanding of JavaScript and HTML
Step 1: Set Up Your Environment
- Install Visual Studio Code: Download and install VS Code.
- Install GitHub Copilot: Open VS Code, go to Extensions, and search for "GitHub Copilot". Click install.
- Sign In: Sign in with your GitHub account and activate your Copilot subscription.
Expected Output
At this stage, you should see the GitHub Copilot logo in the bottom right corner of VS Code, indicating that it's ready to assist you.
Step 2: Create Your Project Structure
- Create a New Folder: Name it
simple-web-app. - Open the Folder in VS Code: Click
File > Open Folder. - Create HTML and JavaScript Files: Inside your folder, create two files:
index.htmlandapp.js.
Expected Output
You should have a folder structure that looks like this:
simple-web-app/
├── index.html
└── app.js
Step 3: Write Your HTML
In index.html, start typing the basic HTML structure. GitHub Copilot will suggest code snippets as you type.
- Type
<!DOCTYPE html>and pressEnter. - Start typing
<html>and then hitEnter. Copilot will suggest a complete HTML boilerplate. Accept the suggestion.
Expected Output
The index.html should now contain a basic HTML structure with a title and linked app.js.
Step 4: Write Your JavaScript
Switch to app.js and start coding the functionality. For example, if you want to create a simple button click event:
- Type
functionand pressEnter. Copilot will suggest a function. Accept the suggestion. - Type
document.getElementById('myButton').addEventListener('click', function() {and let Copilot fill in the rest.
Expected Output
Your app.js should have a function that listens for a button click and performs an action, like displaying an alert.
Step 5: Testing Your App
- Open
index.htmlin your browser. - Click the button you created. If everything is set up correctly, you should see an alert.
Troubleshooting
- If the alert doesn’t show: Check your JavaScript console for errors. Common issues include incorrect element IDs or syntax errors.
- If Copilot isn’t suggesting any code: Make sure you’re online and that the extension is properly installed.
What's Next?
Once you've completed your simple web app, consider exploring more features such as adding styles with CSS or integrating a backend service. You can also iterate on this project by adding more functionalities.
Conclusion: Start Here
If you're looking to build a simple web app quickly, GitHub Copilot can be a significant asset. It reduces the friction of coding by providing real-time suggestions based on what you’re writing. Remember, it's not perfect, and you'll still need to understand the code it generates, but it can save you a lot of time.
Our Recommendation: Start with a small project and let Copilot guide you. As you become more comfortable, you can tackle more complex applications.
Follow Our Building Journey
Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.