Agenda Citara by Horacio OntiverosAgenda Citara by Horacio Ontiveros

Agenda Citara

Horacio Ontiveros

Horacio Ontiveros

Agenda Citara

2025
Multi-tenant scheduling SaaS with a proprietary Real-Time Flow Control engine that dynamically recalculates the entire day's schedule when appointments run overtime.

🚀 Case Study: Agenda Citara — Multi-tenant Scheduling SaaS & Real-Time Flow Control

Role: Lead Full Stack & Architecture Engineer Tech Stack: Next.js 15 (App Router), Supabase (PostgreSQL, RLS, WebSockets), Tailwind CSS, Stripe (Metered Billing), Node.js (Baileys WA Socket), AWS S3.

🛑 The Problem

Service professionals (doctors, therapists, consultants) deal with rigid calendars. When a single appointment runs 15 minutes late, the rest of the day falls into chaos — crowded waiting rooms and frustrated clients. Additionally, automated WhatsApp reminders via traditional providers like Twilio consume high unit costs, eroding the profit margins of independent professionals.

📐 The Solution

I engineered a highly scalable, multi-tenant scheduling platform. Beyond standard booking features, Citara introduces a proprietary Real-Time Flow Control Module (MTR) that dynamically recalculates and shifts the entire day’s schedule if an appointment runs overtime. To solve the notification cost issue, I built a hybrid messaging architecture allowing users to either use official templates or bridge their personal WhatsApp via a custom decentralized microservice.

⚙️ Technical Execution & Architecture

1. MTR Engine & Dynamic Rescheduling An algorithmic engine (/api/mtr/appointment/delay) intercepts delayed check-outs. When a session exceeds its allotted time, the system computes the minute offset, checks the user’s configured buffer limits, and cascades the delay across all subsequent appointments. Clients immediately receive an automated WhatsApp alert with their newly adjusted time.
2. Decoupled Hybrid WhatsApp Microservice I architected a dual-channel messaging system to drastically reduce notification overhead. Users can opt for standard Twilio delivery, or connect their personal WhatsApp using a custom Node.js/Express microservice powered by @whiskeysockets/baileys. An AWS S3 synchronization pipeline persists authentication states across serverless container restarts — enabling zero-cost automated messaging directly from the professional’s own number.
3. Metered Overage Billing (Stripe Webhooks) Engineered a complex Stripe integration handling flat-rate subscriptions (Pro/Premium) alongside usage-based metered billing. The backend tracks the monthly notification quota in PostgreSQL. If a user exceeds their limit, the system triggers a checkout.session.completed webhook to automatically append a metered overage item to their Stripe subscription, capping limits dynamically to prevent bill shock.
4. Real-time Database & Row-Level Security (RLS) Secured the multi-tenant architecture using Supabase Row-Level Security, ensuring absolute data isolation between professionals. PostgreSQL logical replication (Supabase Realtime) broadcasts instant UI updates via WebSockets — the operator’s dashboard reflects appointment statuses without manual polling.

🏆 Business Results & Unit Economics

Delivered a high-margin SaaS platform. By offering the personal WhatsApp microservice, customer acquisition friction is reduced (no extra message fees), while power users naturally upgrade to Premium tiers for advanced reporting and MTR features. The serverless and edge-optimized architecture keeps infrastructural costs negligible, scaling profitably from day one.
System Architecture Diagram · Click to zoom

Tech Stack

Next.js 15 Supabase PostgreSQL Tailwind CSS Stripe Node.js AWS S3 WebSockets TypeScript
Like this project

Posted Jun 8, 2026

Multi-tenant scheduling SaaS that dynamically manages schedules for service professionals.