Using NestJS with Forest Admin

Hi,
I would like to ask you, what do you think would be the best approach by connecting NestJS application with Forest Admin.

At the beginning, I was thinking to use REST API, but it seems I would miss lot of features, like setting additional params, nested views and so on. Nevertheless, our existing NestJS application could be used here.

Since Forest Backend Admin offers more possibilities, I tried this approach also. It looks great, but it seems I would have to use solely Express/Sequilize stack, right? Forest Back Admin gahters the data directly from database. So I would need to maintain my TypeORM model in NestJS and also model Forest Admin to have all synchronised.

I was just thinking about some microservices approach. So Forest Admin just bypasses the request further to NestJS with its own services and NestJS return the proper response in the proper format.

I assume that smart collections might be the solution, am I right. Could you give me a couple of hints how you forest backend app.js designed?

  1. I am not sure how the routing is designed. I see you are using requireAll, but this function does not return anything in your case, it is just called. Could you explain me, hot it works please?

  2. In which form should be the data that are received back from NestJS as response?

I have seen this page, but unfortunately, there said not much and it is not working of course if I just copy the code.

Thank you,
Vaclav

1 Like

Hi again @Vaclav :wave:

forest-express-sequelize will definitely use both express and sequelize to work. I’m not super familiar with NestJS, but if you have access to both, you should be able to onboard via our ‘In-app’ method.

From what I understand, that’s not ideal in your case, and indeed, Smart Collections are the way to go in your case. If you are interested in implementing this, we also have a few woodshop example that might help you implementing your use case here, and documentation about routes override & smart collection creation (Here, here)

If you encounter any errors while trying to implement your smart collections, please share here any informations that might help to investigate the issue you are encountering.

For your points

  1. I am not sure how the routing is designed. I see you are using requireAll, but this function does not return anything in your case, it is just called. Could you explain me, hot it works please?

The documentation I shared should given you the details of how the routing is designed on the agent side. Feel free to ask questions about it if you have any.

  1. In which form should be the data that are received back from NestJS as response?

Smart collections will use your implementation to discuss with your backend. forest-express-sequelize should given you all the tools to discuss with our frontend. The serialization used is JSONAPI based.

Let me know if that helps :pray: