🌐 Closet · Education · Subdomain Architecture
每間學校 · 獨立 Subdomain
demo.closet.persontees.com · kcl.closet.persontees.com · Cloudflare Pages wildcard DNS · 學生見到自己學校嘅 branding
🏗️ DNS Architecture
Wildcard Routing · 一個 CF Pages Project
唔需要每間學校一個獨立 deployment。我哋用 Cloudflare Pages wildcard DNS + tenant routing, 所有 tenant 共用同一份 code, 但係睇到自己嘅 branding。
Wildcard DNS Record (一次設定)
*.closet.persontees.com → CNAME → persontees-home.pages.dev
Tenant Routing Middleware
window.location.host → tenant_id = host.split('.')[0]
Per-Tenant Config (D1 / KV)
D1: tenants table · KV: tenant_config:{tenant_id}
Dynamic Brand Override
CSS custom properties from tenant.branding → :root --primary, --accent
Isolated Student Data (PDPO)
All queries: WHERE tenant_id = {tenant_id} · row-level isolation
🎓 Live Tenants · 預設 Subdomain 列表
每間學校 · 獨立 Branding · 共享 Platform
demo.closet.persontees.com
示範學院
REFERENCE CUSTOMER
kcl.closet.persontees.com
九龍真光中學
K-12 · 制服
cdhk.closet.persontees.com
中大校友會
大學 · 校友會
kln-tigers.closet.persontees.com
青衣商會小學
PTA · K-6
bgsk.closet.persontees.com
拔萃男書院附屬小學
K-6 · 精英
skhmc.closet.persontees.com
聖嘉勒女書院
K-12 · 女校
hkfc.closet.persontees.com
香港足球會
興趣班 · 體育
hksy.closet.persontees.com
香港管弦樂團
制服團體 · 興趣班
🎨 Per-Tenant Branding Override
每校獨立 Color Palette · 學生見到自己學校
Closet Education 唔係 one-style-fits-all。每間學校 register 時提供 Pantone codes (校徽 / 班色), 系統 auto-generate per-tenant theme。
demo.closet.persontees.com
示範學院
制服團體 · navy + gold + red
- Pantone 287C navy
- Pantone 872C gold
- Pantone 186C red
- 新季度 500+ 學生
kcl.closet.persontees.com
九龍真光中學
K-12 · maroon
- 校徽: Pantone 4625C
- maroon + gold accent
- 全校約 800 學生
- 2026-27 秋冬季度
cdhk.closet.persontees.com
中大校友會
大學 · purple
- 校友紫 + 校徽金
- 5,000+ 活躍校友
- Reunion 限定版商品
- 校友證 login
kln-tigers.closet.persontees.com
青衣商會小學
PTA · green
- 校隊 green 配色
- 500 K-6 學生
- PTA 主理
- 家長 QR login
⚙️ 技術架構
點樣令到 Subdomain 即開即用?
🌐 Wildcard DNS
一次設定 · 自動支援任何 subdomain · 唔需要逐間學校加 record
*.closet.persontees.com CNAME persontees-home.pages.dev
📦 Single Deployment
所有 tenant 共用同一份 code · 改一次全體受惠 · 維護簡單
CF Pages project: persontees-home
🔍 Tenant Detection
前端讀取 subdomain → 即時 load 對應 tenant config · 0 後端 roundtrip
host.split('.')[0] → tenant_id
💾 D1 Tenant Config
每個 tenant 一行 record · Pantone / logo / domain · 改 settings 即時生效
SELECT * FROM tenants WHERE subdomain = ?
🔒 Row-Level Isolation
所有 D1 query 強制 WHERE tenant_id · 唔可能跨 tenant 撈 data
SELECT ... WHERE tenant_id = :tid
🎨 Dynamic CSS Variables
Brand color 由 tenant config inject · 一份 code 自動變身
:root { --primary: ${tenant.primary} }
🚀 想你嘅學校拎獨立 Subdomain?
客戶經理 24 小時內回覆 · 由註冊到 setup 5-10 分鐘 · 永久 SSL
📝 Apply 5 分鐘 📱 睇 Student App Demo