Skip to content
All work

Platform · 2025—2026

Live

Squaremax

A multi-tenant website builder that emits real sites, not templates.

  • 28component categories
  • 29k+lines of TypeScript
  • 5pages per tenant site

Overview

A hosted website platform where a business signs up, builds its site from a live component picker, and gets a real multi-tenant site at its own slug or custom domain. Add-ons — booking, notifications, store and inventory — switch on per tenant and bill automatically.

The hard part

A component instance that owns its own data

The invariant that makes the whole builder work: a site is rows of placed components, and each row has a unique id that owns its data blob. Two navbars on one site are two independent rows. Swapping a component's visual design within its category never touches its content, because the category fixes the data shape and the variant only chooses how it is drawn. That one decision is why a user can redesign a section without losing what they typed, and why adding a new design is one component file plus one registry line. Twenty-eight component categories share a single typed props contract, and every visual style resolves through CSS custom properties inlined on the tenant root — never on :root, so two tenants can render on one page without bleeding into each other.

What it does

  • 28 component categories in a Zod discriminated union, each with multiple hot-swappable designs
  • Per-instance style overrides with CSS scoped by prefixing every selector, so tenant custom CSS cannot escape its own component
  • Custom-domain rendering through a host-header proxy that rewrites to per-domain routes
  • Tenant-scoped customer accounts with scrypt password hashing and DB-backed per-tenant session cookies
  • Accounting-grade inventory add-on: cost and tax tracked per line, discounts apportioned before tax, refunds that restock

What it proves

  • Designing a data model that stays correct as the product grows
  • Multi-tenancy done properly — isolation at the data, style and session layers
  • Turning a hard architectural idea into something a non-technical user can operate

Stack

  • Next.js 16
  • React 19
  • TypeScript
  • Drizzle
  • PostgreSQL
  • Tailwind 4
  • Zod 4
  • next-auth
  • sharp

Related