Before you start writing a single line of code, it’s a good idea to get an overview of how Forest Admin works. The magic lies in its architecture.
Forest Admin provides you with:
An API hosted on your server to retrieve your data. We call it the Admin Backend
if you chose a database as a datasource (PostgreSQLL, MySQL, MSSQL, MongoDB), your Admin Backend will be generated as a standalone folder.
if you chose an existing app as a datasource (Rails, Django, Laravel, Express/Sequelize, Express/Mongoose), your Admin Backend will be generated within your app.
A user interface to access and manage your data from your browser. This Forest Admin User Interface is built and managed through ressources hosted on Forest Admin's servers.
The Admin Backend is a Node.JS REST API hosted on your servers
The Admin Backend is a Rails Engine mounted on your application
For a more in-depth explanation of Forest Admin's architecture (the Node.JS agent version), please read the following article.
The Admin Backend
The Admin Backend is generated upon install and hosted on your end.
It includes an API allowing to translate calls made from the Forest Admin UI into queries to your database (covering actions such as CRUD, search & filters, pagination, sorting, etc.).
It also provides the Forest Admin servers with the information needed to build the User Interface (the Forest Admin Schema). This information includes table names, column names and types, and relationships. It is sent when you run your Admin Backend within a file called forestadmin-schema.json.
When logging into the Forest Admin UI in your browser, you will connect to:
The Forest Admin servers to retrieve the Forest Admin UI.
The Admin Backend to retrieve your data and populate the Forest Admin UI with it.
As your data transits directly from the Admin Backend hosted on your end and the user browser, it never transits through our servers.
The connection to both servers to the Admin Backend and the Forest Admin Servers are protected using 2 different JWT signed by 2 different keys:
FOREST_ENV_SECRET to authenticate all requests made to the Forest Admin Servers
FOREST_AUTH_SECRET to authenticate all requests made to the Admin Backend
FOREST_ENV_SECRET is provided by Forest Admin and ensures your Admin Backend interacts with the relevant environment configuration on our end.
FOREST_AUTH_SECRET is chosen freely by you and is never disclosed to anyone.
The JWT Data Token contains all the details of the requesting user. On any authenticated request to your Admin Backend, you can access them with the variable req.user.