How to Use GitHub Copilot to Code Your First App in 2 Hours
How to Use GitHub Copilot to Code Your First App in 2026
If you've ever thought about building an app but felt overwhelmed by the coding part, you're not alone. Many aspiring developers get stuck at the beginning, unsure of where to start or how to write code efficiently. Enter GitHub Copilot, a tool that can help you write code faster and with less friction. In this guide, I’ll walk you through how to use GitHub Copilot to code your first app in just 2 hours.
Prerequisites
Before we dive in, here’s what you need to get started:
- GitHub Account: Sign up for a free account if you don’t have one already.
- Visual Studio Code: Download and install this code editor if you haven’t yet.
- GitHub Copilot Subscription: It costs $10/month after a free trial.
- Basic Understanding of JavaScript: Familiarity with basic programming concepts will help, but you don’t need to be an expert.
Step 1: Setting Up Your Environment
- Install Visual Studio Code: Once installed, open it.
- Install GitHub Copilot: Go to the Extensions view (
Ctrl+Shift+X), search for “GitHub Copilot,” and install it. - Sign in to GitHub: You’ll need to authorize the extension to access your GitHub account.
Expected Output: You should see the GitHub Copilot icon in the status bar of Visual Studio Code.
Step 2: Starting Your First Project
- Create a New Project Folder: Open a terminal and create a new directory for your app.
mkdir my-first-app cd my-first-app - Initialize a Git Repository: Run
git initto create a new Git repository. - Create an HTML File: Inside your project folder, create an
index.htmlfile and open it in Visual Studio Code.
Expected Output: Your project structure should look like this:
my-first-app/
│
└── index.html
Step 3: Writing Code with Copilot
- Start Typing: In your
index.html, begin by typing<!DOCTYPE html>. Copilot will suggest completing the HTML structure. - Add a Title: Type
<title>My First App</title>. Copilot will suggest the full<head>and<body>structure.
Example Code Snippet:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First App</title>
</head>
<body>
<h1>Welcome to My First App</h1>
</body>
</html>
Expected Output: Your index.html should now contain a basic HTML structure.
Step 4: Adding Functionality
- Create a JavaScript File: Add a
script.jsfile in your project folder. - Write a Simple Function: In
script.js, start by typing a function that greets the user. For example:function greetUser() { return "Hello, World!"; } - Connect JavaScript to HTML: In your
index.html, link the JavaScript file:<script src="script.js"></script>
Expected Output: When you open index.html in a browser, it should load the HTML, and you can test the JavaScript in the console.
Troubleshooting: What Could Go Wrong
- Copilot Suggestions Don’t Appear: Make sure you're connected to the internet and that the extension is enabled.
- Code Doesn't Work: Double-check your syntax. Copilot might suggest code that’s not perfect for your context.
What's Next?
After you’ve built your first app, consider expanding it by adding CSS for styling or exploring frameworks like React or Vue.js. Both of these can work well alongside GitHub Copilot to streamline your development process.
Conclusion: Start Here
Using GitHub Copilot can significantly speed up your coding, especially when you're just starting out. By following the steps above, you can build your first app in about 2 hours. The key is to leverage Copilot’s suggestions while still learning the basics of coding.
If you’re ready to dive in, give it a shot—GitHub Copilot may just be the assistant you need to turn your app idea into reality.
Follow Our Building Journey
Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.