case study · P/02
site-auto-matrix
Small schools, shops and companies need a website but can't run one. This platform lets an agency spin up a site from a blueprint, hand the client a login, and host everything on one cheap server.
- Role
- Sole engineer
- Timeline
- Oct — Nov 2026 · 29 commits
- Platforms
- Web
What I built, layer by layer.
backend
Platform core
- Hostname routing in middleware: <slug>.onekampus.com or a custom domain → that tenant's site
- Three roles — Super Admin, Team Member, Client — enforced server-side
- Enquiry form with per-IP rate limiting, then email + WhatsApp alerts via the Meta Graph API
- INR billing cycles and invoices with a cron route
Next.js 15 server actions · Prisma 6 · Zod · jose JWT · Nodemailer
frontend
Admin, client portal and Code Studio
- Design tab for colours, fonts, header/footer and per-section layouts
- Code Studio: Monaco editor with instant React preview compiled in the browser by esbuild-wasm
- Per-site analytics, sitemap.xml and robots.txt
React 19 · Tailwind 4 · Monaco · esbuild-wasm
infra
Hosting and code deploys
- Caddy on-demand TLS: certificates issued only for hosts the app approves
- Code sites deploy from GitHub Actions through an HMAC-verified webhook, versioned with rollback
- Runs on a 1 GB Lightsail box: Postgres and Node memory tuned by hand
Docker Compose · Caddy · PostgreSQL 17 · AWS Lightsail
Engineering decisions.
- 01One deployment for every tenantRouting on the Host header means one app serves every client site — a single $7/month box. The trade-off is a shared failure domain, which suits small sites.
- 02Content as JSONB, sections as configA new kind of website needs no migration, just a new config module. Less relational integrity, so validation happens in Zod instead of the database.
- 03Code sites isolated on their own originClient-written React runs only on its own host, never next to the admin panel — so a client's JavaScript can never touch an admin session.
By the numbers.
counted from the repository29website blueprints
13Prisma models
37server actions
$7a month to host them all