Skip to main content
These days, developers and non-developers are building apps using AI coding assistants like Claude Code, Codex, Lovable, Base44, Antigravity, and Replit Agent. This flow is sometimes called “vibe coding”, a term Andrej Karpathy coined in early 2025. Vibe coding is attractive because:
  • You can prototype, iterate and create full-stack applications in minutes instead of hours, days, or even weeks.
  • You don’t need deep expertise on UI/UX, databases, APIs, and so on.
  • You can focus on what you want your app to do rather than integration details.
Technical expertise is very helpful when you run into errors or need to scale your application for production environments. The right prompting techniques can help you avoid many common pitfalls.
This tutorial shows you how to use these tools to build apps with Gloo AI: how to craft effective prompts and follow best practices for production-ready apps.

Prerequisites

Before starting, ensure you have:
  • A Gloo AI Studio account
  • Your API key from the API Keys page. Keep it on your server and out of source control; see API Key Security
  • Access to an AI coding assistant (Bolt.new, Lovable, Replit Agent, Claude Code, Codex, etc.)
  • Basic understanding of web applications (frontend + backend)
If you prefer to code manually, start with our Authentication Tutorial and other hands-on tutorials.

What you’ll build

One of three apps, generated by your AI coding assistant from a tested prompt:

How this tutorial works

Instead of code to copy, this tutorial gives you prompts that generate the code for you. The process:
  1. Choose your use case (chat app, tool use, etc.)
  2. Copy the prompt from this tutorial
  3. Paste into your AI coding assistant (Bolt.new, Lovable, Replit Agent, Claude Code, Codex, etc.)
  4. Generate the app
  5. Test and deploy the generated app
What makes a good prompt:
  • Clear objective (what you’re building)
  • Specific architecture (React, Vue, serverless, etc.)
  • Complete authentication pattern (API key as Bearer token)
  • Exact API endpoints and request/response formats
  • UI/UX requirements (mobile-responsive, loading states, etc.)
Each example follows this structure, so you can adapt it to your needs.

Step 1: Understanding Prompt Structure

Every effective prompt for a Gloo AI application has five components:

The authentication flow

Never expose credentials in frontend code. See API Key Security for the full set of practices. The figure below shows the flow for a properly authenticated Gloo AI API call.
Authenticated Gloo AI API flowAuthenticated Gloo AI API flow
Every prompt must include instructions for this, for example:
Practice: Before using the examples below, try writing a one-sentence objective for an app you want to build. This helps you choose the right example to start from.

Step 2: Choose Your Starting Point

Pick one of the three tested prompts below for common use cases. If you’re new to this approach, start with Example 1 (Chat Application). Each example includes:
  • When to use this pattern
  • Which platforms we’ve tested on
  • The complete prompt ready to copy
What you’ll get: A chat app with real-time, typewriter-style AI responsesWhen to use this:
  • Want immediate feedback as AI generates responses
  • Need to handle long responses gracefully
  • Want users to see progress in real-time
Key concept: Streaming shows response chunks as they’re generated instead of waiting for the complete response.Tested on: Antigravity, Bolt.new, Claude Code, Codex, Lovable, Replit Agent, v0.devThe Prompt:Copy the entire prompt below into your coding assistant:
The prompt contains all five components:Because each component is separate and specific, the assistant knows exactly what to build, how to structure it, how to authenticate, which APIs to call, and what the UI should look like.

Tips for your coding assistant

Each AI coding assistant has different strengths. Some pointers for getting the best results:
  • Use assistants like ChatGPT to create a detailed project requirements document (PRD) first. Review and split into phases for implementation.
  • Upload screenshots or sketches instead of describing layouts.
  • Stick to the tool’s default stack to avoid friction.
  • Use automatically created checkpoints to revert to a previous version if needed.
  • Iterate in small steps rather than requesting complete rewrites.

Step 3: Generate Your Application

