T
TanStack8mo ago
probable-pink

Looking to replace NextJS for our multi tenant app

As the title suggests, we're looking to move away from NextJS on our multi tenant app. The primary use is we're allowing users to have sub domains. This is handled via our NextJS middleware with a config like this:
if (
hostname.includes(process.env.NEXT_PUBLIC_ROOT_DOMAIN || "")
) {
// rewrite everything else to `/[domain]/[slug]` dynamic route
try {
return NextResponse.rewrite(
new URL(`/${hostname}${path + search}`, req.url)
);
} catch (e) {
console.log(..., e);
}
}
let domain = await getDomain(hostname);
if (
(domain &&
domain.domain.challenge_verified &&
domain.domain.verified) ||
(domain && domain?.domain.legacy)
) {
// rewrite everything else to `/[domain]/[slug]` dynamic route
try {
return NextResponse.rewrite(
new URL(`/${domain.username}${path + search}`, req.url)
);
...
if (
hostname.includes(process.env.NEXT_PUBLIC_ROOT_DOMAIN || "")
) {
// rewrite everything else to `/[domain]/[slug]` dynamic route
try {
return NextResponse.rewrite(
new URL(`/${hostname}${path + search}`, req.url)
);
} catch (e) {
console.log(..., e);
}
}
let domain = await getDomain(hostname);
if (
(domain &&
domain.domain.challenge_verified &&
domain.domain.verified) ||
(domain && domain?.domain.legacy)
) {
// rewrite everything else to `/[domain]/[slug]` dynamic route
try {
return NextResponse.rewrite(
new URL(`/${domain.username}${path + search}`, req.url)
);
...
We're planning a rewrite and I'd like to see if Start/Router is a good option for us. Is there an equivalent to the NextResponse.rewrite within Tanstack right now? Doesn't need to follow the exact rules, the most important part is the rewriting the entire domain. Thanks in advance
1 Reply
fascinating-indigo
fascinating-indigo3w ago
Hey, any news to that?

Did you find this page helpful?