# Quick start

{% hint style="success" %}
This is the official documentation of the `@forestadmin/agent` Node.js agent.
{% endhint %}

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 [here](https://docs.forestadmin.com/developer-guide-agents-nodejs/getting-started/install).

{% hint style="info" %}
This guide will help you to set up Forest Admin as a standalone process, using an example Postgres database.
{% endhint %}

### 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 <https://app.forestadmin.com/signup>, 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.

```bash
mkdir ForestExample && cd ForestExample
yarn init
```

Once everything is ready, install the following dependencies.

```bash
yarn add @forestadmin/agent dotenv
```

Create an `index.js` and a `.env` file.

{% tabs %}
{% tab title="index.js" %}

```javascript
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();
```

{% endtab %}

{% tab title=".env" %}

```bash
FOREST_AUTH_SECRET=<This is provided during the onboarding steps>
FOREST_ENV_SECRET=<This is provided during the onboarding steps>
NODE_ENV=development
```

{% endtab %}
{% endtabs %}

Running

```bash
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.

![](https://3861847666-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UN5oBJhgzLadOqi7jx6%2Fuploads%2Fgit-blob-c8673b7f7104e3767ebad4721cf1ced762db6590%2Fquickstart-no-collections.png?alt=media)

### Add a data source

{% hint style="info" %}
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`.
{% endhint %}

Now that you are fully onboarded, the only missing part is to add a data source. Forest Admin provides a way to [create your own](https://docs.forestadmin.com/developer-guide-agents-nodejs/data-sources/custom), but for this example, we will add a [SQL data source](https://docs.forestadmin.com/developer-guide-agents-nodejs/data-sources/provided-data-sources/sql).

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

```bash
yarn add @forestadmin/datasource-sql
```

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

{% tabs %}
{% tab title="index.js" %}

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

  //...
  .addDataSource(createSqlDataSource(process.env.DATABASE_URL))
  .mountOnStandaloneServer(3000)
  // ...
```

{% endtab %}

{% tab title=".env" %}

```bash
DATABASE_URL=postgres://lumber:secret@localhost:5432/meals
```

{% endtab %}
{% endtabs %}

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

```bash
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:

![](https://3861847666-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UN5oBJhgzLadOqi7jx6%2Fuploads%2Fgit-blob-40cea54c3488074ea6ed3060f3cdd3293fdc969b%2Fquickstart-editor-mode.png?alt=media)

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

![](https://3861847666-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UN5oBJhgzLadOqi7jx6%2Fuploads%2Fgit-blob-65f1c2d3c294a73366527f7e8a7a479bd2d10082%2Fquickstart-make-collection-visible.png?alt=media)

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)**

![](https://3861847666-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9UN5oBJhgzLadOqi7jx6%2Fuploads%2Fgit-blob-9d573d43c9ab8b78df5e825eb1d3cf2c6661ab5a%2Fquick-start-abilities.png?alt=media)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.forestadmin.com/developer-guide-agents-nodejs/getting-started/quick-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
