System Design
This section contains the formal system design documentation for the Royal Glow Salon & Spa platform — written to staff-engineer review standard.Royal Glow is a monolithic modular monorepo targeting 20k–50k registered users at ₹0/month infrastructure cost. Read the High-Level Design for architecture and decisions; the Low-Level Design for state machines, sequences, and schema detail.
Documents
High-Level Design
Architecture overview, technology decisions, data model, auth design, and API patterns.
Low-Level Design
Database schema details, state machines, sequence diagrams, and implementation specifics.
At a Glance
Architecture Style
Monolithic modular architecture — not microservices. The codebase uses strict layer separation within a monorepo to achieve the modularity benefits of microservices without the operational burden. Each layer has explicit import boundaries enforced by the package structure.Key Design Decisions
Architecture → Monolithic modular
Architecture → Monolithic modular
Solo developer — there are no team boundaries to split a microservice topology along. Strict layers give the modularity without the ops cost.
Database → Neon PostgreSQL
Database → Neon PostgreSQL
Git-like branching, serverless scale-to-zero, and a generous free tier.
ORM → Drizzle
ORM → Drizzle
Pure TypeScript — runs on the Cloudflare Workers V8 isolate where Prisma’s binary cannot.
Auth → Better Auth
Auth → Better Auth
Self-hosted, Google OAuth with your own domain on the consent screen, and built-in RBAC.
Edge → Cloudflare Workers (OpenNext)
Edge → Cloudflare Workers (OpenNext)
Global edge delivery with a generous free tier. Both Next.js apps deploy to Cloudflare Workers via the OpenNext adapter (
@opennextjs/cloudflare) — not Pages.Realtime → Ably
Realtime → Ably
6M messages/mo free, with Token Auth for per-role channel scoping.
Money → integer paise
Money → integer paise
Eliminates floating-point rounding errors in billing and GST.
IDs → nanoid() text
IDs → nanoid() text
App-generated text keys prevent enumeration attacks.