I am trying to setup a frontend with nextjs and spring boot as backend for one of the internal products of my company. My colleague suggested to look into nextjs as for backend as well.
SSO will be used as authentication for the product and ingress will be used as load balancer between kubernetes nodes (Atleast 3 nodes), with mysql as database with galera cluster (2 nodes atleast for database).
Will this setup work if I use nextjs as a fullstack framework?
Currently have implemented frontend side of it and tried to host it. It was successful.
Nextjs version: 14.0.4
2
Answers
Using Next.js as a full-stack framework for both frontend and backend is certainly possible, but it’s important to clarify some aspects of your proposed architecture.
Next.js as Full-Stack Framework:
Spring Boot as Backend:
SSO for Authentication:
Ingress and Load Balancing:
MySQL with Galera Cluster:
Version Compatibility:
Deployment and Scaling:
Monitoring and Logging:
In summary, using Next.js as a full-stack framework is possible, but you need to carefully plan and ensure that each component (frontend, backend, database, SSO, load balancing) is integrated and configured correctly. Test thoroughly, especially in a Kubernetes environment, to make sure the setup is robust and scalable.
Microservices architecture involves breaking down a software application into smaller, independently deployable services. This architecture is preferred for its scalability, flexibility, and ability to use different technologies for different services.
If you implement an authentication service within next.js, this setup will be bad because if your next.js pod goes down, you will lose two services, authentication and front-end service.
If you want to use the next.js for its server-side-rendering benefit for the client, you have to be careful where you make requests. if you are on the server your request URL will be different and it will need extra configuration