Author: Joshua de Guzman
Date: August 2, 2025
What is Firebase Studio?

Firebase Studio is Google's cloud-based development environment that combines:
- AI-powered prototyping with natural language prompts
- Integrated Firebase services (Auth, Firestore, Hosting)
- Gemini AI assistance for coding and debugging
- Zero setup - everything runs in your browser
What You'll Build
Mindfully, a mindful journaling app** that:
- Uses Next.js for the frontend and backend
- Stores journal entries in Cloud Firestore
- Generates therapeutic advice using Gemini AI
- Deploys live with Firebase App Hosting
Running locally within Firebase Studio:

Deployed to Firebase App Hosting:

Why This Stack?
- Next.js: Full-stack React framework with server-side rendering
- Firebase: Backend-as-a-Service with real-time database
- Gemini AI: Advanced AI for generating therapeutic content
- Firebase Studio: Unified development environment with AI assistance
Key Benefits
- Rapid prototyping with AI-powered "vibe coding"
- No local setup - everything in the cloud
- Production-ready deployment pipeline
- AI integration from day one
Prerequisites
- Google Account (for Firebase Studio and Console access)
- Basic web development knowledge (HTML, CSS, JavaScript)
- No local setup required - everything runs in the browser
What You'll Learn
- Firebase Studio navigation and AI-assisted development
- Rapid prototyping with natural language prompts
- Firebase integration (Firestore)
- Gemini AI integration for therapeutic content generation
- Deployment with Firebase App Hosting
Firebase Studio Features
Feature
| What It Does
| Why It's Great
|
AI Prototyping
| Generate apps from natural language
| No coding required to start
|
Gemini Assistant
| AI-powered coding help
| Get help with any development task
|
Firebase Integration
| Built-in backend services
| No server setup needed
|
Cloud IDE
| Full development environment
| Work from anywhere, no local setup
|
One-Click Deploy
| Instant production deployment
| Get your app live in minutes
|
The first step in building the mindful journaling app involves setting up the development environment. This process is designed to be straightforward, allowing developers to quickly access Firebase Studio and begin development.
Accessing Firebase Studio
- Open a web browser and navigate to the Firebase Studio dashboard at studio.firebase.google.com
- Sign in with a Google Account if prompted
This is what you should see after signing in and agreeing to the terms of service.

To empower the mindful journaling app with therapeutic advice capabilities, you'll need a Gemini API key. This step covers how to obtain and secure your API key for AI integration.
Getting Your Gemini API Key

- Navigate to Google AI Studio: Open a new browser tab and go to https://ai.google.dev/
- Sign in: Make sure you're signed in with your Google account
- Access API Keys:
- Look for the "Get API key" button in the top navigation bar
- Or click on your profile picture/account menu and select "API keys"
- Create a New API Key:
- Click "Create API key" or "Create new API key"
- If prompted, select an existing Google Cloud project or create a new one
- Give your API key a descriptive name (e.g., "Mindful Journal App")
- Copy Your API Key:
- Once generated, you'll see a string of characters (e.g.,
AIzaSyC...)
- Copy this key immediately - you won't be able to see it again
- Store it securely for use in the next steps
Important Security Note: Treat this API key like a password. Never hardcode it directly into your application's source code, especially for client-side applications. We'll use environment variables and secure proxy services to keep it safe.
Firebase Studio's App Prototyping agent, often referred to as "Prototyper," introduces a revolutionary way to build user interfaces through "vibe coding." This approach allows developers to translate natural language descriptions directly into foundational UI code, significantly accelerating the initial design phase and enabling rapid iteration without extensive manual coding.
Creating a New Project in Firebase Studio
- Navigate to Firebase Studio: Open a web browser and go to studio.firebase.google.com
- Sign in: Use your Google account to sign in
- Start a New Project:
- Click "Start coding an app" or "Create new project"
- Choose Next.js as your framework
- Give your project a name (e.g., "mindful-journal-app")
- Click Create to initialize the workspace
- Access the Prototyper:
- Once the workspace loads, look for the "Prototype an app with AI" section
- This is where you'll enter your app description
Understanding Effective Prompt Engineering
The effectiveness of the generated application depends on how clearly you describe what you want. Here are key guidelines:
- Be Specific: Describe exact UI elements you want (e.g., "header with title", "form with input fields")
- Include Functionality: Mention features like database storage, AI integration
- Specify Technology: Always mention "Next.js" and "Firebase" in your prompt
- Provide Context: Explain the app's purpose and target users
Generating Your App with AI
- Enter Your Prompt: In the "Prototype an app with AI" field, enter this detailed description:
Create a Next.js web application for a mindful journaling app.
I want a clean, minimalist design.
Include a simple header with the title "Mindful Journal".
Below the header, create a main content area.
Inside the main content area, add a form with:
- A text input field for "Title" of the entry.
- A multi-line text input field for "Journal Entry" content.
- A button labeled "Save Entry".
Below the form, display a list of journal entries, with each entry showing its title and a snippet of its content.
Ensure the layout is responsive for web.
Use Cloud Firestore to store journal entries.
Add a feature to generate therapeutic advice based on the journal entry content using Google Gemini AI with the latest stable model gemini-2.0-flash-001.
- Generate the App:
- Click "Prototype with AI"
- Review the generated blueprint
- Click "Prototype this app"

