Let’s say I own the domain saas.com and want to build a SaaS product. The idea is that users log into a dashboard, customize options (like contact details), and click “Create My Website” to deploy a site to their own domain. The website is the same for every user, except for personalized details like contact info. In fact, 90% of the content of the site IS in fact their personal details. The only thing that’ll be the same across all of them is the booking form.
I’m building this with Next.js and using Vercel for deployment. The problem is, I don’t want to create a new Vercel project for every user’s domain because that would be too expensive. I’m looking for a way to deploy all users’ sites without paying for separate Vercel projects, and I specifically want to avoid using subdomains (e.g., usersite.mysaasapp.com). Each user will already have their own domain.
For the backend, I’m using Postgres, Auth0 for authentication, and Cloudflare R2 for file storage. The dashboard and all user domains will retrieve data from the same database. The dashboard will also show live updates, like when a user’s visitor makes a booking.
My main goal is to save money on deployment. Any suggestions?
you can use the Vercel Domains API for this with transferring domains to then stick the users instance under their domain, for a good reference see this demo and check out the dub.co codebase on github to look at how they use it for their users to bring their own domains.
I’ve asked this question on Discord, Reddit and now here and you’re the only person so far who has actually posted what seems like a viable solution. I’ve had a brief look at the demo (which seems to have moved to someone’s portfolio) and the Domains API but I’m a beginner to SPAs and I was wondering if you could elaborate further on the steps I need to take to be able to achieve this. I’m not asking to be spoonfed with code, but I would appreciate a more elaborate answer. Thank you