Nextjs with Forest Admin example

My backend is hosted on Vercel using NextJS framework. I was wondering if anybody has used Forest Admin with NextJS and whether or not it would be possible given that the some of the public routes such as /routes/session are dynamically loaded during runtime.

Is there any examples that anybody could point me too?

Hi @errolgreen,

Welcome to the ForestAdmin community and thank you for reaching out!

By design ForestAdmin is built to generate a standalone backend application, hosted on your end, that directly communicate with your database, thus it should not go through your NextJS app.

If you have more questions about ForestAdmin architecture, maybe this article could help you get an overlook of it: https://medium.com/forest-admin/a-deep-dive-into-forest-admins-architecture-and-its-benefits-for-the-developers-who-trust-it-1d49212fb4b.

I hope I’ve been of any help!

1 Like

Is this still the case? I think it should be possible. Nextjs supports dynamic API routes, and @forestadmin/agent seems to basically be adding a bunch of route to whatever server is chosen.

It seems feasible to make this work with NextJS’s API stuff now (not sure that was the case in 2020)

Hello @jckw,

This answer was made a long time ago.

Today we do have a native integration to NextJS.

And one of our contributor even created a NextJS native module.

Kind regards,
Morgan

1 Like

Hi Forest community!

I have also the same use case, I use the API routes from NextJS for my app backend. So my api routes are served as serverless functions by Vercel, so I don’t have a classic backend server up and running all the time. So I was wondering if Forest Admin is compatible with this config.
I can create api routes to handle actions in forest admin panel, like smart actions, but how could I init the agent, and make the .forestadmin-schema.json and all the config visible to Forest ?

(The last answer mentioned NestJS instead of NextJS, which are very different :wink: )

Thanks for your help!