- What Happens Next:
- Firebase Studio will automatically create a Firebase project
- Generate a Gemini API key if needed
- Set up the Next.js project structure
- Create the initial UI components
- Configure basic Firebase integration
The Prototyper will handle most of the setup automatically, including Firebase project creation and API key generation. This saves significant time compared to manual configuration.
Reviewing the Generated Project
Once generation is complete, Firebase Studio will:
- Open the new Next.js project in the code editor
- Show the project structure (typically
app/ directory for routes)
- Display the generated UI in the preview panel
- Automatically configure Firebase services
The generated code follows Next.js App Router conventions with clear separation between client and server components.
Exploring Your Generated Code
While the App Prototyper handles most of the development for this workshop, you can explore the generated Next.js code:
- Switch to Code View: Click the code view icon in Firebase Studio to see the actual Next.js files
- Browse Project Structure: Explore the
app/ directory to see your components, pages, and configuration
- Understand the Code: See how the AI translated your natural language description into actual React/Next.js code
- Return to Prototyper: Click back to the Prototyper view to continue with AI-assisted development
Workshop Focus: For this workshop, we'll primarily use the App Prototyper Agent for development. The code view is great for understanding what's being generated, but we'll focus on the AI-powered workflow for building features.
Now that you have your Gemini API key and have prototyped your app, let's integrate AI capabilities into your application using the App Prototyper. This approach leverages Firebase Studio's AI-powered development to automatically generate the AI integration code.
Using the App Prototyper for AI Integration
Instead of manually writing code, we'll use the App Prototyper to generate the AI integration. This approach is more consistent with Firebase Studio's philosophy of AI-assisted development.
Adding AI Features with Natural Language
- Access the Prototyper: In your Firebase Studio workspace, locate the App Prototyper chat interface
- Enter AI Integration Prompt: Use the following prompt to add AI capabilities:
Add AI-powered therapeutic advice to my mindful journaling app.
When a user saves a journal entry, automatically generate therapeutic advice using Gemini AI with the latest stable model gemini-2.0-flash-001.
The advice should:
- Analyze the emotional content of the journal entry
- Provide empathetic and supportive responses
- Offer simple mindfulness exercises or coping strategies
- Maintain a positive and encouraging tone
- Be displayed below the journal entry form
Include proper error handling and loading states.
Use environment variables for the Gemini API key.
- Review Generated Code: The Prototyper will:
- Create API routes for AI integration
- Set up the Gemini AI client
- Generate the therapeutic advice component
- Add proper error handling and loading states
- Configure environment variables
- Test the AI Feature:
- Enter a journal entry
- Click save to trigger the AI advice generation
- Verify the therapeutic advice appears below the form
Understanding the Generated AI Integration
The App Prototyper will generate code that:
- Creates API Routes: Server-side endpoints for AI processing
- Sets Up Gemini Client: Configures the AI model with your API key
- Implements Prompt Engineering: Uses carefully crafted prompts for therapeutic advice
- Handles Errors: Provides graceful error handling for AI failures
- Manages Loading States: Shows appropriate feedback during AI processing
(Optional) Customizing the AI Behavior
You can further customize the AI integration by asking the Prototyper:
Make the AI advice more specific to different emotions.
Add different types of advice based on whether the entry is positive, negative, or neutral.
Include breathing exercises for stress and gratitude practices for positive entries.
Ethical Considerations and Disclaimers
It is paramount to include a disclaimer within the application that the AI-generated advice is for informational and supportive purposes only and should not be considered professional medical, psychological, or therapeutic advice. This ensures users understand the limitations of the AI and seek professional help when necessary.
The App Prototyper approach eliminates the need to manually write complex AI integration code, making it accessible to developers of all skill levels while ensuring best practices are followed.
Exploring More AI Capabilities with Google AI Studio
Now that you've integrated Gemini AI into your Firebase Studio project, you might be interested in exploring more advanced AI capabilities. Google AI Studio offers a collection of starter apps that showcase Gemini's core features and provide ready-to-use templates for various AI-powered applications.
Available Starter Apps
Based on the latest Google AI Studio starter apps, you can explore:
- Spatial Understanding App:
- Build applications with sophisticated visual AI
- Analyze images with advanced 2D and 3D bounding box capabilities
- Perfect for robotics, augmented reality, and image-based search applications
- Video Analyzer App:
- Create interactive video experiences
- Extract data from video streams for summarization and scene description
- Build custom video search tools and automated content tagging systems
- Map Explorer App:
- Combine Gemini's intelligence with Google Maps API
- Create location-aware applications with conversational discovery
- Build travel planning tools and intelligent recommendation systems
(Optional) Getting Started with Starter Apps
- Access Google AI Studio: Visit ai.google.dev to explore these starter apps
- Clone from GitHub: All starter apps are open-sourced and available on GitHub
- Customize and Extend: Use these as foundations for your own AI-powered projects
- Rapid Prototyping: Leverage the apps for quick experimentation and proof-of-concepts
These starter apps demonstrate the full potential of Gemini AI and can inspire your next AI-powered application development.
Now that you have AI capabilities integrated, let's create a new Firebase project and manually set up Firestore. This step focuses on project creation and basic database provisioning.

