How to Build a Basic App Using GitHub Copilot in 2 Hours
How to Build a Basic App Using GitHub Copilot in 2 Hours
Building a web application can feel like a daunting task, especially if you’re a solo founder or indie hacker juggling multiple responsibilities. The good news is that with tools like GitHub Copilot, you can significantly speed up the development process. In this guide, I’ll show you how to build a basic app using GitHub Copilot in about 2 hours.
Prerequisites
Before diving in, make sure you have the following:
- GitHub Account: You’ll need this to use Copilot.
- Visual Studio Code: This is where you’ll write your code.
- GitHub Copilot Subscription: Costs $10/month, but you can start with a free trial.
- Basic Understanding of JavaScript: Familiarity with the language will help, but Copilot can assist even beginners.
Step 1: Setting Up Your Environment
- Install Visual Studio Code: Download and install from here.
- Install GitHub Copilot: Go to the Extensions tab in VS Code, search for "GitHub Copilot," and install it.
Expected Output: After installation, you should see a Copilot icon in the toolbar.
Step 2: Create a New Repository
- Go to GitHub and create a new repository named
basic-app. - Clone the repository to your local machine using:
git clone https://github.com/yourusername/basic-app.git - Open the project in Visual Studio Code.
Expected Output: The cloned repository should display in your editor.
Step 3: Start Coding with Copilot
-
Create an
index.htmlfile and start typing the HTML structure. Copilot will suggest completions.<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Basic App</title> </head> <body> <h1>Hello, World!</h1> </body> </html>Expected Output: You should see a basic HTML template with suggestions from Copilot.
-
Create a
script.jsfile and let Copilot help with JavaScript functions. Start typing:function greet() { alert('Welcome to the Basic App!'); }Expected Output: Copilot should suggest the complete function as you type.
Step 4: Run Your App
- Open a terminal in Visual Studio Code and use the Live Server extension to view your app.
- Install Live Server from the Extensions tab if you haven’t done so already.
- Right-click
index.htmland select "Open with Live Server."
Expected Output: Your app should now be running in the browser, displaying "Hello, World!" and greeting you upon page load.
Troubleshooting
- Copilot Not Suggesting Code: Make sure you are connected to the internet and signed in to GitHub.
- Live Server Not Starting: Check if the Live Server extension is installed and that you are opening the correct HTML file.
What’s Next?
Now that you have a basic app, consider adding features like a form, API calls, or even a database connection. Use Copilot to help with these enhancements, and don’t hesitate to iterate on your project.
Conclusion
Using GitHub Copilot, building a basic app in 2 hours is not just feasible but also a learning experience. If you’re new to coding or want to speed up your development process, start with Copilot.
Our Recommendation: Dive into GitHub Copilot with a focus on small projects. It’s especially useful for iterating quickly on ideas without getting bogged down in syntax and boilerplate code.
Follow Our Building Journey
Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.