PolarDB Supabase enables VibeCoding in AI-native IDEs

Updated at:

PolarDB Supabase provides real-time database metadata context, standard data operation interfaces, and out-of-the-box authentication capabilities for AI-native IDEs such as Qoder, Cursor, or Bolt.diy through the Model Context Protocol (MCP). This enables AI to generate accurate code that matches the backend data structure, significantly improving the development efficiency of full-stack applications.

Use cases

VibeCoding is an AI-driven programming paradigm where developers describe requirements in natural language, and the AI automatically develops, debugs, and deploys the code. VibeCoding significantly lowers the barrier to programming, enabling non-professional developers to build websites and applications through natural language interaction. Although AI can generate polished frontend and backend code, it cannot perceive the actual backend environment of the application, such as database table structures, field names, and relationships. This often leads to factual errors in the generated code, requiring developers to manually review and correct it, which reduces the effectiveness of AI-assisted programming.

As a general-purpose Backend as a Service (BaaS), PolarDB Supabase effectively bridges the gap between the frontend and backend by providing an MCP Server. This gives the AI complete and real-time backend context, creating a more efficient full-stack acceleration paradigm and significantly boosting the AI's performance in integrated full-stack application development.

Solution architecture

This solution uses the Model Context Protocol (MCP) as a bridge connecting PolarDB Supabase, which acts as a Backend as a Service (BaaS), with an AI-native IDE (Qoder as an example).

image

Core components

  • PolarDB Supabase: Provides enterprise-grade backend services, including a PostgreSQL database, authentication, storage, and auto-generated APIs. It serves as the central hub for storing and managing all business data.

  • MCP Server: A middleware service that connects to the PolarDB Supabase database. It securely extracts and exposes database metadata, such as tables, columns, types, and constraints, without exposing any business data.

  • AI-native IDE (Qoder as an example): The developer's workspace. Its integrated AI client connects to the MCP Server, obtains real-time database schema context, and provides it to a large language model (LLM) to guide code generation.

Workflow

  1. A developer gives an instruction in natural language within the AI-native IDE (Qoder as an example), such as "Create a page that displays a task list."

  2. The client in the AI-native IDE (Qoder as an example) sends a request to the MCP Server to query database schema information.

  3. The MCP Server queries the relevant table structures and metadata from the system catalog (information_schema) in PolarDB Supabase. This process works even if the project initially has no tables.

  4. The MCP Server returns the structured schema information to the AI-native IDE (Qoder as an example).

  5. The AI-native IDE (Qoder as an example) submits the developer's instruction and the retrieved schema context to the large language model (LLM).

  6. The large language model (LLM) uses the precise context to generate DDL statements that match the database structure and applies them to the database through Supabase. It also generates frontend and backend interaction code that matches the table structure, such as using the correct table name todos and field names task and is_done.

  7. The generated code is displayed in the IDE for the developer to use or refine.

Procedure

Follow these steps to configure an AI-native development environment and build a test application using natural language.

Step 1: Create a PolarDB Supabase instance

  1. Log on to the PolarDB console, create a Supabase application in your PolarDB cluster, and log on to its console. For detailed steps, see Get started with PolarDB Supabase.

  2. Add the IP address of your business environment to the application whitelist.

  3. After the application is created, click the application ID to go to the application management page and record the following key information:

    • Public endpoint: Obtain it on the Topology tab. For new applications, you must first apply for an address. The format is http://<public IP address>:8000.

    • Key information: Obtain it on the Configuration tab. You need to record the keys secret.jwt.anonKey, secret.jwt.serviceKey, secret.dashboard.username, and secret.dashboard.password.

Step 2: Download and install an AI-native IDE

This topic uses Qoder as an example. Download and install the client for your operating system.

Step 3: Obtain and build the MCP service

  1. Download the PolarDB Supabase MCP Server source code. You can run the following commands in your business environment to clone and build the project.

    Note

    Make sure that your business environment meets the requirements of the PolarDB Supabase MCP Server.

    # 1. Clone the project repository
    git clone https://github.com/ApsaraDB/PolarDB-Supabase-MCP-Server.git
    
    # 2. Go to the project directory
    cd PolarDB-Supabase-MCP-Server
    
    # 3. We recommend using pnpm as the package manager
    npm install -g pnpm
    
    # 4. Install dependencies
    pnpm install
    
    # 5. Build the project
    pnpm build
  2. Record the absolute path of the stdio.js file:

    # After running this command, the stdio.js file should be displayed. Record its absolute path for later configuration.
    ls packages/mcp-server-supabase/dist/transports/

Step 4: Configure the MCP service in the AI-native IDE

This topic uses Qoder on macOS as an example. From the top navigation bar, choose Qoder > Preferences > Qoder Settings > MCP Servers. Click Add to add a new MCP service configuration. Configure the service as shown in the following example, replacing the <...> placeholders with your actual information.

{
    "mcpServers": {
        "polardb-supabase": {
          "command": "node",
          "args": [
            "<Absolute path to the stdio.js file built in Step 3>",
            "--api-url",
            "<Your Supabase public endpoint>",
            "--service-role-key",
            "<Your Supabase secret.jwt.serviceKey>",
            "--anon-key",
            "<Your Supabase secret.jwt.anonKey>",
            "--dashboard-username",
            "<Your Supabase secret.dashboard.username>",
            "--dashboard-password",
            "<Your Supabase secret.dashboard.password>",
            "--project-ref",
            "default"
          ]
        }
    }
}

Example

{
    "mcpServers": {
        "polardb-supabase": {
          "command": "node",
          "args": [
            "/your/path/to/PolarDB-Supabase-MCP-Server/packages/mcp-server-supabase/dist/transports/stdio.js",
            "--api-url",
            "http://8.xxx.xxx.xxx:8080",
            "--service-role-key",
            "eyJ0eXAiOiJKV1QiLCJxxx",
            "--anon-key",
            "eyJ0eXAiOiJKV1QiLCJxxx",
            "--dashboard-username",
            "supabasexxx",
            "--dashboard-password",
            "rMa1rc9rxxx",
            "--project-ref",
            "default"
          ]
        }
    }
}

Step 5: Start full-stack development

After you complete the preceding configuration, you can start developing your application by interacting with the AI-native IDE using natural language. This topic uses Qoder as an example.

  1. Open a new chat window in Qoder.

  2. Enter the first prompt to describe the application that you want to create. The AI generates the complete code, including the frontend and backend logic, and initializes the table structure based on the context provided by the MCP service.

    Example: Help me build a to-do list application using React and Supabase. No login or permission control is required.

  3. Based on the generated result, you can continue to interact with multiple rounds of prompts until all features and requirements meet your expectations.

Example results

  1. Enter the prompt: "Help me build a to-do list application using React and Supabase. No login or permission control is required."

    The following is the core code of the application generated by the AI (excerpt):

    import { useState, useEffect } from 'react'
    import { supabase } from './supabaseClient'
    import './App.css'
    
    function App() {
      const [todos, setTodos] = useState([])
      const [newTask, setNewTask] = useState('')
      const [loading, setLoading] = useState(true)
    
      // Fetch all to-do items
      const fetchTodos = async () => {
        setLoading(true)
        const { data, error } = await supabase
          .from('todos')
          .select('*')
          .order('created_at', { ascending: true })
    
        if (error) {
          console.error('Error fetching todos:', error)
          setTodos([])
        } else {
          setTodos(data || [])
        }
        setLoading(false)
      }
    
      // Add a new to-do item
      const addTodo = async () => {
        if (newTask.trim() === '') return
    
        const { data, error } = await supabase
          .from('todos')
          .insert([{ task: newTask, completed: false }])
          .select()
    
        if (error) {
          console.error('Error adding todo:', error)
        } else {
          setTodos([...todos, data[0]])
          setNewTask('')
        }
      }
    
      // Toggle to-do item completion status
      const toggleTodo = async (id, completed) => {
        const { data, error } = await supabase
          .from('todos')
          .update({ completed: !completed })
          .eq('id', id)
          .select()
    
        if (error) {
          console.error('Error updating todo:', error)
        } else {
  2. Wait for the code and table structure to be automatically generated. After generation is complete, click Preview to view the result.

    After the prompt is executed, the AI assistant automatically performs the following operations:

    1. Create a todos table with the id, task, completed, and created_at fields.

    2. Verify the query functionality.

    3. Update the application code.

    4. Restart the application.

    The application runs successfully in the embedded browser at http://localhost:5174. The page title is To-Do List, which includes a task input box (with the placeholder "Add a new task...") and an Add button. Below, the added to-do items (such as "Test task") are displayed, each with a checkbox and a Delete button.

  3. Log on to the Supabase application to verify the tables and data in the PolarDB cluster.

    The automatically generated Supabase database contains a todos table with the following structure:

    • id (int4, primary key)

    • task (text, task content)

    • completed (bool, completion status)

    • created_at (timestamptz, creation time)

    In the Supabase Table Editor, you can see that the table already contains 3 test task entries, all with the completed status set to FALSE.

Conclusion

This solution integrates PolarDB Supabase with the MCP protocol to build an AI context-aware development workflow. It provides AI programming tools with the precise backend database structure, enabling them to automatically generate accurate, runnable application code and reducing the manual effort required to correct AI-generated code.

Although this guide uses Qoder and React as examples, the architecture is based on the standard MCP protocol and can be extended to other compatible IDEs and development frameworks.

FAQ

Why does the AI-native IDE (Qoder) not automatically create table structures?

Make sure that you have added the IP address of your business environment to the application whitelist.

Does PolarDB Supabase support enabling HTTPS?

PolarDB Supabase applications do not currently support enabling HTTPS directly in the console or through configuration. To enable encrypted access over HTTPS, you must configure SSL certificates at the reverse proxy layer, such as Nginx.

PolarDB SupabaseCan I access tables in non-public schemas through the Data API?

PolarDB Supabase does not currently support configuring the Data API. Therefore, RESTful interfaces cannot be generated for non-public schemas, and calling the RESTful API can only access tables in the default public schema. If you receive a 406 Not Acceptable error when accessing tables in non-public schemas, it is caused by this limitation.

PolarDB SupabaseHow to recover after an OOM (out of memory) hang?

PolarDB Supabase has a built-in automatic recovery mechanism that requires no manual intervention. The recovery time depends on memory release. If the instance specification is small (such as 2 vCPUs), recovery may be slow or fail due to resource constraints. Resolution:

  1. Stop stress tests or high-load operations to accelerate memory release.

  2. Wait for the Supabase application to recover automatically.

  3. We recommend that you upgrade to a larger instance specification to fundamentally avoid OOM issues.