Cadence: Operating System for Time-Based Businesses Case Study
A full-stack SaaS operating system for time-based businesses, built with production-grade constraints: database-level overlap prevention, forced tenant isolation, and honest analytics. The calendar serves as the main workspace, with drag-and-drop scheduling, undo capabilities, and complete booking lifecycle management across six business blueprints.
Service
Web Development
Industry
SaaS / Booking & Operations
Category
FULL-STACK SAAS
Built with: TypeScript, React, PostgreSQL, Next.js.
Overview
The Problem
Time-based businesses rely on the schedule as their core inventory, yet most booking tools treat it as a spreadsheet with a clock attached, leading to double-bookings, lost context and silent failures
Staff spend six to ten hours daily in booking software, yet dashboards compete for attention rather than helping them focus on the task at hand
Multi-tenant booking systems are vulnerable to data breaches from missing WHERE clauses that expose one business's customers to another
Booking software routinely invents unverifiable numbers like 'could increase revenue by up to 30%' that owners cannot fact-check
Generic SaaS interfaces show controls that do nothing: refunds that move no money, reminders never sent, calendar entries that were never actually saved
The Solution
A calendar built as a physical workspace where bookings can be picked up, dragged, stretched and dropped, with nearby bookings moving aside and live preview showing consequences before release
A schedule protected by the database itself using Postgres EXCLUDE USING gist constraints to make overlapping bookings impossible, even if application code has bugs
Two layers of tenant isolation: every query scoped by organization and 22 forced row-level-security policies blocking cross-tenant reads below the application layer
Honest intelligence layer showing only backtested forecasts, transparent risk scoring, and hidden sections with no data rather than invented metrics
Six complete business blueprints built as content, not code: salon, barbershop, dental clinic, day spa, fitness studio and restaurant, each with staff, services, hours, timezone and booking rules
Solution Workflow
Register
Onboard
Schedule
Operate
Automate
Analyze
Full Technical Breakdown
Design Language as Written Documents
Five documents totalling 3,200 lines: Experience Constitution, Interaction OS, Visual Language, Workspace Constitution and Interaction Library, each explaining reasoning behind every rule and design decision to ensure feature consistency.
OKLCH Token-Based Design System
Every colour defined once in globals.css with full light and dark themes. Resting state close to monochrome, one deep violet as brand accent, six muted tones for staff identity, and status colour reserved only for states needing attention to avoid visual noise.
Signature Visual Elements and Motion
Cadence Clock hero with engraved chronometer showing booked time as arcs, Hour Rail unrolled down the left margin mapping the page, Pin and Ledger Line logo elements marking time, and ambient Breath using CSS keyframes on compositor rather than main thread.
Materials-Based Surface Design
Rejection of glassmorphism in favour of paper surfaces for content, canvas for the calendar's ruled worktable, and metal for small fixed points. Hairline rule borders, three-step elevation ladder, and Object Seam edge treatment so the eye learns what can be acted on.
Room-Based Navigation Architecture
Twelve destinations each serving a purpose: Dashboard as Morning Briefing, Bookings as Ledger Room, Calendar as Drafting Table, Payments as Vault, Analytics as Reading Room, Settings as Workshop. Thread remembers last five rooms visited, Inspector opens bookings and customers beside current view.
Fraunces, Geist and Tabular Typography
Fraunces display serif with optical-size axis active for annual-report feel, Geist Sans for interface, Geist Mono for data. Numbers use tabular lining figures so columns line up like ledgers, and merged small-caps style replaces four competing styles.
Calendar as Object-Manipulation Workspace
Grip with collision breathing where approached bookings step aside, consequence preview showing exact change on release, undo ribbon for every move, and temporal states moving bookings through upcoming, due, in progress and overdue based on one shared clock.
Session State and Persistence Strategy
TanStack Query manages server state with 30-second polling and fetch-skipping on identical data. Workspace memory persists in localStorage under cadence.* namespace, scroll position in sessionStorage, and drag engine reads through useSyncExternalStore so only moving bookings re-render.
Auth.js and Bcrypt Security
Auth.js v5 with Prisma adapter supports email, passwordless magic links valid 15 minutes, and optional Google sign-in. Passwords hashed with bcrypt cost 12, require 10 to 72 characters with mixed case and digit, with 72-character limit matching bcrypt's real input size.
Results
Key Features
Scheduling Engine with Database-Level Guarantees: Availability generated from weekly working hours minus schedule exceptions, with a pure business-rules engine enforcing lead time, advance windows, and buffers. Bookings guarded by a Postgres GiST exclusion constraint that refuses any overlap with SQLSTATE 23P01.
Calendar Physics and Workspace Manipulation: Bookings can be picked up, dragged, stretched and dropped as physical objects. Collision breathing moves nearby bookings aside, live previews show consequences before release, and every change can be undone from a dedicated undo ribbon.
Complete Booking Lifecycle Management: Seven distinct states from pending through completion, each with its own endpoint and audit row written in the same transaction. Includes waitlist with automatic promotion, offer expiry timers, and full booking history with calendar export.
Multi-Tenant Architecture with Forced Row-Level Security: Every row carries an organizationId, queries run in transactions setting app.org_id, and Postgres enforces FORCE ROW LEVEL SECURITY underneath with 22 forced policies. Rate limiter fails closed when it cannot reach Redis.
Intelligence Room with Verifiable Analytics: Every figure is arithmetic over the workspace's own rows with no external models. Forecasts are backtested on unseen data, measured error sets confidence wording and band width, and unmeasured categories score null rather than zero.
Six Complete Business Blueprints: Salon, barbershop, dental clinic, day spa, fitness studio and restaurant workspaces, each seeding about 500 non-overlapping bookings with staff, services, customers, reviews, hours and timezone rules ready to go on day one.
Before
Before Cadence, time-based businesses relied on booking tools that treated schedules like spreadsheets with a clock attachment. Double-bookings went undetected at the application layer, oversight was handled manually, and staff had no visual sense of collisions or conflicts until they occurred. Dashboards competed for attention with generic card grids that looked the same across all rooms. Multi-tenant systems were vulnerable to cross-tenant data leaks from a single missing WHERE clause. Marketing claims featured unverifiable statistics and invented testimonials. Controls appeared functional but did nothing: refunds that moved no money, reminders never sent, calendar entries never actually saved. Dragging a booking on a busy week took 133 seconds of rendering due to excessive re-renders. Performance was not measured, and new accounts could sign up and reach a dead end with no working business and no way to create one.
After
After implementing Cadence, new owners pick their business type and receive a complete, working workspace in one step, with staff, priced catalogue, customers, reviews, hours, timezone and 500 non-overlapping bookings already seeded. Every room now reads its own workspace rows, eliminating hard-coded data. Overlapping bookings are refused by Postgres itself, cross-tenant reads are blocked by forced row-level security beneath the application, and the rate limiter refuses requests when it cannot reach Redis. Every number in analytics shows how it was calculated. Automations report every step's actual result (VERIFIED, REPORTED, or NOT_PERFORMED) with no invented capabilities. Controls with nothing behind them are disabled with a stated reason. Dragging a booking on a 253-booking week now takes 3.3 seconds with 33ms frame gaps at the 95th percentile. The codebase has 348 automated tests across 18 files, including 71 integration tests against real Postgres, with zero console or page errors across 30 production room visits in light mode, dark mode and reduced motion.
What This Proves
Cadence demonstrates that a vertical SaaS product can be designed and engineered as one unified system to a standard where every claim can be verified. On the engineering side, data integrity is enforced by the database rather than by application code: an exclusion constraint against double-booking, forced row-level security against cross-tenant leaks, idempotency keys against duplicate submissions, and a rate limiter that fails closed when it cannot count. On the design side, a written design language produces a recognisable identity without relying on glass, gradients or walls of KPI tiles. The method itself is transparent: performance was measured with a custom headless React profiler rather than guessed, defects were found by running production builds in a real browser, and every design pass documents what was deliberately left unbuilt and why. The product takes a clear stance on honesty: no invented statistics, no fake controls, no confidence not earned. For a business owner entrusting their livelihood to booking software, this level of integrity and measurable rigour is foundational.
Tech Stack
Backend
Next.js Route Handlers — Versioned /api/v1 REST API with 38 handlers across 31 routes for bookings, availability, customers and automations
Prisma 7 with PostgreSQL adapter — Type-safe queries over 32 models and 22 enums, tenant-scoped transactions setting app.org_id
BullMQ — Background workers for booking-hold expiry, waitlist promotion and offer expiry as safe-to-retry jobs
Auth.js v5 — Credentials, magic links and Google OAuth with JWT sessions and Prisma adapter
Luxon — Timezone-correct scheduling and daylight-saving arithmetic with memoised hot paths
Frontend
Next.js 15 App Router — Server Components for room reads, Server Actions for auth and onboarding, middleware-gated workspaces
React 19 — 151 components across 12 app rooms, calendar engine, app shell and UI kit
TanStack Query 5 — Server state with honest polling, cursor pagination and targeted invalidation after booking mutations
Tailwind CSS 4 with shadcn/ui and Base UI — Utility styling on 1,569-line token sheet; Base UI primitives for menus, tooltips and sheets
Framer Motion 12 — Calendar drag, collision breathing, layout shuffles on sort and sheet stacking with reduced motion support
Quality & Testing
Vitest and Playwright — 348 tests across 18 files including 71 integration tests against real Postgres and production walk-through
Pino — Structured server logging
Data & Infrastructure
PostgreSQL 16 — GiST exclusion constraint against overlaps, 22 forced row-level-security policies, pooled connections via Neon
Redis — Sliding-window rate limits, login lockout, RBAC cache, device revocation, idempotency keys and job queues via Upstash
Vercel — Serverless hosting for Next.js with security headers and no-store caching policy
Scalability & Flexibility
Multi-Tenant by Construction: Every row carries an organizationId and queries run in transactions setting app.org_id, with Postgres enforcing FORCE ROW LEVEL SECURITY. This matters because the app connects as the table owner and without FORCE the owner would bypass every policy.
One Account, Many Businesses: Memberships link users to organizations with a role, so growing from one location to several is a workspace switch, not a migration or retraining.
New Verticals as Content, Not Code: Each business type is a blueprint covering staff titles, priced catalogue, customers, reviews, hours, timezone and booking rules. The schedule generator is pure and tested across all six verticals with 48 tests and no database, so adding a seventh vertical is one new blueprint entry.
Per-Business Rules Without Schema Changes: Lead time, booking window, cancellation window, buffer, deposits, waitlist and online self-service are columns on OrganizationSettings with a JSON extra field for future settings, eliminating migration overhead.
Pluggable Transports: Email resolves SMTP first and Resend second behind one sendEmail call. SMS via Twilio and payments via Stripe turn on through environment variables, and the interface disables their controls with a stated reason when not configured.
Automation Catalogue Ready to Grow: Triggers grouped by observation method: nine audit-backed, three derived, and four templates waiting on data Cadence does not collect yet. Each template names the capability it needs rather than failing silently.
Background Work Off the Request Path: Hold expiry, waitlist promotion and offer expiry run as BullMQ jobs with safe-to-retry transitions. Jobs can run on a persistent worker host or be drained by a cron route on the same Redis.
Serverless-Safe Data Access: Prisma uses a pooled Neon endpoint in production, and every API response is no-store, so tenant data is never cached at the CDN edge.
Safe Configuration at Startup: Every environment variable validated with Zod at startup. A missing secret fails the build loudly instead of failing a request at 3 am with a runtime error.
Design System Built to Extend: Colours, elevation, room atmospheres and identity tones generated from shared formulas. A thirteenth room supplies four numbers: hue, variance, chroma and presence, and inherits a light that passes contrast tests automatically.