Back to Case Study

Cleany — Tech Deep Dive

Multi-Tenant SaaS Platform for House Cleaning Businesses

Tech Stack

ReactFastifyPostgreSQLPrismaStripeVite
Architecture: Monorepo (3 Apps)

Architecture

Landing PageNext.js + Sanity CMScleany.proAdmin DashboardReact SPA + Zustandapp.cleany.proWorker PWAOffline-First + QR AuthService Worker + IndexedDBAxios + JWTSync QueueFastify REST APIJWT Auth + JSON Schema Validation16 Routes · 17 ServicesMulti-Tenant IsolationPrisma ORMPostgreSQL22 Models · Multi-TenantJobs, Customers, Workers, InvoicesStripeSaaS Billing +Customer PaymentsWebhooksNotificationsResend (Email)Twilio (SMS)Fire & ForgetSchedule EngineRecurring JobsWeekly/Biweekly/MonthlyPayroll + InvoicingPDF GenerationPayment TrackingCheckoutMulti-tenant SaaS platform: 3 apps (Landing + Admin SPA + Worker PWA) communicating via Fastify REST APIData FlowExternal ServiceCore ServiceIntegration

Data Flow

  1. 1

    Admin manages customers, workers, and services through the React SPA dashboard

  2. 2

    React SPA communicates with Fastify REST API via Axios with JWT authentication

  3. 3

    Fastify routes validate requests with JSON schemas and delegate to service layer

  4. 4

    Prisma ORM queries PostgreSQL with tenant isolation on every operation

  5. 5

    Recurring schedule engine auto-generates work orders based on configurable patterns

  6. 6

    Workers receive jobs via offline-first PWA with IndexedDB cache and sync queue

  7. 7

    Stripe webhooks process SaaS subscriptions and customer payment confirmations

  8. 8

    Resend and Twilio fire-and-forget notifications for invoices and job alerts

Code Patterns

Multi-Tenant Isolation

Every API query filters by tenant_id extracted from the JWT. Prisma middleware enforces row-level isolation, and response serializers strip sensitive fields — ensuring zero data leakage between business accounts.

Offline-First Sync Engine

Service Workers cache job data with 24-hour TTL and 50-item cap. An IndexedDB write queue captures mutations offline, retrying with exponential backoff (3 attempts) when connectivity returns via the online event.

QR + PIN Worker Authentication

Workers scan a unique QR token that identifies them, then set a PIN on first login. Refresh token rotation with reuse detection prevents session hijacking, and account lockout triggers after 5 failed attempts.

System Metrics

22
Prisma Models
16
API Routes
41
Frontend Pages
17
Service Files

What's Next

The next milestone focuses on proof-of-work features: photo evidence capture (before/after photos per job), GPS clock-in verification to confirm workers are on-site, and push notifications so workers receive real-time job alerts without polling the app.

A customer-facing portal will let end customers view their cleaning schedule, accept quotes, request reschedules, and pay invoices — closing the loop between cleaning businesses and their clients.

The platform will also add a lead capture funnel on the landing page with analytics tracking, converting the marketing site from informational to revenue-generating.

Active Development — Follow the Journey

Want similar results for your project?