Ai Coding Tools

How to Build a Basic Web App Using AI Tools in 3 Hours

By BTW Team4 min read

Comparing tools? See the AI tools tested on the show.

In short

A step-by-step tutorial on leveraging AI coding tools to construct a functional web app within just 3 hours, perfect for those new to web development.

Have you ever thought about building a web app but felt overwhelmed by the technical skills needed? You’re not alone. Many indie hackers and solo founders struggle to find the right tools that simplify the process without breaking the bank. In this guide, I'll walk you through building a basic web app using AI tools in just 3 hours—yes, you read that right. By the end of this, you’ll have a functional web app and a clearer understanding of AI tools that can help you build your next project.

Prerequisites: What You Need to Get Started

Before diving in, here’s what you’ll need:

  • A computer: Any modern laptop or desktop will work.
  • An internet connection: You’ll be using cloud-based tools.
  • Basic understanding of programming: Familiarity with JavaScript, HTML, or Python is a plus but not mandatory.
  • Accounts with the following tools:
    • OpenAI (for AI model access)
    • Firebase (for backend and database)
    • Vercel (for deployment)

Step 1: Set Up Your AI Model

First, let’s get the AI component up and running. For this, we’ll use OpenAI's API.

  1. Create an OpenAI account.
  2. Generate an API key.
  3. Set up a simple function to make API calls:
    async function callAI(input) {
        const response = await fetch('https://api.openai.com/v1/chat/completions', {
            method: 'POST',
            headers: {
                'Authorization': `Bearer YOUR_API_KEY`,
                'Content-Type': 'application/json',
            },
            body: JSON.stringify({
                model: 'gpt-3.5-turbo',
                messages: [{ role: 'user', content: input }],
            }),
        });
        return await response.json();
    }
    
  4. Test your function to ensure it returns a valid response.

Expected output: A JSON response with AI-generated text.

Step 2: Set Up Your Database with Firebase

Next, we’ll set up Firebase for database management.

  1. Create a Firebase project.
  2. Add Firebase to your web app following this guide.
  3. Initialize Firebase in your project:
    import { initializeApp } from "firebase/app";
    import { getDatabase } from "firebase/database";
    
    const firebaseConfig = {
        apiKey: "YOUR_API_KEY",
        authDomain: "YOUR_AUTH_DOMAIN",
        databaseURL: "YOUR_DATABASE_URL",
        projectId: "YOUR_PROJECT_ID",
        storageBucket: "YOUR_STORAGE_BUCKET",
        messagingSenderId: "YOUR_MESSAGING_SENDER_ID",
        appId: "YOUR_APP_ID"
    };
    
    const app = initializeApp(firebaseConfig);
    const database = getDatabase(app);
    
  4. Create a simple function to write data to Firebase.

Expected output: Data saved in your Firebase database.

Step 3: Build the Frontend

Now, let’s build a simple UI using HTML and CSS.

  1. Create an index.html file:

    <html>
    <head>
        <title>My AI Web App</title>
    </head>
    <body>
        <h1>AI Web App</h1>
        <textarea id="input" placeholder="Ask something..."></textarea>
        <button id="submit">Submit</button>
        <div id="output"></div>
        <script src="app.js"></script>
    </body>
    </html>
    
  2. Add functionality to handle user input in your app.js:

    document.getElementById('submit').addEventListener('click', async () => {
        const input = document.getElementById('input').value;
        const aiResponse = await callAI(input);
        document.getElementById('output').innerText = aiResponse.choices[0].message.content;
    });
    

Expected output: The app displays the AI's response when the user submits a question.

Step 4: Deploy Your App

Finally, let’s deploy your web app using Vercel.

  1. Create a Vercel account.
  2. Install Vercel CLI: Run npm i -g vercel.
  3. Deploy your app by running vercel in your project folder.
  4. Follow the prompts to set up your deployment.

Expected output: Your app is live on the web with a unique URL.

Troubleshooting: What Could Go Wrong

  • API errors: Double-check your API key and ensure you’re within usage limits.
  • Firebase issues: Ensure your database rules allow read/write access for testing.
  • Deployment problems: Make sure your project structure is correct, and all files are included.

What’s Next?

Now that you have a basic web app, consider enhancing it with more features. You could:

  • Integrate user authentication with Firebase.
  • Add more complex AI functionalities.
  • Improve the UI using frameworks like React or Vue.js.

Conclusion: Start Here!

Building a web app with AI tools can be a straightforward process if you use the right resources. Start with the steps outlined above, and don't hesitate to iterate and expand your app. Remember, it’s all about shipping something functional first and improving it over time.

Tools You Can Use

Here’s a summary of the tools we mentioned:

| Tool | What It Does | Pricing | Best For | Limitations | Our Take | |------------|--------------------------------------------|-----------------------------|------------------------------|--------------------------------------|----------------------------------| | OpenAI | AI text generation | Free tier + $20/mo pro | Quick AI responses | Limited free usage, API call costs | We use this for generating text. | | Firebase | Backend and database management | Free tier + usage-based | Scalable database solutions | Costs can add up with large data | Essential for our projects. | | Vercel | Deployment platform for web apps | Free tier + $20/mo pro | Fast and easy deployments | Limited to free tier features | Great for quick deployments. |

What We Actually Use

For our projects, we rely heavily on OpenAI for AI capabilities, Firebase for backend services, and Vercel for deployment. These tools keep our costs manageable while providing the features we need to build effectively.

Watch real AI builds every week

Built This Week is a weekly podcast where Jordan Metzner and Sam Nadler build something real with AI every episode, test new AI tools and talk with founders who build with AI.

See the tools

Watch real AI builds every week

Built This Week is a weekly podcast where Jordan Metzner and Sam Nadler build something real with AI every episode, test new AI tools and talk with founders who build with AI.

See the tools
Ai Coding Tools

3 AI Coding Tools That Are Overrated (and Why You Should Avoid Them)

3 AI Coding Tools That Are Overrated (and Why You Should Avoid Them) In the everevolving landscape of AI coding tools, it's easy to get swept up in the hype. As indie hackers and s

Nov 30, 20263 min read
Ai Coding Tools

5 Ways AI Coding Tools Can Accelerate Your MVP Development in 2026

5 Ways AI Coding Tools Can Accelerate Your MVP Development in 2026 In 2026, the landscape for indie hackers and solo founders has evolved significantly, especially with the advent

Nov 26, 20264 min read
Ai Coding Tools

5 AI Coding Tools That Make Legacy Code Feel Brand New in 2026

5 AI Coding Tools That Make Legacy Code Feel Brand New in 2026 If you’re a developer stuck maintaining legacy code, you know the frustration. It’s like navigating a maze blindfolde

Nov 23, 20264 min read
Ai Coding Tools

10 AI Coding Tools That Will Save You Hours of Debugging in 2026

10 AI Coding Tools That Will Save You Hours of Debugging in 2026 Debugging can feel like a neverending cycle of frustration. Whether you're a solo founder or an indie hacker, spend

Nov 18, 20265 min read
Ai Coding Tools

10 Common Mistakes When Using AI Coding Tools for MVP Development

10 Common Mistakes When Using AI Coding Tools for MVP Development As a founder in 2026, you’re likely aware that AI coding tools can significantly speed up the MVP development proc

Nov 16, 20264 min read
Ai Coding Tools

5 AI Coding Myths Every Beginner Developer Should Ditch in 2026

5 AI Coding Myths Every Beginner Developer Should Ditch in 2026 As a beginner developer, you’ve probably come across a ton of buzz surrounding AI coding tools. But with all the hyp

Nov 12, 20263 min read