Node.js Developer Guide
Other documentationsDemoCommunityGitHub
  • Forest Admin
  • Getting started
    • How it works
    • Quick start
    • Install
      • Create your agent
      • Expose an HTTP endpoint
        • For standalone agents
        • On Express
        • On Koa
        • On Fastify
        • On NestJS
      • Autocompletion & Typings
      • Troubleshooting
    • Migrating legacy agents
      • What's new
      • Pre-requisites
      • Recommendations
      • Migration steps
        • Run new agent in parallel
        • Configure database connection
        • Code transformations
          • API Charts
          • Live Queries
          • Smart Charts
          • Route overrides
          • Smart Actions
          • Smart Fields
          • Smart Relationships
          • Smart Segments
        • Compare schemas
        • Swap agents
      • Post-migration
        • Dropping Sequelize
        • Optimize your agent
  • Data Sources
    • Getting Started
      • Collection selection
      • Naming conflicts
      • Cross-data source relationships
      • Query interface and Native Queries
        • Fields and projections
        • Filters
        • Aggregations
    • Provided data sources
      • SQL (without ORM)
      • Sequelize
      • Mongoose
      • MongoDB
    • Write your own
      • Replication strategy
        • Persistent cache
        • Updating the replica
          • Scheduled rebuilds
          • Change polling
          • Push & Webhooks
        • Schema & References
        • Write handlers
      • Translation strategy
        • Structure declaration
        • Capabilities declaration
        • Read implementation
        • Write implementation
        • Intra-data source Relationships
      • Contribute
  • Agent customization
    • Getting Started
    • Actions
      • Scope and context
      • Result builder
      • Static Forms
      • Widgets in Forms
      • Dynamic Forms
      • Form layout customization
      • Related data invalidation
    • Charts
      • Value
      • Objective
      • Percentage
      • Distribution
      • Leaderboard
      • Time-based
    • Fields
      • Add fields
      • Move, rename and remove fields
      • Override binary field mode
      • Override writing behavior
      • Override filtering behavior
      • Override sorting behavior
      • Validation
    • Hooks
      • Collection hook
      • Collection override
    • Pagination
    • Plugins
      • Provided plugins
        • AWS S3
        • Advanced Export
        • Flattener
      • Write your own
    • Relationships
      • To a single record
      • To multiple records
      • Computed foreign keys
      • Under the hood
    • Search
    • Segments
  • Frontend customization
    • Smart Charts
      • Create a table chart
      • Create a bar chart
      • Create a cohort chart
      • Create a density map
    • Smart Views
      • Create a Map view
      • Create a Calendar view
      • Create a Shipping view
      • Create a Gallery view
      • Create a custom tinder-like validation view
      • Create a custom moderation view
  • Deploying to production
    • Environments
      • Deploy on AWS
      • Deploy on Heroku
      • Deploy on GCP
      • Deploy on Ubuntu
      • Deploy on Azure
    • Development workflow
    • Using branches
    • Deploying your changes
    • Forest Admin CLI commands
      • init
      • login
      • branch
      • switch
      • set-origin
      • push
      • environments:create
      • environments:reset
      • deploy
  • Under the hood
    • .forestadmin-schema.json
    • Data Model
      • Typing
      • Relationships
    • Security & Privacy
Powered by GitBook
On this page
  • Introduction
  • Quick Start
  • Requirements
  • Create an account and follow the onboarding
  • Create a new JavaScript (Or TypeScript) project
  • Add a data source

Was this helpful?

  1. Getting started

Quick start

PreviousHow it worksNextInstall

Last updated 3 months ago

Was this helpful?

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

Let's get you up and running on Forest Admin in minutes!

Introduction

Forest Admin is a low-code internal tool solution that scales with your project. With 30+ out-of-the-box tools and pre-built UI components, you can ship an admin panel in a few minutes, and then easily customize it to meet your specific business logic. Thanks to the layout editor, non-technical team members can adjust the UI to their needs.

Forest Admin has a unique hybrid architecture - only the frontend is managed on Forest Admin servers, which gives you the flexibility of a SaaS tool without compromising on data security.

Quick Start

Forest Admin offers a lot of flexibility in terms of installation. The following guide provides a way to start using Forest Admin in minutes. If you want to dive deeper into the installation process of the product, we got you covered .

This guide will help you to set up Forest Admin as a standalone process, using an example Postgres database.

Requirements

  • Node.js >= 18.x

  • NPM > 6.14.4 or yarn > 1.22.17

  • If you want to use our example database, make sure Docker is installed and running

Create an account and follow the onboarding

Go to , and create an account and a new project.

Create a new JavaScript (Or TypeScript) project

Let's create a new folder and initiate a new JavaScript project.

mkdir ForestExample && cd ForestExample
yarn init

Once everything is ready, install the following dependencies.

yarn add @forestadmin/agent dotenv

Create an index.js and a .env file.

require('dotenv').config();

// Import the requirements
const { createAgent } = require('@forestadmin/agent');

// Create your Forest Admin agent
await createAgent({
  // These process.env variables should be provided in the onboarding
  authSecret: process.env.FOREST_AUTH_SECRET,
  envSecret: process.env.FOREST_ENV_SECRET,
  isProduction: process.env.NODE_ENV === 'production',
})
  .mountOnStandaloneServer(3000)
  .start();
FOREST_AUTH_SECRET=<This is provided during the onboarding steps>
FOREST_ENV_SECRET=<This is provided during the onboarding steps>
NODE_ENV=development

Running

node index.js

should be enough to be redirected to the "rate-install" page. However, Forest Admin currently doesn't have any collections to display.

Add a data source

If you want to test Forest Admin but don't have a database on hand, here is one!

docker run -p 5432:5432 --name forest_demo_database forestadmin/meals-database

The associated connection string will be postgres://lumber:secret@localhost:5432/meals.

To install the SQL data source package, you can run the following command

yarn add @forestadmin/datasource-sql

If you run on the example database provided above, simply add the following in your index.js and .env

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

  //...
  .addDataSource(createSqlDataSource(process.env.DATABASE_URL))
  .mountOnStandaloneServer(3000)
  // ...
DATABASE_URL=postgres://lumber:secret@localhost:5432/meals

If you try to run the code as is, you'll be prompted to install the pg driver manually. After doing:

yarn add pg
node index.js

You should be able to see the following log in your terminal:

info: Schema was updated, sending new version

And refreshing the Forest Admin app should display the following screen:

Click on the "eye" icons of the collections you want to display, then exit the layout editor and ...

You're all set!

At the end of your onboarding, you will out-of-the-box be able to:

  • Access all your data (1)

  • Export your data (2)

  • Add a record (3)

  • View and edit a record (4)

  • Edit your UI (5)

  • Search and filter (6)

Now that you are fully onboarded, the only missing part is to add a data source. Forest Admin provides a way to , but for this example, we will add a .

here
https://app.forestadmin.com/signup ↗
create your own
SQL data source