After pasting a prompt into your AI coding assistant:
1

Set up your Gloo AI credentials

  • Enter your Gloo AI credentials if prompted during code generation. This typically applies to coding assistants that generate code online such as Lovable and Replit Agent.
  • Enter your credentials as instructed after code generation. This typically applies to assistants that create code locally such as Claude Code and Codex.
Get your credentials from Gloo AI Studio > API Keys.
2

Enter your publisher and tenant (Example 3 only)

Example 3 (Building AI Overviews) needs two more values before your app will work:These values are used in the recommendations API call.Find these values in Gloo AI Studio:
  1. Navigate to the “Manage Organizations” page.
  2. In your organization’s row, click on “View Publishers”.
  3. Note the publisher name.
  4. The tenant identifier is derived from the publisher name by removing any spaces. For example, if your publisher name is “Faith Matters,” the tenant identifier would be “FaithMatters.”
Enter the two values as environment variables or when prompted by your AI coding assistant.
3

Review the generated code

  • Check that API key authentication is in the backend only
  • Verify environment variables are properly configured
  • Ensure error handling is present for 401, 429, 500 errors
  • Confirm the API key is loaded from environment variables
4

Start the application

Online coding tools will automatically start your app in a Preview tab.For locally generated code:
  • Follow instructions (typically in a README) to install dependencies
  • Start the backend and frontend servers

Step 4: Test Your Application

Once your app is running, check that it’s working well.
Enter a message and ensure the results are streamed in. You should see something like this:
Example 1: Streaming Chat in Action - Lovable

Streaming chat generated with Lovable


Example 1: Streaming Chat in Action - Codex

Streaming chat generated with Codex

Because these coding models are generative, the app UI varies with each run, even with identical prompts. The functionality should still match your specifications.

Iterate if Needed

If something isn’t right, use follow-up prompts:
  • “Add error handling for network timeouts”
  • “Make the UI mobile-responsive”
  • “Add a loading skeleton instead of a spinner”
  • “Change the color scheme to match our brand”

Step 5: Add advanced patterns

For more complex applications, ask your AI coding assistant to implement these patterns, either in your original prompt or in a follow-up prompt.

Pattern 1: API Key Loading

Short version: “Load GLOO_API_KEY from environment variables and reuse it for every request” For why each of these matters, see API Key Security.

Pattern 2: Comprehensive Error Handling

Short version: “Implement comprehensive error handling: no retry for 401; for 429, retry only when error.retryable is true, honoring Retry-After before exponential backoff” To check what the generated code does against Gloo’s retry rules, such as which errors are retryable and how to honor Retry-After, see Error Handling and Retries.

Pattern 3: Client-Side Rate Limiting

Short version: “Implement sliding window rate limiting with 100 requests per hour per user” Practice: Try adding one of these patterns to Example 1 (Chat Application) by appending the instruction to the prompt or using it in a follow-up prompt.

Troubleshooting

Common issues with these examples, and with AI coding assistants in general:
  • Verify the endpoint being used in the code.
  • Provide the coding assistant with links to relevant resources, such as the API reference or related tutorial documentation.
  • Verify the endpoint being used in the code.
  • Verify that the model being used supports tool use.
  • Try the API call directly in the playground.

Give us feedback

We’d love to hear from you:
  • Found a better way to structure a prompt? Share it with us.
  • Generated an innovative application? We’d love to see it.
This is a new way to learn. Please let us know:
  • Which prompts worked best for you?
  • Which AI coding assistant you prefer?
  • What examples you’d like to see added?

Next steps

Congratulations! You learned how to structure effective prompts for AI coding assistants, secure your Gloo AI API calls, and test the results on example use cases.

Tutorials

Review other tutorials where you can work directly with code.

API Reference

Check out the API documentation for complete API reference.

Error Handling and Retries

Check the generated code against Gloo’s retry rules.

API Key Security

Keep your key on the server and out of source control.