How to load data from Firebase Realtime Database to Postgres destination
Learn how to use Airbyte to synchronize your Firebase Realtime Database data into Postgres destination within minutes.


Building your pipeline or Using Airbyte
Airbyte is the only open source solution empowering data teams to meet all their growing custom business demands in the new AI era.
Building in-house pipelines
- Inconsistent and inaccurate data
- Laborious and expensive
- Brittle and inflexible
After Airbyte
- Reliable and accurate
- Extensible and scalable for all your needs
- Deployed and governed your way
Start syncing with Airbyte in 3 easy steps within 10 minutes



Take a virtual tour
Demo video of Airbyte Cloud
Demo video of AI Connector Builder
Setup Complexities simplified!
Simple & Easy to use Interface
Airbyte is built to get out of your way. Our clean, modern interface walks you through setup, so you can go from zero to sync in minutes—without deep technical expertise.
Guided Tour: Assisting you in building connections
Whether you’re setting up your first connection or managing complex syncs, Airbyte’s UI and documentation help you move with confidence. No guesswork. Just clarity.
Airbyte AI Assistant that will act as your sidekick in building your data pipelines in Minutes
Airbyte’s built-in assistant helps you choose sources, set destinations, and configure syncs quickly. It’s like having a data engineer on call—without the overhead.
What sets Airbyte Apart
Modern GenAI Workflows
Streamline AI workflows with Airbyte: load unstructured data into vector stores like Pinecone, Weaviate, and Milvus. Supports RAG transformations with LangChain chunking and embeddings from OpenAI, Cohere, etc., all in one operation.
Move Large Volumes, Fast
Quickly get up and running with a 5-minute setup that enables both incremental and full refreshes for databases of any size, seamlessly scaling to handle large data volumes. Our optimized architecture overcomes performance bottlenecks, ensuring efficient data synchronization even as your datasets grow from gigabytes to petabytes.
An Extensible Open-Source Standard
More than 1,000 developers contribute to Airbyte’s connectors, different interfaces (UI, API, Terraform Provider, Python Library), and integrations with the rest of the stack. Airbyte’s AI Connector Builder lets you edit or add new connectors in minutes.
Full Control & Security
Airbyte secures your data with cloud-hosted, self-hosted or hybrid deployment options. Single Sign-On (SSO) and Role-Based Access Control (RBAC) ensure only authorized users have access with the right permissions. Airbyte acts as a HIPAA conduit and supports compliance with CCPA, GDPR, and SOC2.
Fully Featured & Integrated
Airbyte automates schema evolution for seamless data flow, and utilizes efficient Change Data Capture (CDC) for real-time updates. Select only the columns you need, and leverage our dbt integration for powerful data transformations.
Enterprise Support with SLAs
Airbyte Self-Managed Enterprise comes with dedicated support and guaranteed service level agreements (SLAs), ensuring that your data movement infrastructure remains reliable and performant, and expert assistance is available when needed.
What our users say

Raman Singh
Predictable, straightforward pricing model that simplified budgeting and significantly reduced overall spend

Chase Zieman

“Airbyte helped us accelerate our progress by years, compared to our competitors. We don’t need to worry about connectors and focus on creating value for our users instead of building infrastructure. That’s priceless. The time and energy saved allows us to disrupt and grow faster.”

Rupak Patel
"With Airbyte, we could just push a few buttons, allow API access, and bring all the data into Google BigQuery. By blending all the different marketing data sources, we can gain valuable insights."
How to Sync to Manually
Step 1: Set Up Your Environment
1. Install Node.js: Ensure you have Node.js installed on your system, as you'll be using it to write a script to transfer the data.
2. Install PostgreSQL: Install PostgreSQL if it’s not already installed on your system or have access to a PostgreSQL server.
3. Access Credentials: Make sure you have the necessary access credentials for both Firebase Realtime Database and your PostgreSQL database.
Step 2: Export Data from Firebase Realtime Database
1. Access Firebase Console: Go to your Firebase project console.
2. Navigate to Realtime Database: Click on the Realtime Database section.
3. Export Data: Click on the three dots (more options) and select "Export JSON". This will download a JSON file containing all the data from your Firebase Realtime Database.
Step 3: Prepare Your PostgreSQL Database
1. Create Database: Log into your PostgreSQL terminal (psql) and create a new database if needed with `CREATE DATABASE your_database_name;`.
2. Design Schema: Based on the structure of the JSON data exported from Firebase, design the schema for your PostgreSQL database.
3. Create Tables: Use `CREATE TABLE` statements to create tables that match the structure of your Firebase data.
Step 4: Write a Script to Migrate Data
1. Initialize a Node.js Project: Create a new directory for your project and run `npm init` to start a new Node.js project.
2. Install Dependencies: Install the necessary Node.js packages by running `npm install firebase-admin pg`.
3. Service Account Key: Go to your Firebase project settings, navigate to the Service Accounts tab, and generate a new private key. Save this file in your project directory.
4. Write the Script:
- Initialize Firebase Admin with the service account key.
- Connect to your PostgreSQL database using the `pg` module.
- Read the exported JSON file into a variable.
- Iterate over the JSON data and construct `INSERT` statements for PostgreSQL.
- Execute the `INSERT` statements using the `pg` module.
Here's a simple example of what the script might look like:
```javascript
const admin = require('firebase-admin');
const { Client } = require('pg');
const fs = require('fs');
// Initialize Firebase Admin
const serviceAccount = require('./path/to/serviceAccountKey.json');
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: 'https://your-database-url.firebaseio.com'
});
// Connect to PostgreSQL
const client = new Client({
connectionString: 'postgres://username:password@localhost:5432/your_database_name'
});
client.connect();
// Read the exported JSON file
const firebaseData = JSON.parse(fs.readFileSync('path/to/exported.json', 'utf8'));
// Function to insert data into PostgreSQL
async function insertData(tableName, data) {
const keys = Object.keys(data[0]);
const values = data.map(obj => `(${keys.map(key => `'${obj[key]}'`).join(', ')})`);
const query = `INSERT INTO ${tableName} (${keys.join(', ')}) VALUES ${values.join(', ')};`;
try {
await client.query(query);
console.log('Data inserted successfully');
} catch (err) {
console.error('Error inserting data', err.stack);
}
}
// Example usage
const tableName = 'your_table_name';
insertData(tableName, firebaseData);
// Close the PostgreSQL connection
client.end();
```
Step 5: Execute the Migration Script
Run your script using Node.js:
```bash
node path/to/your/script.js
```
Step 6: Verify Data Transfer
After running your script, log into your PostgreSQL database and verify that the data has been transferred correctly:
```sql
SELECT * FROM your_table_name;
```
Step 7: Clean Up
Once the data is successfully migrated, you can remove the Firebase service account key file from your project directory if it's no longer needed, and ensure your script does not expose any sensitive information.
Step 8: Backup and Maintenance
Make sure to backup your PostgreSQL database regularly and set up proper maintenance tasks to keep your new database healthy.
Note: The example script provided is very basic and may not handle all use cases, such as data types, nested objects, or arrays. You'll need to modify the script according to your specific data structure and requirements. Always test the migration process with a subset of data before performing the full migration.