Connect Bubble to external databases like MySQL, PostgreSQL, Airtable, or Supabase via the API Connector plugin. Configure REST API calls to perform CRUD operations against the external database's API endpoints. Use external databases when you need advanced SQL queries, larger data volumes, or shared data across multiple applications while keeping Bubble as the frontend.
Connect to External Databases from Bubble
This tutorial shows how to connect your Bubble app to external databases when Bubble's built-in database is not sufficient — for SQL queries, large datasets, or multi-app data sharing.
Prerequisites
- A Bubble account with the API Connector plugin
- An external database with a REST API (Supabase, Airtable, Xano, etc.)
- API credentials for your external database
- Basic understanding of REST APIs
Step-by-step guide
Choose Your External Database
Choose Your External Database
Common options: Supabase (PostgreSQL with REST API), Airtable (spreadsheet-like), Xano (no-code backend), or a custom API server. Each provides REST endpoints for CRUD operations. Supabase is popular because it offers a full PostgreSQL database with auto-generated REST API and good free tier.
Expected result: You have selected an external database service and have access to its API.
Configure the API Connector
Configure the API Connector
In Bubble, go to Plugins → API Connector → Add another API. Name it after your database (e.g., 'Supabase API'). Set authentication: for Supabase, use 'Private key in header' with key 'apikey' and your Supabase anon key. Add another header 'Authorization: Bearer [anon_key]'. For Airtable, use 'Private key in header' with 'Authorization: Bearer [api_key]'.
Expected result: API Connector is configured with proper authentication.
Create Read (GET) Calls
Create Read (GET) Calls
Add a GET call named 'Get Records'. URL: your database's REST endpoint (e.g., https://[project].supabase.co/rest/v1/[table]?select=*). Set 'Use as' to Data. Click Initialize with sample data. Bubble maps the JSON response fields. Use this in Repeating Groups as 'Get data from an external API'.
Expected result: You can read external database records in Bubble elements.
Create Write (POST/PATCH/DELETE) Calls
Create Write (POST/PATCH/DELETE) Calls
Add POST, PATCH, and DELETE calls for create, update, and delete operations. POST: URL + body with field values. PATCH: URL + record ID + updated fields. DELETE: URL + record ID. Set 'Use as' to Action for all write operations. Use these in workflows triggered by form submissions or button clicks.
Expected result: You can create, update, and delete records in the external database from Bubble.
Handle Pagination and Filtering
Handle Pagination and Filtering
External APIs often paginate responses. Add query parameters for pagination (limit, offset) and filtering (where clauses). For Supabase: ?select=*&limit=20&offset=0&name=eq.value. Make these dynamic parameters in the API Connector so Bubble can pass filter values from the UI.
Expected result: You can fetch filtered and paginated data from the external database.
Complete working example
1{2 "api_name": "Supabase API",3 "authentication": {4 "type": "Private key in header",5 "headers": [6 {"key": "apikey", "value": "YOUR_SUPABASE_ANON_KEY", "private": true},7 {"key": "Authorization", "value": "Bearer YOUR_SUPABASE_ANON_KEY", "private": true}8 ]9 },10 "calls": [11 {12 "name": "Get Products",13 "method": "GET",14 "url": "https://YOUR_PROJECT.supabase.co/rest/v1/products?select=*&order=created_at.desc&limit=[limit]&offset=[offset]",15 "use_as": "Data"16 },17 {18 "name": "Create Product",19 "method": "POST",20 "url": "https://YOUR_PROJECT.supabase.co/rest/v1/products",21 "use_as": "Action",22 "headers": [{"key": "Content-Type", "value": "application/json"}],23 "body": "{\"name\": \"<name>\", \"price\": <price>}"24 },25 {26 "name": "Update Product",27 "method": "PATCH",28 "url": "https://YOUR_PROJECT.supabase.co/rest/v1/products?id=eq.[product_id]",29 "use_as": "Action"30 },31 {32 "name": "Delete Product",33 "method": "DELETE",34 "url": "https://YOUR_PROJECT.supabase.co/rest/v1/products?id=eq.[product_id]",35 "use_as": "Action"36 }37 ]38}Common mistakes when connecting Bubble to an external database
Why it's a problem: Exposing API keys in client-safe parameters
How to avoid: Always mark API keys and auth tokens as 'Private' in the API Connector.
Why it's a problem: Not handling API latency
How to avoid: Minimize API calls per page, cache frequently accessed data in Bubble's database, and use loading indicators.
Why it's a problem: Not handling API errors gracefully
How to avoid: Enable 'Include errors in response' and add error handling logic in your workflows.
Best practices
- Mark all API credentials as Private in the API Connector.
- Cache frequently accessed external data in Bubble's database to reduce API calls.
- Handle pagination for large datasets — never assume all data fits in one response.
- Add error handling for API timeouts and rate limits.
- Use the external database for heavy queries and Bubble's database for user-facing data.
- Test all API calls in Postman before configuring in Bubble.
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
I want to connect my Bubble.io app to a Supabase PostgreSQL database. I need to read products, create new ones, update prices, and delete records. How do I set up the API Connector with Supabase's REST API?
Connect to my Supabase database via API Connector. Set up GET, POST, PATCH, and DELETE calls for the products table with proper authentication headers.
Frequently asked questions
When should I use an external database instead of Bubble's built-in one?
Use external databases when you need SQL queries, handle millions of records, share data across multiple apps, need specific database features (full-text search, vector storage), or require more control over performance.
Does using an external database increase latency?
Yes. Each API call adds 100-500ms of latency compared to Bubble's native database. Cache critical data in Bubble's DB to mitigate this.
Can I use both Bubble's database and an external one?
Yes. Many apps use a hybrid approach: Bubble's DB for user data and app state, external DB for large datasets or shared data.
Which external database works best with Bubble?
Supabase and Xano are the most popular choices. Supabase offers PostgreSQL with a generous free tier. Xano provides a no-code backend builder. Both have clean REST APIs.
How do I handle real-time updates from an external database?
Set up webhooks from your external database to trigger Bubble backend workflows when data changes. This keeps Bubble in sync without polling.
Is it complex to maintain an external database connection?
It adds complexity compared to Bubble's built-in database. For complex integrations, RapidDev can help architect and maintain external database connections.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation