Skip to main content
Forest connects to your databases and external services to expose your data and make it actionable.

How data flows into Forest

Forest loads data through datasources, connections to your databases, APIs, or any system that holds data.
const agent = createAgent(options);

// Connect your primary database
agent.addDataSource(
  createSqlDataSource('postgresql://localhost/mydb')
);

// Add a second datasource (e.g. MongoDB)
agent.addDataSource(
  createMongooseDataSource(mongoConnection)
);

// Forest automatically:
// - Discovers all tables
// - Detects column types
// - Identifies relationships (foreign keys)
// - Creates collections for each table

Forest datasources

Forest loads data through datasources, connections to your databases, APIs, or any system that holds data. For some datasources, Forest performs introspection to discover the schema automatically. For others (like ORM-based connections), the schema is already known from your model definitions. ORM-based connections (Sequelize, Mongoose):
  • Forest reads your ORM model definitions
  • Uses the schemas you’ve already defined in your application code
  • Detects relationships from model associations
  • No database introspection needed - everything comes from your models
Direct database connections (SQL, MongoDB):
  • SQL databases: Forest queries the database metadata (information_schema or system catalogs) to discover tables, columns, data types, constraints, foreign keys, and indexes
  • MongoDB: Forest samples a subset of documents (default: 100 per collection) and analyzes them to infer the schema structure, including nested fields and references
API-based connections (REST, GraphQL): Forest uses the API schema or a custom mapping to expose data. Once introspection is complete, Forest automatically:
  1. Discovers schema - all tables/collections and their structure
  2. Maps data types - converts database types to Forest types
  3. Detects relationships - foreign keys or references become navigable relationships
  4. Creates collections - each table/collection becomes a collection in the UI
  5. Enables CRUD operations - browse, create, edit, delete records

Loading more data: multi-datasources

Connect multiple databases or APIs in the same back-end:
// Primary PostgreSQL database
agent.addDataSource(
  createSqlDataSource('postgresql://localhost/main'),
  { name: 'main' }
);

// MongoDB for analytics
agent.addDataSource(
  createMongooseDataSource(mongoConnection),
  { name: 'analytics' }
);
Looking to enrich a single record?If you want to add computed fields or fetch external data to enrich individual records (not load entire collections), use Smart Fields instead of adding a datasource.Learn how to enrich data with computed fields →
Browse available datasources →