Using NextJS as backend for a mobile app
If you use next as your web frontend and backend and suddenly want to create a mobile app, I guess the options are to either use the next endpoints as the API for the mobile app or to create another API server in rails/fastapi/express/whatever.
Let's say we decide to use NextJS as the backend for our mobile app aswell. This feels odd, but maybe it isn't lol. Like, architecturally it feels much cleaner to not have the web frontend (which is now just one of our frontends) coupled to the API layer. Because our other frontend is not coupled to the API layer, and from the API's perspective there shouldn't be any difference between these two frontends?
What do you think? If you use NextJS as your frontend and backend , I guess you either have to do this or maintain two different APIs later (one for web, one for mobile).
EDIT: Thought some more about, I feel like there is no way the pros outweigh the cons if your backend is somewhat complex. Will use Next for the front, but not for the back
3 Replies
Next is a backend language that utilizes react for the "view layer". It's a good choice for a standalone API if you are not doing long running tasks.
Why would you wanna have two backends? You're saying the cons outweigh the pros but what are the cons of using Next for the backend? I can't think of any.
You can check this out once you realize it's a good idea. https://github.com/t3-oss/create-t3-turbo
GitHub
GitHub - t3-oss/create-t3-turbo: Clean and simple starter repo usin...
Clean and simple starter repo using the T3 Stack along with Expo React Native - GitHub - t3-oss/create-t3-turbo: Clean and simple starter repo using the T3 Stack along with Expo React Native