Skip to main content
Forest connects to your data through datasources. You can add one or multiple datasources to your project, each representing a database, an API, or any data source you need to manage.

Adding a datasource

Use your back-end’s method to add a datasource:
import { createAgent } from '@forestadmin/agent';
import { createSqlDataSource } from '@forestadmin/datasource-sql';

const agent = createAgent(options);

agent.addDataSource(
  createSqlDataSource('postgresql://user:pass@localhost:5432/mydb')
);
Your data is now surfaced to Forest, allowing you to browse, search, edit, and manage your records.

Adding multiple datasources

You can connect multiple datasources to create a unified back-office across different databases, APIs, or systems:
const agent = createAgent(options);

// Primary PostgreSQL database
agent.addDataSource(
  createSqlDataSource('postgresql://user:pass@localhost:5432/main')
);

// MongoDB for analytics
agent.addDataSource(
  createMongooseDataSource(mongoConnection)
);

// External API
agent.addDataSource(
  createCustomDataSource(apiConfig)
);
All collections from all datasources will appear in your Forest interface, giving you a unified view across your entire data landscape.

Cross-database relationships

You can define relationships between collections from different datasources:
agent.customizeCollection('orders', collection => {
  collection.addManyToOneRelation('user', 'analytics_users', {
    foreignKey: 'user_id'
  });
});
This allows you to navigate between related data even when it lives in different databases or systems. Learn more about relationships →

Available datasources

  • SQL - PostgreSQL, MySQL, MariaDB, SQL Server with automatic schema introspection
  • Sequelize - Connect through your existing Sequelize ORM models
  • Mongoose - MongoDB via Mongoose ODM with schema support
  • Dummy - Generate fake data for testing and prototyping
  • Hubspot - Connect to Hubspot CRM (Contacts, Companies, Deals, Tickets)
  • Elasticsearch - Query Elasticsearch indices
  • Airtable - Connect Airtable bases
  • Stripe - Connect Stripe account data
  • RPC - Connect remote data sources via RPC
  • GraphQL / Hasura - Connect GraphQL APIs or Hasura instances
  • CosmosDB - Connect Azure CosmosDB

Custom datasources

Build custom datasources for proprietary systems, legacy databases, REST APIs, or any data source without an existing connector:
Don’t see the datasource you need? Contact us to request a datasource, and we’ll help you connect it.