Practitionist / Practitionist/elluminar_web
Subdomain & custom-domain storefronts (Netlify automation)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1
- Forks
- 0
- Avg merge
- 17h 2m
- Merged PRs (30d)
- 18
Description
Why / Context
PRD §6.3: every creator gets a branded page "and optionally a custom domain" — the Educosys-style owned-brand experience without building their own stack. MVP shipped path-based storefronts (/c/[slug], locked decision); this issue adds wildcard subdomains then custom domains with automated provisioning on Netlify.
Schema already in place — NO migration required
Tenant.subdomain(unique) andTenant.customDomain(unique) +domainVerifiedAt- Creator Pro entitlement
customDomain: true(CREATOR_PRO plan seeded) - Tenant branding fields (logo/banner/brandColors) already power storefronts
Implementation plan
- Middleware tenant resolution: extend Next middleware to map Host header → tenant (subdomain
{slug}.platform.comorcustomDomain) → rewrite to/(storefront)/[tenantSlug]routes; preserve path-based access. - Wildcard DNS:
*.platform.comon Netlify (wildcard domain alias + wildcard TLS); reserved-subdomain blocklist (www, api, admin, studio, mail…). - Subdomain claim UX in studio settings (validation, uniqueness, instant activation).
- Custom domains (Creator Pro gate): studio flow → learner adds CNAME/A records → verification poll (DNS lookup) → on verify, call Netlify API to add the domain alias to the site → set
domainVerifiedAt. - Netlify automation service (
src/lib/domains/netlify.ts): add/remove domain alias via Netlify API (PAT in env), status polling for TLS issuance, error surfacing in studio. - Auth/cookie scoping: BetterAuth cookies stay on the apex platform domain; storefront checkout hands off to platform-domain checkout (documented decision) — no cross-domain session leakage.
- SEO: canonical URL strategy (custom domain becomes canonical when verified; path-based 301s), per-tenant sitemap on their domain.
- Removal/offboarding: releasing a domain deletes the Netlify alias and clears fields; suspended tenants' domains park to a notice page.
Acceptance criteria
-
demo-academy.platform.comserves the storefront with TLS, no code deploy per tenant - Creator Pro tenant connects a custom domain end-to-end (DNS instructions → verified → TLS live)
- Non-Pro tenants see the upsell, cannot connect custom domains
- Checkout from a custom-domain storefront completes on the platform domain with session intact
- Canonicals/301s correct across the three URL forms
Dependencies / sequencing
- MVP M3 (storefronts) required; Netlify PAT + wildcard DNS are ops prerequisites
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the existing Next middleware tenant resolution and storefront routes, then read src/lib/domains/netlify.ts and the existing Tenant and entitlement definitions. Map the Netlify, DNS verification, cookie, SEO, and offboarding flows before implementation; done means the listed acceptance criteria work for subdomains, Creator Pro custom domains, checkout handoff, and canonical URLs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, typescript
- Domain
- authentication, cloud, devops, full-stack, web-dev
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100