Can One Next.js App Support Multiple Domains for Different Users?
Unanswered
Mackenzie River Husky posted this in #help-forum
Mackenzie River HuskyOP
I've been thinking about a potential web development idea. For a while now, I've been working on a website for a relative's restaurant using Next.js. The site includes features like online ordering and analytics. Recently, a friend of theirs, who also works in the restaurant industry, asked me to create a similar site. I haven't responded yet, but it got me thinking—what if I could build a platform where restaurant owners could register and link their accounts to their own domains?
I believe this could be beneficial because I’d only need to maintain and update one project. If I fix a bug or introduce a new feature—like a table reservation system—it would automatically be available to everyone. On the database side, I usually work with PostgreSQL through Supabase and Drizzle Kit, and I handle authentication using Auth.js.
What do you think? Is this idea totally impractical, or does it make sense? Do you know of any better solutions? I'd love to hear your thoughts!
I believe this could be beneficial because I’d only need to maintain and update one project. If I fix a bug or introduce a new feature—like a table reservation system—it would automatically be available to everyone. On the database side, I usually work with PostgreSQL through Supabase and Drizzle Kit, and I handle authentication using Auth.js.
What do you think? Is this idea totally impractical, or does it make sense? Do you know of any better solutions? I'd love to hear your thoughts!
7 Replies
@Mackenzie River Husky I've been thinking about a potential web development idea. For a while now, I've been working on a website for a relative's restaurant using Next.js. The site includes features like online ordering and analytics. Recently, a friend of theirs, who also works in the restaurant industry, asked me to create a similar site. I haven't responded yet, but it got me thinking—what if I could build a platform where restaurant owners could register and link their accounts to their own domains?
I believe this could be beneficial because I’d only need to maintain and update one project. If I fix a bug or introduce a new feature—like a table reservation system—it would automatically be available to everyone. On the database side, I usually work with PostgreSQL through Supabase and Drizzle Kit, and I handle authentication using Auth.js.
What do you think? Is this idea totally impractical, or does it make sense? Do you know of any better solutions? I'd love to hear your thoughts!
multi tenancy is possible, yes, no problems.
although multi tenancy comes with a big maintenance overhead (like configuring hosting-dependent wildcard domains, cookies) – and if each tenant has their own auth system, it complicates things even more.
so i would say if you only have to maintain two sites, you should just configure your build workflows to build two sites from the same codebase, with different environment variables for example (think two different vercel projects for the same repo). only when you need to maintain a larger number of sites should you think about multi tenancy.
although multi tenancy comes with a big maintenance overhead (like configuring hosting-dependent wildcard domains, cookies) – and if each tenant has their own auth system, it complicates things even more.
so i would say if you only have to maintain two sites, you should just configure your build workflows to build two sites from the same codebase, with different environment variables for example (think two different vercel projects for the same repo). only when you need to maintain a larger number of sites should you think about multi tenancy.
Mackenzie River HuskyOP
Thanks so much for the quick feedback! How would you handle it if not every restaurant wants the same features? For example, some may want table reservations, while others don't. Could this be managed with environment variables as well? How much do you think this would limit customization?
@Mackenzie River Husky Thanks so much for the quick feedback! How would you handle it if not every restaurant wants the same features? For example, some may want table reservations, while others don't. Could this be managed with environment variables as well? How much do you think this would limit customization?
i think a kv store storing the configurations of a restaurant would be a good idea.
then in the code you simply do things based on the value you get from the kv store
{
restaurant1: Config,
restaurant2: Config,
}then in the code you simply do things based on the value you get from the kv store
Mackenzie River HuskyOP
I haven't heard of this KV store before. Would this also be inside the env file? Could you possibly send a link about what exactly you're referring to? Thanks in advance.
@Mackenzie River Husky I haven't heard of this KV store before. Would this also be inside the env file? Could you possibly send a link about what exactly you're referring to? Thanks in advance.
kv stores here are like databases but for small json. it's essentially environment variables but more extensible, think env var but in the form of objects and not strings. examples: redis, vercel kv
many projects use kv stores to store configuration files when environment variables prove to be too inflexible and rigid
Mackenzie River HuskyOP
Thank you so much, I will look into it. I really appreciate the help.