Creating Firebase Project with App Prototyper
We'll use the App Prototyper to create the Firebase project, then manually provision the Firestore database.
- Access the Prototyper: In your Firebase Studio workspace, locate the App Prototyper chat interface
- Enter Firebase Project Prompt: Use the following prompt to create a new Firebase project:
Create a new Firebase project for my mindful journaling app.
Set up the project with:
- A new Firebase project ID
- Firebase configuration for Next.js
- Environment variables setup
- Basic project structure
Make sure the project is properly connected to my app.
- Review Generated Project: The Prototyper will:
- Create a new Firebase project with a unique ID
- Generate Firebase configuration files
- Create environment variable setup
- Set up basic project structure
- Verify Project Creation:
- Check that the Firebase project was created successfully
- Verify the project ID is accessible
- Confirm Firebase configuration is properly set up

Manually Provisioning Firestore Database
Since automated Firestore provisioning requires Firebase MCP (covered in the optional step), we'll manually set up the database:
- Access Firebase Console:
- Click on your project name in the top-left corner of Firebase Studio
- This will open the Firebase Console in a new tab

- Enable Firestore Database:
- In the Firebase Console, click Build in the left sidebar
- Select Firestore Database
- Click Create database
- Configure Database Settings:
- Choose Start in test mode for development
- Select a location for your database (choose the closest to your users)
- Click Enable

- Verify Database Setup:
- Confirm the database is created successfully
- Note the database URL and project ID
- Check that the database is accessible

