Ai Coding Tools

How to Build a Simple AI App with Cursor in Under 2 Hours

By BTW Team3 min read

How to Build a Simple AI App with Cursor in Under 2 Hours

Building an AI app sounds daunting, right? Especially if you’re a beginner. But what if I told you that you could get a basic AI app up and running in under two hours? In 2026, tools like Cursor have made it easier than ever to create simple applications without needing a PhD in machine learning. Let’s dive into how you can use Cursor to build a straightforward AI app, even if you’re just starting.

Prerequisites: What You Need Before You Start

Before we jump into the how-to, make sure you have the following:

  1. Cursor Account: Sign up for a free account at Cursor.
  2. Basic Coding Knowledge: Familiarity with JavaScript will help, but you can follow along if you’re willing to learn.
  3. Node.js: Ensure you have Node.js installed on your computer. You can download it here.
  4. A Code Editor: Use any code editor you prefer, like VSCode or Atom.

Step 1: Setting Up Your Environment

First things first, let’s set up our environment.

  1. Open your terminal and create a new project directory:
    mkdir simple-ai-app
    cd simple-ai-app
    
  2. Initialize a new Node.js project:
    npm init -y
    
  3. Install the Cursor SDK:
    npm install cursor-sdk
    

Step 2: Building Your First AI Function

Now, let’s write some code to create a simple AI function. For this example, we’ll create an app that generates random jokes using Cursor’s built-in capabilities.

  1. Create a new file called app.js in your project directory.

  2. Add the following code to app.js:

    const Cursor = require('cursor-sdk');
    
    const cursor = new Cursor();
    
    async function getJoke() {
        const joke = await cursor.generate({
            prompt: "Tell me a joke",
            maxTokens: 30,
        });
        console.log(joke);
    }
    
    getJoke();
    
  3. Save the file.

Step 3: Running Your AI App

Now that we’ve written our code, let’s run it!

  1. In your terminal, run the following command:

    node app.js
    
  2. You should see a random joke printed in your terminal. Congratulations! You’ve just built a simple AI app in under two hours.

Troubleshooting: Common Issues and Solutions

  • Error: Module not found: If you encounter this error, ensure that you installed the Cursor SDK correctly.
  • API Key Issues: If your API key is not working, double-check it in your Cursor dashboard.

What's Next: Expanding Your AI App

Once you’ve got your basic app running, consider adding features like:

  • User Input: Allow users to request specific types of jokes.
  • Web Interface: Use frameworks like Express.js to create a web interface.
  • Deployment: Host your app using platforms like Heroku or Vercel.

Conclusion: Start Here

Building an AI app doesn’t have to be complicated. With Cursor, you can create something functional in just a couple of hours. Start by following the steps above, and don’t hesitate to experiment with your code. The best way to learn is by doing!

If you're interested in hearing more practical insights and tools for indie hackers, check out our weekly podcast, Built This Week, where we share real experiences and lessons learned from building in public.

Follow Our Building Journey

Weekly podcast episodes on tools we're testing, products we're shipping, and lessons from building in public.

Subscribe

Never miss an episode

Subscribe to Built This Week for weekly insights on AI tools, product building, and startup lessons from Ryz Labs.

Subscribe
Ai Coding Tools

Cursor vs GitHub Copilot: Which AI Tool is Better for Indie Developers in 2026?

Cursor vs GitHub Copilot: Which AI Tool is Better for Indie Developers in 2026? As an indie developer, you’re likely juggling multiple projects, often working solo or in small team

Mar 15, 20263 min read
Ai Coding Tools

How to Enhance Your Coding Skills Using AI Tools in Just 30 Days

How to Enhance Your Coding Skills Using AI Tools in Just 30 Days In 2026, the coding landscape is evolving rapidly, and leveraging AI tools can supercharge your learning process. B

Mar 15, 20264 min read
Ai Coding Tools

AI Coding Tools Comparison: GitHub Copilot vs Cursor - Which is Better in 2026?

AI Coding Tools Comparison: GitHub Copilot vs Cursor Which is Better in 2026? In the everevolving world of software development, AI coding tools have become essential for indie ha

Mar 15, 20263 min read
Ai Coding Tools

Comparing GitHub Copilot vs Codeium: Which AI Tool is Right for You in 2026?

Comparing GitHub Copilot vs Codeium: Which AI Tool is Right for You in 2026? As a solo founder or indie hacker, choosing the right AI coding tool can feel daunting—especially with

Mar 15, 20263 min read
Ai Coding Tools

How to Use GitHub Copilot to Write Your First Code in Under 2 Hours

How to Use GitHub Copilot to Write Your First Code in Under 2 Hours If you're a beginner looking to dive into coding but feel overwhelmed by the complexity, you're not alone. Many

Mar 15, 20263 min read
Ai Coding Tools

Cursor vs Codeium: Which AI Coding Assistant Suits Your Style?

Cursor vs Codeium: Which AI Coding Assistant Suits Your Style? As a solo founder or indie hacker, finding the right tools to streamline your coding process can make a significant d

Mar 15, 20263 min read