Can Forest Admin talk via our API instead of directly to the database?Last Updated: November 12, 2019
Forest Admin installs into your database and uses Express/Sequelize to generate the Admin API. So you need a database to set up Forest Admin.
When installing Forest Admin, it generates a dedicated Admin API which is different from your APIs to make sure Forest Admin works correctly. It is very common to implement your business logic when it comes to manipulating your data in your database using Forest Admin. Two options are therefore possible:
- If you have hooks on your data models (e.g., beforeCreate, beforeUpdate, etc.), Forest will use those specific models and thus execute the hooks.
- If you don’t have hooks, you can extend the Forest Admin API to implement the same data protection logic you have on your API. Check out this page from our documentation to see how to make this work.
Regarding your calculated fields used in your API, Forest Admin enables you to reproduce them effortlessly using our Smart Fields features. See our what a Smart Field is in our documentation.