Next.js Discord

Discord Forum

How to run 2 NextJS Apps side by side with seamless experience

Unanswered
Erythrina gall wasp posted this in #help-forum
Open in Discord
Avatar
Erythrina gall waspOP
I'm working with a startup who have made some decisions over a couple years that have created a codebase that has no real patterns and our performance is obviously suffering because of this. To help engineer our way out of this mess a thought was to setup a new NextJS project that is clean and start migrating specific components and functionality into a known pattern. The idea to eventually kill off the legacy codebase over the course of a year or so.

Is there a known NextJS pattern or interoperability for running 2 apps side by side? Or 1 app inside another? I know I can throw a proxy in front and send requests to different application clusters but I was trying to avoid that if there was a more NextJS way.

7 Replies

Avatar
Toyger
Is there a known NextJS pattern or interoperability for running 2 apps side by side....
why? if you want to refactor code just work with it separately and then when it will be ready kill old version.
Avatar
Erythrina gall waspOP
That kind of process wont work because the product is too large to do a rewrite in any business appropriate time frame. It has to be done gradually within the scope of new features and smaller targeted refactors. Routing is the big question here to be honest. Can i route between two apps internally within NextJS or do I need to solve this at the infrastructure layer.
Avatar
Toyger
not sure that nextjs and vercel provide such features at all.
You'll need to serve it on some self-hosted solution, and there you can serve users 2 different versions with any strategy you want.
Avatar
Erythrina gall waspOP
we don't use vercel
we outgrew that a while ago
Avatar
Mini Rex
Use the old system as the backend server, then keep migrating to nextjs project
Avatar
Erythrina gall waspOP
For those that are curious the App Router looks like it might be able to help solve our issues