DEV Community

Discussion on: Is it a good idea to build backend with nextJS?

Collapse
 
jnv profile image
Jan Vlnas • Edited

First of all, pick the tools you are comfortable with. Next.js is a good start and you can extract the backend / API parts eventually as you outgrow the framework. Don't overengineer your project from the start.

That being said, personally I wouldn't pick Next.js for more complex APIs. Their "API routes" functionality provides poor primitives for building complex backends and you spend a lot of time reinventing abstractions other frameworks provide for you out of the box – frameworks like NestJS, FeathersJS, Adonis, Meteor…

For example, at superface.ai we use Next.js as a stateless frontend, while the backend is built with NestJS and exposes an API for the frontend, our SDK, and CLI. This works especially well if you have dedicated developers for frontend and backend parts.

Collapse
 
mozammelh profile image
Mozammel Haque

Thanks Jan, for such a detailed comment. I got your point of view.

Collapse
 
jackmellis profile image
Jack

First paragraph says it all. Don't over-engineer. Long term I think next's api layer is pretty basic and you'd benefit from having a dedicated api. But until you start to hit those pain points, or if your app is small, or during early development, then sure why not.

Collapse
 
mozammelh profile image
Mozammel Haque

Thanks Jack, It helps a lot.