Getting Started

This is the official documentation of the @forestadmin/agent Node.js agent.

After doing the quick start, you should have a development project which is up and running and connected to your main data storage system.

However, you can plug as many data sources as you want into the same agent.

What can I connect to?

Forest Admin collections map to any of those concepts:

  • Database collections/tables

  • ORM models

  • Endpoints on SaaS providers (by writing a custom data source)

  • Endpoints on your own API (by writing a custom data source)

Example

In this example, we import tables from a PostgreSQL, MariaDB, and Mongo database into Forest Admin.

const { createAgent } = require('@forestadmin/agent');
const { createSqlDataSource } = require('@forestadmin/datasource-sql');
const { createMongooseDataSource } = require('@forestadmin/datasource-mongoose');

// Plug multiple data sources to a single agent.
const agent = createAgent(options)
  .addDataSource(
    createSqlDataSource('postgres://user:pass@a.server:5432/database_name'),
  )
  .addDataSource(
    createSqlDataSource(
      'mariadb://user:pass@another.server:5432/other_database_name',
    ),
  )
  .addDataSource(createMongooseDataSource(require('./mongoose-models')));

Last updated