Understanding the Firebase Setup
This setup provides:
- Firebase Project: A new project with proper configuration
- Firestore Database: NoSQL database in test mode for development
- Basic Configuration: Firebase SDK setup and environment variables
- Manual Control: Direct oversight of database provisioning
Next Steps
After completing this step, you can:
- Use Firebase MCP (optional step) for enhanced automation
- Deploy your application (final step)
- Customize security rules and database structure as needed
This manual approach gives you direct control over the database setup while leveraging the App Prototyper for project creation and configuration.
The Firebase MCP (Model Context Protocol) server extends the capabilities of the App Prototyper agent by providing tools that can set up, manage, and pull data from Firebase services. This optional step shows you how to enable Firebase MCP for enhanced Firebase integration.
What is Firebase MCP?
Firebase MCP is a server that provides the App Prototyper agent with direct access to Firebase tools and services. It allows the agent to:
- Initialize Firebase services automatically
- Manage Firestore databases
- Deploy security rules
- Query and manage data
- Handle Firebase configuration
Setting Up Firebase MCP
- Switch to Code View: In Firebase Studio, click the code view icon to open the Code view
- Sign in to Firebase: In the terminal (
Shift+Ctrl+C), run:
firebase login --no-localhost
Follow the on-screen instructions and leave all default options
- Create MCP Configuration:
- From the Explorer (
Ctrl+Shift+E), right-click the .idx folder
- Select New file and name it
mcp.json
- Press Enter to create the file
- Add Server Configuration: Add the following configuration to
.idx/mcp.json:{
"mcpServers": {
"firebase": {
"command": "npx",
"args": ["-y", "firebase-tools@latest", "experimental:mcp"]
}
}
}
- Verify Connection: You should see log entries in the Output panel with "Gemini" selected as the right channel, indicating successful connection to the Firebase MCP Server
Using Firebase MCP with Firestore
Once Firebase MCP is set up, you can use enhanced prompts with the App Prototyper:
- Switch to Prototyper: Return to the App Prototyper chat interface
- Use Enhanced Firestore Commands: Try prompts like:
Use Firestore for user entries. Give anyone read and write access.
- Query Your Database: You can also chat with Firestore directly:
List my Firestore collections.
Benefits of Firebase MCP
- Automatic Service Setup: MCP can initialize Firestore and other Firebase services automatically
- Direct Database Access: Query and manage your Firestore data through natural language
- Enhanced Integration: Better coordination between the App Prototyper and Firebase services
- Streamlined Workflow: Reduce manual configuration steps
Note: Firebase MCP is in Preview, which means it's not subject to any SLA or deprecation policy and could change in backwards-incompatible ways.
Now that you have Firebase MCP set up and your Firestore database configured, let's implement the functionality to save journal entries to your Firestore database. This step will show you how to use the App Prototyper to generate the code for persisting journal entries.

Using the App Prototyper for Firestore Integration
With Firebase MCP enabled, the App Prototyper can now directly interact with your Firestore database. This makes it much easier to implement data persistence without manual coding.
Adding Firestore Save Functionality
- Access the Prototyper: In your Firebase Studio workspace, locate the App Prototyper chat interface
- Enter Firestore Integration Prompt: Use the following prompt to add Firestore save functionality:
Add Firestore integration to save journal entries to the database.
When a user submits the journal entry form:
- Save the entry to a "journals" collection in Firestore
- Include the title, content, timestamp, and AI-generated advice
- Show a success message when the entry is saved
- Display all saved entries below the form
- Add proper error handling for database operations
- Include loading states during save operations
Make sure the entries are displayed in reverse chronological order (newest first).
- Review Generated Code: The Prototyper will:
- Create Firestore client configuration
- Generate functions for saving entries to the database
- Create components for displaying saved entries
- Add proper error handling and loading states
- Implement real-time updates for new entries
- Test the Firestore Integration:
- Enter a journal entry with title and content
- Click save to store it in Firestore
- Verify the entry appears in the list below
- Check that the AI advice is also saved with the entry
Understanding the Generated Firestore Code
The App Prototyper will generate code that:
- Configures Firestore Client: Sets up the Firebase SDK for database access
- Creates Save Functions: Handles the actual saving of entries to Firestore
- Implements Real-time Updates: Automatically updates the UI when new entries are added
- Manages Data Structure: Organizes entries with proper timestamps and metadata
- Handles Errors: Provides graceful error handling for database failures
Customizing the Data Structure
You can further customize how data is stored by asking the Prototyper:
Modify the journal entry structure to include:
- User ID for future authentication
- Tags or categories for entries
- Mood indicators
- Word count for analytics
Add a search function to filter entries by title or content.
Verifying Data in Firebase Console
- Open Firebase Console: Click on your project name in Firebase Studio to open the console
- Navigate to Firestore: In the left sidebar, click Build → Firestore Database
- View Your Data: You should see a
journals collection with your saved entries
- Check Entry Structure: Each entry should contain:
title: The journal entry title
content: The full journal entry text
timestamp: When the entry was created
aiAdvice: The generated therapeutic advice
id: Unique document ID
Testing Data Persistence
- Create Multiple Entries: Add several journal entries to test the save functionality
- Refresh the Page: Verify that entries persist after page refresh
- Check Real-time Updates: Open the app in multiple tabs to see real-time synchronization
- Test Error Scenarios: Try saving entries with network issues to test error handling
Security Considerations
The current setup uses Firestore in test mode, which allows read/write access to anyone. For production:
- Set up Authentication: Add user authentication to restrict access
- Configure Security Rules: Implement proper Firestore security rules
- Validate Data: Add client-side and server-side validation
- Rate Limiting: Implement rate limiting to prevent abuse
With Firebase MCP enabled, the App Prototyper can now directly manage your Firestore database, making it much easier to implement complex data operations without manual coding.
The final step is to deploy your mindful journaling app and make it accessible to users. Before deploying, we need to ensure proper billing setup, then Firebase Studio provides a simple way to publish your application directly from the development environment.
Setting Up Billing for Your Firebase Project
Before deploying, you need to set up billing for your Firebase project to ensure all services work properly:
- Access Firebase Console:
- Click on your project name in the top-left corner of Firebase Studio
- This will open the Firebase Console in a new tab
- Navigate to Billing:
- In the Firebase Console, click the gear icon (⚙️) next to "Project Overview"
- Select Project settings
- Click on the Billing tab
- Set Up Billing Account:
- If you don't have a billing account, click "Link a billing account"
- Choose to create a new billing account or link an existing one
- Fill in your billing information (credit card required)
- Click "Set account" to complete the setup
- Verify Billing Status:
- Ensure your billing account is properly linked
- Check that the status shows as "Active"
- Note that Firebase has a generous free tier that should cover most development needs
Important: Firebase requires billing setup even for free tier usage. This is for verification purposes and to handle any usage that exceeds the free tier limits.
Publishing Your Project with the App Prototyper Agent
- Prepare Your App: Ensure your app is working correctly in the preview panel
- Access the App Prototyper:
- In your Firebase Studio workspace, locate the App Prototyper chat interface
- This is the same AI assistant you've been using throughout the development process
- Publish your app:
- In the upper right corner of the screen, click the Publish button
- The publishing process in Firebase Studio follows these steps:
- Create Billing Account (if not already set up)
- Link Google Cloud Billing Account

