How to make SSR with Adonis + React or Next?


SSR is important to build a quick running app.How to implement this with Adonis?


Hey @razvacos! :wave:

What have you tried so far?


I found a solution with express + pug + react and saw that is another option for making ssr with headless chrome.I try to figure out a way to implement with adonis.


Your backend shouldn’t care about which frontend you use. Same goes for your frontend that doesn’t care about your backend.

You should have two application and not try to merge two differents contexts.

  • Run a Next.js application (SSR)
  • Run an Adonis application (API)


Ok , but how to configure Adonis with Next? Just make two separate folders and that’s it?


Yes, they aren’t related and aren’t the same application.
Two folders, two different ports, two different apps.


Do you have an example?


Why would you need an example?

adonis new myApi --api-only
create-next-app myFrontend


Would be awesome a showcase on github or an article…


I don’t think it’s needed. As I already said, it has nothing to do with Adonis.
You need to understand both serve a different context and use-case.

  • Your API is used to serve data.
  • Your frontend is used to get the data from the API via an HTTP call.


I asked because want to use this package :

with Adonis api.


@romain.lanz no need Express.js side by side with Adonis.js?


Hi @razvacos

There is a service provider for Nextjs

and for quick start or how to run it, check this repo


Thanks for your reply.
Now i’m migrating to Apollo graphql client instead of Next.js.