Next.js Discord

Discord Forum

Local dev for multi-tenant help

Answered
English Angora posted this in #help-forum
Open in Discord
English AngoraOP
I'm trying to do s multi-tenant app locally, and I'm still new to the JavaScript ecosystem. At some point in my testing I'd like to have some method of overriding the hostname so that I can test the different hosts.

My first instinct here is to use a feature flag in the Hypertune integration to specify a hostname override for the middleware. Is this a bad idea? If so, what is it that I don't know? How do other people do this?
Answered by B33fb0n3
if you just want something fast, then copy the needed parts from the shared platform example. Like that you get is fairly quick and you see fast progress

More can be read here: https://nextjs-forum.com/post/1309952735293997107#message-1309953431620026479
View full answer

16 Replies

English AngoraOP
I saw that, and, in fact, it's where I grabbed the middleware from. I'm figuring out how to override it. So far, the plan is to use the Vercel toolbar on localhost, and have it override a featureflag from hypertune.
What I haven't figured out from the platforms starter kit is how the domains get pointed to the deployment, but that's for later.
I am not that into feature flags, but I guess you know what you are doing.

The domains getting rewritten to the currect path (and url if needed). You can see that here: https://github.com/vercel/platforms/blob/main/middleware.ts#L72
English AngoraOP
Yep. That makes sense. I was simply going to add a call to Hypertune ahead of that rewrite, and see if there was a requested host to override that domain.
English AngoraOP
I'm ... learning hypertune.
I'm just ... doing a lot of learning, to be honest.
@English Angora I'm just ... doing a lot of learning, to be honest.
In my opinion it's the best to build a solid basis and then add more to it, if it's needed. So build your multi tenant plattform first and then easily integrate hypertune
English AngoraOP
Mostly, I agree.
And frankly, if I don't get this working quickly, then that's exactly what I'll do.
I just want something that should be fairly quick and show me that I've made forwards progress.
@English Angora I just want something that should be fairly quick and show me that I've made forwards progress.
if you just want something fast, then copy the needed parts from the shared platform example. Like that you get is fairly quick and you see fast progress

More can be read here: https://nextjs-forum.com/post/1309952735293997107#message-1309953431620026479
Answer
English AngoraOP
Yeah, that's probably the way to go.
happy to help
English AngoraOP
This didn't really work out for me. The multi-tenant thing wasn't instantly playing nice with Payload.