DEV Community

Discussion on: What's your most up-to-date opinion on "monolith vs microservices"?

Collapse
 
sergiodxa profile image
Sergio Daniel Xalambrí

I like a lot how Next.js handles it, you create everything in a single project, your routes rendering an UI and your routes working as an API, then when you build for production you could have both:

  1. A single Node.js project running both UI and API
  2. A lot of serverless Node.js function running either an UI page or an API endpoint.

This way you code as a monolith, but you could deploy as microservices, because working in a monolith is usually easier, everything is in the same folder, everything run with a single command and you don't need to think that much about network communication between them. But then in production being able to run every route (either UI or API) as a different service will let you scale them as needed individually.