Code structure and system design
Hi, I'm have a application building with Nextjs that have 3 site: customer admin agent.
Currently I'm routing it as
site.com
as customer admin.site.com -> localhost/admin
agent.site.com -> localhost/agent
as admin and agent, using Nginx rewrite to route the request to correct folder. They are in my page folder pages/index
pages/admin/*
pages/agent/*
This NextJS application is deploy on Amazon in a EC2 instance, but the Devop is having difficult routing the request to the correct site, using AWS Route 53. He and other is suggesting spliting the code to 3 repo and route the request that way. But I don't want that, because the 3 repo is sharing the logic/service.
I'm reading about the Nextjs config to rewrite the request/middleware to route, but afraid that will impact the app performance. And also monorepo to split the code.
So, my question is:
- On Amazon, how to route the request to correct folder/site of NextJS, using which AWS service to achive this?
- If not possible to keep the code in 1 repo for 3 site, what is the best solution for this?0 Replies