Can I build a complete back-end with next ? Auth, CMS ? #12590
-
Hello everyone, First I would like to thank you for the documentation you've made, it is really easy to browse and read even for a noob like me :) I've followed the entire tutorial, but I'm still having this question : can I build a complete website in Next ? It seems to be that it is designed for simple websites - but once again I think I missed the point. I have seen in an older discussion that Express wasn't needed anymore since the version 9. So can I build a complete website like I would have with Express ? Thank for your time and your product. I've worked on React for a long time and I'm happy to get SSR back ! Bests, |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I'm sorry for my simple answer but, why couldn't you ? Everything you can do with nodejs you can do with Next.js. |
Beta Was this translation helpful? Give feedback.
-
I agree with the core of @gabooh's reply - that since NextJS is a framework wrapping React + Node, then yeah you should be able to do anything that you can do with React + Node. Next, indeed, can act as your main server for this just as Express would, which lets you easily stand it up inside of a Docker or by yourself on a raw server. I would caution you to be careful about it, though. At its heart, I think Next's main benefit for long term projects is that it is designed so that you write each React page component once and that template is used for both the SSR and the client-side rendering. This model could be really useful for some complex web apps, such as a CMS/blog where most of your pages' content will be able to be calculated on the server-side and sent to the requester, and most API calls will result in a movement to a new page. However, if the webapp your imagining is going to have almost no data that can be calculated server-side (say, it's entirely based on data in localstorage) or where a majority of the traffic to/from the server will be small API calls after one initial pageload, then I think the overhead of this framework might not make as much sense for the full backend. I have a project in that latter group and I've settled on using Next only for the webapp but moving the full backend (API + auth + content) to a graphql service in a separate binary. You definitely could do it all in Next, though. |
Beta Was this translation helpful? Give feedback.
I agree with the core of @gabooh's reply - that since NextJS is a framework wrapping React + Node, then yeah you should be able to do anything that you can do with React + Node. Next, indeed, can act as your main server for this just as Express would, which lets you easily stand it up inside of a Docker or by yourself on a raw server.
I would caution you to be careful about it, though. At its heart, I think Next's main benefit for long term projects is that it is designed so that you write each React page component once and that template is used for both the SSR and the client-side rendering. This model could be really useful for some complex web apps, such as a CMS/blog where most of you…