Next.js Discord

Discord Forum

Can a NextJS app also serve as the backend server for a native mobile app?

Unanswered
Norwegian Forest Cat posted this in #help-forum
Open in Discord
Norwegian Forest CatOP
As I understand it, NextJS is a full stack framework, similar to Ruby on Rails. With that in mind, is it reasonable to consider utilizing some feature of it, I'm guessing API routes / routing, to serve a native client the same way I would if using Node + Express?

With the paradigm shift to Server-rendered components as first class citizens, are there any issues or redundancy with this design?

Thank you

3 Replies

Asian paper wasp
You could. If you needed multiple front-end implementations, I'd just write the API outside of Next. My preference is Nest.
Norwegian Forest CatOP
Could I throw Express into a non-routed directory and serve it simultaneously?
Asian paper wasp
You could probably find a way to do that. Just because you can, doesn't always mean you should. I'd never do it myself. If you have a need for a separate API, then it's best to separate it.