How to Use GitHub Copilot to Write Your First Simple App in 2 Hours
How to Use GitHub Copilot to Write Your First Simple App in 2026
If you're just getting started with coding, you might feel overwhelmed by the thought of building an app. The good news? GitHub Copilot can be a game-changer, helping you write code faster and with fewer headaches. In this guide, I’ll walk you through using GitHub Copilot to build a simple app in about 2 hours. Whether you’re an indie hacker or a side project builder, this is a practical approach to get you shipping quickly.
Time Estimate: 2 Hours
You can finish this project in about 2 hours if you follow along step-by-step.
Prerequisites
Before diving in, make sure you have the following set up:
- GitHub Account: Free to create.
- Visual Studio Code (VS Code): Download and install from here.
- GitHub Copilot: You can get started with a 14-day free trial, then it’s $10/month.
- Node.js: Download and install from here.
- Basic understanding of JavaScript and HTML.
Step-by-Step Guide
Step 1: Set Up Your Development Environment
- Open Visual Studio Code.
- Install the GitHub Copilot extension from the Extensions Marketplace.
- Create a new folder for your project and open it in VS Code.
Step 2: Initialize Your App
-
Open the terminal in VS Code and run:
npm init -yThis creates a
package.jsonfile for your app. -
Create an
index.jsfile in the root of your project folder.
Step 3: Use Copilot to Generate Code
-
Start typing a comment in
index.jsdescribing what you want to do. For example:// Create a simple web server that responds with "Hello, World!" -
Copilot will suggest code. Accept the suggestion by pressing
Tab. The output should look something like this:const http = require('http'); const server = http.createServer((req, res) => { res.statusCode = 200; res.setHeader('Content-Type', 'text/plain'); res.end('Hello, World!\n'); }); server.listen(3000, () => { console.log('Server running at http://localhost:3000/'); });
Step 4: Run Your App
- In the terminal, run:
node index.js - Open your browser and go to
http://localhost:3000. You should see "Hello, World!" displayed.
Step 5: Expand Your App
-
Let’s add a route to respond to a different endpoint. Type:
// Add a route that responds to "/about" with "This is a simple app." -
Accept Copilot's suggestions again to add the new route.
Troubleshooting
- What could go wrong: If you encounter errors, check the console for error messages. Common issues include forgetting to run
npm initor not having Node.js installed correctly. - Solutions: Ensure all dependencies are installed and that you are in the correct project directory when running commands.
What's Next?
Now that you’ve built a simple app, consider expanding its functionality. You could add a front-end using HTML/CSS or integrate a database.
Conclusion
Using GitHub Copilot can significantly speed up your coding process, especially if you're new to programming. Start with small features and gradually expand your app.
What We Actually Use
For our projects, we leverage GitHub Copilot for rapid prototyping, especially when we need to generate boilerplate code quickly. It’s not perfect, but it helps us get past initial roadblocks.
Follow Our Building Journey
Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.