I Built a Multi-Tenant Website Builder with One Next.js App. Here's the Architecture.
I spent the last few months building Zenpage, a free website builder for authors. One codebase serves both the dashboard (where authors build their sites) and every published author site - on subdo...

Source: DEV Community
I spent the last few months building Zenpage, a free website builder for authors. One codebase serves both the dashboard (where authors build their sites) and every published author site - on subdomains and custom domains - using hostname-based routing in a single Next.js 15 deployment. This post breaks down the architecture decisions, the tricky parts, and what I'd do differently. The stack Runtime: Bun Framework: Next.js 15 App Router, React 19 Styling: Tailwind CSS v4, shadcn/ui API: tRPC with SuperJSON Database: PostgreSQL with Drizzle ORM Storage: Cloudflare R2 (S3-compatible) Email: Resend Infrastructure: Cloudflare (CDN, SSL, DNS) No external CMS. No headless anything. One repo, one deploy, one database. The core problem: serving N websites from one app Zenpage needs to do two things: Serve the dashboard at zenpage.io (auth, editing, settings) Serve every author's published site at authorname.zenpage.io or authorname.com Most people solve this with separate apps or microservices