How to Use GitHub Copilot to Write Your First App in 2 Hours
How to Use GitHub Copilot to Write Your First App in 2026
If you’ve ever stared at a blank screen and felt overwhelmed by the prospect of building your first app, you're not alone. With so many frameworks, languages, and tools out there, it’s easy to feel paralyzed. Enter GitHub Copilot: an AI pair programmer that can help you write code faster and more efficiently. In this guide, I’ll show you how to leverage GitHub Copilot to create a simple app in just 2 hours.
Prerequisites: What You Need Before Getting Started
Before diving in, make sure you have the following tools and accounts set up:
- GitHub Account: Sign up for free if you don’t have one already.
- Visual Studio Code: Download and install this code editor. It’s free and widely used.
- GitHub Copilot: You’ll need a subscription, which is currently $10/month after a free trial.
- Basic Understanding of JavaScript: Familiarity with the basics will help you understand the code Copilot generates.
Step 1: Setting Up Your Environment (15 Minutes)
- Install Visual Studio Code: If you haven't done this yet, go to Visual Studio Code and download it for your operating system.
- Install GitHub Copilot: Open Visual Studio Code, go to Extensions (Ctrl+Shift+X), and search for "GitHub Copilot". Click "Install".
- Log Into GitHub: Open the Command Palette (Ctrl+Shift+P) and type
GitHub: Sign in. Follow the prompts to authenticate.
Step 2: Creating Your Project (15 Minutes)
- Create a New Folder: Name it something like "MyFirstApp".
- Open the Terminal: In VS Code, open the terminal (Ctrl+`).
- Initialize a Git Repository: Run
git init. - Create an
index.htmlfile: This will be the main file for your app. You can do this in the terminal withtouch index.html.
Step 3: Start Writing Code with Copilot (1 Hour)
3.1 HTML Structure
- Type
<!DOCTYPE html>and press Enter. Copilot will suggest the rest of the HTML structure. Accept the suggestion.
3.2 Adding a Header
- Type
<!-- Header -->and thenconst header = document.createElement('h1'); header.textContent = 'Welcome to My First App';. Copilot will suggest the full function to append the header to the body.
3.3 Adding a Button
- Type
<!-- Button -->and thenconst button = document.createElement('button'); button.textContent = 'Click Me';. Accept Copilot’s suggestion to add an event listener that will display an alert when clicked.
3.4 Styling Your App
- Create a new file called
styles.cssand typebody { font-family: Arial; }. Copilot will suggest styles. Accept and modify them as needed.
3.5 Final Touches
- Link your CSS file in the HTML:
<link rel="stylesheet" href="styles.css">. Again, let Copilot suggest any additional enhancements.
Step 4: Testing Your App (15 Minutes)
- Open the HTML File: Right-click on
index.htmlin VS Code and select "Open with Live Server" (install the Live Server extension if you don't have it). - Interact with Your App: Click the button and see if the alert displays. If not, check the console for errors.
Troubleshooting: What Could Go Wrong?
- Copilot Isn’t Suggesting Code: Make sure you’re logged in and that the extension is enabled.
- Errors in the Console: Common issues include typos or missing semicolons. Check your syntax carefully.
- HTML/CSS Not Rendering: Ensure your paths to files are correct, and the Live Server is running.
What's Next?
Now that you’ve built your first app, consider deploying it using services like GitHub Pages or Vercel. You can also explore adding more features, like a backend with Node.js or a database using Firebase.
Conclusion: Start Here
Using GitHub Copilot can significantly reduce the learning curve for building your first app. With just a few hours, you can have a functioning project that’s ready for further development. I recommend starting with a simple idea and iterating from there.
What We Actually Use
In our experience, we rely heavily on GitHub Copilot for rapid prototyping. It saves us time and helps us understand coding patterns better, although it’s not perfect and sometimes requires manual adjustments.
Follow Our Building Journey
Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.