- Use Google Cloud Billing Account

- Enable Firebase Services:

- Publish Your App:

Testing Your Live Application

- Open Your Live App: Visit the provided hosting URL
- Test Core Functionality:
- Create new journal entries
- Verify AI-generated therapeutic advice
- Check that data is saved correctly
- Ensure responsive design works
- Monitor Performance: Check that your app loads quickly and functions smoothly
Deployment Options
The App Prototyper Agent automatically handles:
- Firebase Hosting: Simple, fast hosting for web applications
- Automatic Configuration: All deployment settings are configured automatically
- Live URL Generation: Your app gets a live URL immediately after deployment
- Zero Configuration: No need to manually set up hosting, domains, or deployment settings
Understanding Firebase Pricing
Firebase offers a generous free tier that includes:
- Firestore: 1GB storage, 50,000 reads/day, 20,000 writes/day
- Firebase Hosting: 10GB storage, 360MB/day transfer
- Gemini AI: Free tier with reasonable usage limits
For most personal projects and small applications, the free tier should be sufficient.
Note: The App Prototyper Agent simplifies deployment to just a few button clicks, making it accessible to developers of all skill levels.
Congratulations! You've successfully built a full-stack AI-powered mindful journaling application using Firebase Studio. This codelab demonstrated how Firebase Studio's AI-powered development environment can accelerate the entire development process, from initial prototyping to deployment.
What You've Accomplished
- Rapid Prototyping: Used natural language prompts to generate your app's UI
- AI Integration: Added Gemini AI for therapeutic advice generation
- Backend Setup: Created Firebase projects and Firestore databases
- Production Deployment: Published your app for users to access
Firebase Studio for Production Apps
Firebase Studio is designed for building production-ready applications. While some features may still be in preview, the core functionality provides a solid foundation for:
- Full-stack web applications with Next.js
- AI-powered features using Gemini
- Scalable backends with Firebase services
- Professional deployment with Firebase hosting
Keep Learning
Firebase Studio continues to evolve with new features and capabilities. Stay updated with the latest developments and explore advanced features like Firebase MCP for enhanced automation.
Connect & Support
Follow me for more tutorials and updates:
Need help or have questions? Email: hi@joshuamdeguzman.com
Happy coding! 🚀