As React developers, we typically don’t need to worry about implementing web APIs, since this is usually handled by the backend team. However, there are occasions where it becomes necessary for us to take on this task as well. These situations may include:
In some cases, it may be necessary to add an intermediary server between the application and its web servers. This could be used to proxy requests or to conceal the web server’s endpoints and API calls.
There are many reasons why certain tasks should be handled on the server rather than in the web browser. For example, some jobs simply can’t be processed client-side, such as file modifications or reading files, as certain packages are only compatible with Node.js. Additionally, tasks like sending emails, session management, or authentication should be performed on the backend for security reasons, as handling them on the front-end could pose significant risks.
…
Additionally, to ensure fast page loading times, all complex logic should be offloaded to a dedicated backend.
A small, lightweight application with minimal API requirements may still require a server.
A dynamic website that retrieves data directly from a database or server may need to sanitize the data to reduce request size or for security purposes.
All of this is to say - Next.js is a perfect candidate
Next.js has a built-in web server, with built-in functionalities that servers almost everything out of your need. You could
Mask your API calls with Next.js server.
Have a small API that would handle small logic.
Generate dynamic images that serve your blog content.
And much more.
However, despite its ideal functionality, the Next.js server is not suitable for complex calculations. It would require increased processing power to deploy your app, which raises costs without offering significant benefits. Generally, the Next.js server is best suited for small to moderately sized computational tasks. Next.js server is excellent, I would say. However, it would be even better if we can wisely determine when it's truly worth using.