BACK TO SELECTED WORK
CASE STUDYFull-Stack Product Engineering

CarePulse

Healthcare Operations & Appointment Workflow Engine

ROLEFull-Stack Produc...
CORE STACKNext.js 14 / TypeScript /...
YEAR2024
STATUSProduction
EST. READ52 MIN READ

Healthcare appointment and patient onboarding platform engineered with Next.js 14 App Router, server-side data operations, Appwrite backend services, centralized Zod validation, and Twilio SMS dispatch.

Core Challenge: Healthcare appointment systems involve distinct actors and complex state transitions. The engineering challenge was not simply displaying forms, but coordinating patient registration, clinical data, doctor selection, appointment requests, status transitions (Pending, Scheduled, Cancelled), SMS notifications, document storage, and administrative workflows in a unified, reliable product lifecycle.

Next.js 14TypeScriptReactTailwind CSSshadcn/uiAppwriteTwilioSentryVercel

THE PROBLEM

Healthcare appointment platforms involve distinct actors and intricate state transitions across patients, clinical administrators, and physicians. The engineering challenge was not simply rendering input forms, but coordinating multi-field patient registration, clinical data, doctor selection, appointment requests, status transitions (Pending, Scheduled, Cancelled), SMS notifications, document storage, and administrative management in a unified, reliable product lifecycle.

Multi-step patient history, insurance, and emergency contacts.

Deterministic transitions across Pending, Scheduled, and Cancelled.

Encrypted patient identification uploads via Appwrite Storage.

Instant SMS dispatch verifying appointments and cancellations.

KEY CONSTRAINTS & COORDINATION PROBLEMS4 VECTORS
  • ▸CLINICAL DATA: Multi-step patient history, insurance, and emergency contacts.
  • ▸STATE MUTATIONS: Deterministic transitions across Pending, Scheduled, and Cancelled.
  • ▸DOCUMENT VAULT: Encrypted patient identification uploads via Appwrite Storage.
  • ▸NOTIFICATIONS: Instant SMS dispatch verifying appointments and cancellations.
ACTOR COORDINATION & STATE CHANGES
PATIENT
│
├── Registration
│
├── Medical information
│
└── Appointment request
│
▼
ADMINISTRATOR
│
┌─────┼─────┐
▼ ▼ ▼
SCHEDULE PENDING CANCEL
│
▼
PATIENT NOTIFICATION

Fig 1.1: Coordination boundaries between patient registration, administrative review, appointment state changes, and automated SMS dispatch.

HORIZONTAL SCROLL ON MOBILE ↔

THE APPROACH

The application keeps the client-side user experience simple and reactive while moving all data operations, validation parsing, and third-party API mutations into server-side actions. This design avoids heavy client bundles, hides private Appwrite master keys from the browser, and ensures that all patient and appointment state transitions are verified in an isolated server environment.

Controlled inputs, masked phone fields, custom select dropdowns, and shadcn/ui primitives.

Server actions (`appointment.actions.ts`, `patient.actions.ts`) executing privileged mutations.

Zod schemas enforcing strict types, email regex, E.164 phone formats, and consent flags.

Configures Appwrite Client, Databases, Users, Storage, and Messaging instances with project keys.

Centralized TypeScript interfaces defining Patient, Appointment, Doctor, and Form parameters ensuring end-to-end type parity.

HIGH-LEVEL SERVER-ACTION ARCHITECTURE
PATIENT UI
│
▼
NEXT.JS APP
│
├── Server Actions
│
├── Form Validation
│
└── UI Components
│
▼
APPWRITE
┌─────┼─────────┐
▼ ▼ ▼
USERS DATABASE STORAGE
│
▼
APPOINTMENTS
│
▼
MESSAGING
│
▼
SMS

Fig 2.1: Client form submissions flow into server actions, orchestrating Appwrite Users, Databases, Storage, and Twilio SMS dispatch.

HORIZONTAL SCROLL ON MOBILE ↔

Item 1

Controlled inputs, masked phone fields, custom select dropdowns, and shadcn/ui primitives.

Item 2

Server actions (`appointment.actions.ts`, `patient.actions.ts`) executing privileged mutations.

Item 3

Zod schemas enforcing strict types, email regex, E.164 phone formats, and consent flags.

Item 4

Configures Appwrite Client, Databases, Users, Storage, and Messaging instances with project keys.

Item 5

Centralized TypeScript interfaces defining Patient, Appointment, Doctor, and Form parameters ensuring end-to-end type parity.

ARCHITECTURE & DATA FLOW

CarePulse is architected around a unified Next.js 14 App Router application paired with Appwrite managed backend services. Rather than deploying artificial microservices, the system couples server actions directly to Appwrite SDK initializers, handling user identity, document database records, secure file storage, and Twilio-backed SMS messaging through explicit server-side boundaries.

Patients access multi-step registration and appointment booking. Administrators authenticate via a passkey modal to access global scheduling tables and action dialogs.

All database writes, document uploads, and notification calls execute inside server actions. Appwrite secret credentials and Twilio API keys never touch the client browser.

Appwrite provides managed storage buckets for patient IDs, document collections for patient & appointment states, and the messaging bridge triggering automated SMS dispatch.

CAREPULSE SYSTEM ARCHITECTURE
CAREPULSE
│
┌─────────┴─────────┐
│ │
PATIENT UI ADMIN DASHBOARD
│ │
└─────────┬─────────┘
▼
NEXT.JS 14
│
┌─────────┼─────────┐
│ │ │
▼ ▼ ▼
FORMS SERVER ROUTING
ACTIONS
│
▼
APPWRITE
┌────────────┼────────────┐
│ │ │
▼ ▼ ▼
USERS DATABASE STORAGE
│
▼
APPOINTMENTS
│
▼
MESSAGING
│
▼
SMS

Fig 3.1: Structural topology connecting client interfaces (Patient & Admin) to Next.js 14 server actions, Appwrite BaaS primitives, and Twilio SMS gateways.

HORIZONTAL SCROLL ON MOBILE ↔
SYSTEM SUBSYSTEMS & RESPONSIBILITIES3 SUBSYSTEMS SPECIFIED
01Patient Portal & Admin Gate

Patients access multi-step registration and appointment booking. Administrators authenticate via a passkey modal to access global scheduling tables and action dialogs.

02Next.js 14 Server Actions

All database writes, document uploads, and notification calls execute inside server actions. Appwrite secret credentials and Twilio API keys never touch the client browser.

03Appwrite Service Engine

Appwrite provides managed storage buckets for patient IDs, document collections for patient & appointment states, and the messaging bridge triggering automated SMS dispatch.

PATIENT ONBOARDING FLOW

The onboarding workflow decouples base identity creation from detailed clinical registration. First, a lightweight user identity is generated via Appwrite Users API using name, email, and phone. The user is then directed to /patients/[userId]/register to complete clinical history, emergency contacts, insurance information, and identification document uploads persisted securely in Appwrite Storage before booking an appointment.

Collects primary identifiers (Name, Email, E.164 Phone) and generates a persistent Appwrite userId.

Gathers past medical history, primary physician, allergies, current medications, emergency contact, and legal consent checkboxes.

Converts scanned identification files into multipart form buffers and uploads to Appwrite Storage, saving the file ID directly on the patient document.

PATIENT ONBOARDING PIPELINE
START
│
▼
BASIC INFORMATION
│
├── Name
├── Email
└── Phone
│
▼
CREATE USER
│
▼
PATIENT REGISTRATION
│
├── Personal information
├── Medical information
├── Emergency contact
├── Insurance
└── Consent
│
▼
OPTIONAL DOCUMENT UPLOAD
│
▼
PATIENT RECORD
│
▼
BOOK APPOINTMENT

Fig 4.1: Two-tier onboarding sequence: User account creation via Appwrite Users followed by comprehensive medical profile persistence in Appwrite Databases.

HORIZONTAL SCROLL ON MOBILE ↔

STEP 1: USER IDENTITY

Collects primary identifiers (Name, Email, E.164 Phone) and generates a persistent Appwrite userId.

Keys:Appwrite Users API

STEP 2: CLINICAL RECORD

Gathers past medical history, primary physician, allergies, current medications, emergency contact, and legal consent checkboxes.

Keys:Appwrite Database

STEP 3: IDENTIFICATION VAULT

Converts scanned identification files into multipart form buffers and uploads to Appwrite Storage, saving the file ID directly on the patient document.

Keys:Appwrite Storage

APPOINTMENT LIFECYCLE

The appointment lifecycle supports create, schedule, and cancel workflows without ambiguous intermediate states. The repository's appointment server actions explicitly map: incoming patient requests initialize with status pending, administrative approvals transition the record to scheduled, and rejections transition to cancelled. Both schedule and cancel transitions dispatch automated SMS updates via Twilio.

Triggered when a patient books via createAppointment(). Records primary doctor, appointment reason, and patient notes into Appwrite Database.

Admin confirms doctor assignment and specific calendar slot via updateAppointment(). Dispatches confirmation SMS with time and doctor details.

Admin records a required cancellation reason string. Updates appointment status in Appwrite and dispatches notification SMS explaining the cancellation to the patient.

APPOINTMENT STATE TRANSITION & NOTIFICATION FLOW
PATIENT
│
▼
CREATE REQUEST
│
▼
PENDING
│
├───────────────┐
▼ ▼
SCHEDULED CANCELLED
│ │
▼ ▼
SMS UPDATE SMS UPDATE
│
▼
PATIENT

Fig 5.1: Finite state lifecycle: Patient creation transitions to PENDING, while administrative actions trigger SCHEDULED or CANCELLED states with real-time SMS notifications.

HORIZONTAL SCROLL ON MOBILE ↔
CREATE FLOW

PENDING

Triggered when a patient books via createAppointment(). Records primary doctor, appointment reason, and patient notes into Appwrite Database.

ADMIN FLOW

SCHEDULED

Admin confirms doctor assignment and specific calendar slot via updateAppointment(). Dispatches confirmation SMS with time and doctor details.

ADMIN FLOW

CANCELLED

Admin records a required cancellation reason string. Updates appointment status in Appwrite and dispatches notification SMS explaining the cancellation to the patient.

ENGINEERING CHALLENGES

Full-stack product engineering demands solving concrete integration friction: managing multi-step onboarding pipelines, centralizing dense healthcare validation rules, designing polymorphic form states, and orchestrating external BaaS services reliably.

01 CHALLENGE

MULTI-STEP PATIENT ONBOARDING

USER → PATIENT RECORD → APPOINTMENT
PROBLEM

Patient creation cannot be completed in a single flat form due to identity separation. The application coordinates user creation via Appwrite Users, transfers the generated userId to `/patients/[userId]/register`, and subsequently guides the verified patient to appointment booking.

02 CHALLENGE

COMPLEX HEALTHCARE FORM VALIDATION

CENTRALIZED ZOD SCHEMAS
PROBLEM

Clinical intake forms collect varied data types: RFC emails, E.164 phone formats, date-of-birth constraints, emergency contact relations, insurance policy strings, identification file buffers, and legal consent checkboxes. Centralized Zod schemas enforce strict runtime validation before submission.

03 CHALLENGE

POLYMORPHIC APPOINTMENT STATE MANAGEMENT

CREATE · SCHEDULE · CANCEL
PROBLEM

A single unified AppointmentForm modal services create, schedule, and cancel workflows. The component dynamically swaps validation schemas, toggles input visibility (cancellation justification vs appointment schedule time), and reconfigures submit actions based on the active modal mode.

04 CHALLENGE

EXTERNAL SERVICE COORDINATION

NEXT.JS + APPWRITE + TWILIO + SENTRY
PROBLEM

Mutations require synchronizing Next.js App Router, Appwrite document collections, file storage buckets, Twilio SMS message relays, Sentry telemetry, and Vercel hosting—ensuring failed external dispatches are surfaced cleanly without leaving corrupted or orphaned records.

TECHNICAL RIGOR

Every architectural layer in CarePulse is grounded directly in verified repository code. No fabricated enterprise microservices or unbacked dependencies are added; the stack maps strictly to the dependencies declared in the project configuration.

CORE TECHNICAL MATRIX
┌─────────────────────┬──────────────────────────────┐
│ TYPE SAFETY │ TypeScript │
│ VALIDATION │ Zod │
│ FORMS │ React Hook Form │
│ DATA OPERATIONS │ Server Actions │
│ DATABASE │ Appwrite Database │
│ FILE STORAGE │ Appwrite Storage │
│ USER MANAGEMENT │ Appwrite Users │
│ NOTIFICATIONS │ Appwrite Messaging / SMS │
│ ERROR MONITORING │ Sentry │
│ UI SYSTEM │ Tailwind + shadcn/ui │
│ DEPLOYMENT │ Vercel │
└─────────────────────┴──────────────────────────────┘

Fig 7.1: Architectural boundary matrix verified against the production package manifest and repository implementations.

HORIZONTAL SCROLL ON MOBILE ↔

STRICT TYPE PARITY

ISOLATED SECRETS

ACTIVE MONITORING

VALIDATION BOUNDARIES

Validation is centralized in lib/validation.ts rather than scattered ad-hoc across individual UI components. React Hook Form leverages Zod resolvers to enforce strict schema integrity on the client, preventing invalid payloads from ever reaching the server actions or Appwrite database collections.

Validates minimum character length for names, RFC email standards, and E.164 phone formatting.

Enforces birth date parsing, emergency contact relations, insurance policy numbers, file uploads, and mandatory consent flags.

Ensures valid physician assignment, forward-looking schedule timestamp, and appointment context strings.

Verifies finalized doctor selection and precise confirmed appointment time for SMS transmission.

Mandates non-empty justification string (min 2 chars) explaining the cancellation to the patient via SMS.

SCHEMA RESOLUTION & SUBMISSION PIPELINE
USER INPUT
│
▼
REACT HOOK FORM
│
▼
ZOD
│
┌──────┴──────┐
│ │
VALID INVALID
│ │
▼ ▼
SERVER ACTION ERROR
│
▼
APPWRITE

Fig 8.1: Controlled React Hook Form inputs evaluated through centralized Zod schemas, separating valid mutations from instant inline errors.

HORIZONTAL SCROLL ON MOBILE ↔
Patient Onboarding Step 1

UserFormValidation

Validates minimum character length for names, RFC email standards, and E.164 phone formatting.

Keys:name, email, phone
Full Clinical Registration

PatientFormValidation

Enforces birth date parsing, emergency contact relations, insurance policy numbers, file uploads, and mandatory consent flags.

Keys:20+ medical & consent fields
Patient Booking Modal

CreateAppointmentSchema

Ensures valid physician assignment, forward-looking schedule timestamp, and appointment context strings.

Keys:primaryPhysician, schedule, reason
Administrative Confirmation

ScheduleAppointmentSchema

Verifies finalized doctor selection and precise confirmed appointment time for SMS transmission.

Keys:primaryPhysician, schedule, cancellationReason (optional)
Administrative Cancellation

CancelAppointmentSchema

Mandates non-empty justification string (min 2 chars) explaining the cancellation to the patient via SMS.

Keys:cancellationReason (required)

TECHNICAL DECISIONS

Architectural choices were made to optimize developer velocity, data integrity, and server-side security. Each technology selection represents a measured trade-off between infrastructure overhead and operational control.

DECISION 01 • ARCHITECTURAL DECISION

NEXT.JS 14 APP ROUTER

WHY / RATIONALE

Provides modern React component architecture with explicit server and client boundaries, native layout nesting, and file-based routing.Requires disciplined demarcation between server-side data loaders and interactive client components using the 'use client' directive.

TRADE-OFF ACCEPTED

Requires disciplined demarcation between server-side data loaders and interactive client components using the 'use client' directive.

OUTCOME / IMPACT

NEXT.JS 14 APP ROUTER

DECISION 02 • ARCHITECTURAL DECISION

SERVER ACTIONS FOR MUTATIONS

WHY / RATIONALE

Keeps Appwrite SDK mutations and administrative API calls close to the server-side runtime, eliminating custom REST boilerplate and preventing credential leakage.Client components require structured state management (isSubmitting, form pending indicators) when triggering asynchronous mutations.

TRADE-OFF ACCEPTED

Client components require structured state management (isSubmitting, form pending indicators) when triggering asynchronous mutations.

OUTCOME / IMPACT

SERVER ACTIONS FOR MUTATIONS

DECISION 03 • ARCHITECTURAL DECISION

APPWRITE BAAS INTEGRATION

WHY / RATIONALE

Delivers managed user authentication, document collections, encrypted document file storage, and SMS messaging relays without maintaining raw database infrastructure.Application queries and file access patterns are tightly coupled to Appwrite's document modeling conventions and SDK interfaces.

TRADE-OFF ACCEPTED

Application queries and file access patterns are tightly coupled to Appwrite's document modeling conventions and SDK interfaces.

OUTCOME / IMPACT

APPWRITE BAAS INTEGRATION

DECISION 04 • ARCHITECTURAL DECISION

CENTRALIZED ZOD SCHEMAS

WHY / RATIONALE

Guarantees strict runtime validation and automatic TypeScript type inference for complex clinical patient records and polymorphic appointment states.Form schemas must be strictly synchronized as product requirements, clinical fields, and consent rules expand.

TRADE-OFF ACCEPTED

Form schemas must be strictly synchronized as product requirements, clinical fields, and consent rules expand.

OUTCOME / IMPACT

CENTRALIZED ZOD SCHEMAS

DECISION 05 • ARCHITECTURAL DECISION

REACT HOOK FORM + SHADCN/UI

WHY / RATIONALE

Handles 20+ clinical inputs and masked fields without triggering unnecessary global re-renders, offering responsive keyboard navigation and immediate validation feedback.Requires explicit controlled wrappers (FormField, FormControl, FormItem) and integration adapters with the Zod resolver.

TRADE-OFF ACCEPTED

Requires explicit controlled wrappers (FormField, FormControl, FormItem) and integration adapters with the Zod resolver.

OUTCOME / IMPACT

REACT HOOK FORM + SHADCN/UI

FROM INPUT TO PERSISTED DATA

The registration pipeline illustrates the concrete execution path of client data transitioning into persisted cloud records. Input fields are parsed through React Hook Form and validated with Zod before invoking createUser() to initialize the user identity in Appwrite Users. The generated userId routes the patient to full medical profile submission, where document files and structured JSON are saved into Appwrite Storage and Databases in tandem.

Creates an Appwrite user entity, returning a unique $id used to initialize the patient record URL parameter.

Converts client identification images into multipart binary buffers, persists them to the storage bucket, and writes the resulting storage file ID to the patient document.

END-TO-END PATIENT DATA MUTATION PIPELINE
PATIENT INPUT
│
▼
PatientForm
│
▼
React Hook Form
│
▼
Zod Validation
│
▼
createUser()
│
▼
Appwrite Users
│
▼
/patients/[userId]/register
│
▼
PatientForm
│
├───────────────┐
▼ ▼
Patient Data Document
│ Upload
│ │
▼ ▼
Appwrite DB Appwrite Storage

Fig 10.1: Step-by-step data transition: from client-side input through Zod schema evaluation, user identity provisioning, and dual persistence into Appwrite DB and Storage.

HORIZONTAL SCROLL ON MOBILE ↔

STAGE 1: IDENTITY REGISTRATION

Creates an Appwrite user entity, returning a unique $id used to initialize the patient record URL parameter.

Keys:appwrite.users.create()

STAGE 2: ATOMIC MULTIPART STORAGE

Converts client identification images into multipart binary buffers, persists them to the storage bucket, and writes the resulting storage file ID to the patient document.

Keys:appwrite.storage.createFile()

APPOINTMENT DATA FLOW

The appointment mutation engine uses dynamic schema resolution to handle multiple modal actions with zero redundant component definitions. Passing the modal mode (type: "create" | "schedule" | "cancel") into getAppointmentSchema(type) generates the specific Zod validator needed. Submissions fork cleanly to either createAppointment or updateAppointment, persisting state to Appwrite and dispatching SMS updates.

Conditionally marks fields as optional or required based on whether the action is initial creation or administrative cancellation.

Routes execution path between initial record generation (status: "pending") and state changes ("scheduled" or "cancelled").

Dispatches patient updates via Appwrite Messaging / Twilio, communicating confirmed booking slots or cancellation justifications.

POLYMORPHIC APPOINTMENT MUTATION FLOW
AppointmentForm
│
▼
getAppointmentSchema(type)
│
▼
Zod Resolver
│
▼
onSubmit()
│
├───────────────┐
▼ ▼
CREATE UPDATE
│ │
▼ ▼
createAppointment updateAppointment
│ │
└───────┬───────┘
▼
Appwrite Database
│
▼
Appointment State
│
▼
SMS Notification

Fig 11.1: Dynamic schema resolution: modal type switches the Zod schema resolver on the client, dispatching tailored server actions and triggering Twilio SMS updates.

HORIZONTAL SCROLL ON MOBILE ↔

DYNAMIC RESOLVER

Conditionally marks fields as optional or required based on whether the action is initial creation or administrative cancellation.

Keys:getAppointmentSchema(type)

BRANCHED MUTATION

Routes execution path between initial record generation (status: "pending") and state changes ("scheduled" or "cancelled").

Keys:create / update server actions

SMS NOTIFICATION

Dispatches patient updates via Appwrite Messaging / Twilio, communicating confirmed booking slots or cancellation justifications.

Keys:sendSMSNotification()

SYSTEM INTERACTION STATES

Rather than conceptualizing the platform as a distributed state machine, CarePulse models explicit, verified application and user interaction states. Each phase transitions cleanly from initial registration through appointment triage to final notification.

Appointment request created by the patient. The booking awaits administrative triage and scheduling.

Administrator confirms physician assignment, validates calendar availability, and confirms the appointment.

Administrator rejects or revokes the appointment, recording a mandatory justification note in the database.

Patient receives an automated SMS update reflecting the final scheduled appointment time or cancellation reason.

APPLICATION WORKFLOW & APPOINTMENT STATES
PATIENT
│
▼
REGISTERING
│
▼
REGISTERED
│
▼
BOOKING
│
▼
PENDING
│
├───────────────┐
▼ ▼
SCHEDULED CANCELLED
│ │
└───────┬───────┘
▼
NOTIFIED

Fig 12.1: End-to-end user state progression: from initial patient identity and clinical profile registration to administrative scheduling/cancellation and patient SMS notification.

HORIZONTAL SCROLL ON MOBILE ↔
STATE 01

PENDING

Appointment request created by the patient. The booking awaits administrative triage and scheduling.

STATE 02

SCHEDULED

Administrator confirms physician assignment, validates calendar availability, and confirms the appointment.

STATE 03

CANCELLED

Administrator rejects or revokes the appointment, recording a mandatory justification note in the database.

STATE 04

NOTIFIED

Patient receives an automated SMS update reflecting the final scheduled appointment time or cancellation reason.

ADMIN CONTROL FLOW

Administrative operations are managed through an aggregated dashboard protected by a six-digit OTP passkey interface (PasskeyModal.tsx) that stores an encrypted access key in localStorage. Once verified, the dashboard fetches recent appointments using Appwrite Database queries, displays live counter cards for scheduled, pending, and cancelled statuses, and presents an interactive appointment table with inline schedule and cancel modals.

A six-digit PIN dialog verifying administrative authorization. Accurately implemented as a project passkey gate without claiming enterprise identity federation.

Fetches all appointments via getRecentAppointmentList() and tallies counts for scheduledCount, pendingCount, and cancelledCount.

Embeds interactive schedule and cancel actions directly inside appointment rows, opening the polymorphic form with pre-populated patient data.

ADMIN DASHBOARD & APPOINTMENT TRIAGE FLOW
ADMIN ACCESS
│
▼
PASSKEY VERIFICATION
│
▼
ADMIN DASHBOARD
│
├── Scheduled
├── Pending
└── Cancelled
│
▼
APPOINTMENT TABLE
│
┌─────┴─────┐
▼ ▼
SCHEDULE CANCEL
│ │
└─────┬─────┘
▼
SMS NOTIFICATION

Fig 13.1: Passkey-gated administrative flow: passkey challenge unlocks live appointment aggregation, status counters, table management, and SMS update triggers.

HORIZONTAL SCROLL ON MOBILE ↔

PASSKEY GATEWAY

A six-digit PIN dialog verifying administrative authorization. Accurately implemented as a project passkey gate without claiming enterprise identity federation.

Keys:PasskeyModal.tsx

STAT AGGREGATION

Fetches all appointments via getRecentAppointmentList() and tallies counts for scheduledCount, pendingCount, and cancelledCount.

Keys:StatCard.tsx

TABLE MODAL ACTIONS

Embeds interactive schedule and cancel actions directly inside appointment rows, opening the polymorphic form with pre-populated patient data.

Keys:AppointmentModal.tsx

ERROR OBSERVABILITY

Production resilience is maintained via dedicated Sentry integration configured for both server-side actions and client browser boundaries. Successful mutations trigger Next.js cache revalidation (revalidatePath('/admin')) to guarantee instant UI data synchronization, while runtime rejections or Appwrite API failures are captured and forwarded directly to Sentry.

Ensures that administrative actions immediately refresh server-rendered table rows and stat counters without stale cache latency.

Isolates unexpected third-party gateway failures (Twilio or Appwrite quota limits) with contextual request metadata and stack traces.

OBSERVABILITY & CACHE REVALIDATION PIPELINE
USER ACTION
│
▼
SERVER ACTION
│
├───────────────┐
│ │
SUCCESS ERROR
│ │
▼ ▼
REVALIDATE LOG ERROR
│ │
▼ ▼
UPDATED UI SENTRY

Fig 14.1: Branching error path: successful server actions trigger path revalidation for instant UI updates; mutation rejections log structured traces to Sentry.

HORIZONTAL SCROLL ON MOBILE ↔

CACHE INVALIDATION

Ensures that administrative actions immediately refresh server-rendered table rows and stat counters without stale cache latency.

Keys:revalidatePath('/admin')

EXCEPTION TELEMETRY

Isolates unexpected third-party gateway failures (Twilio or Appwrite quota limits) with contextual request metadata and stack traces.

Keys:Sentry.captureException()

MEASURABLE RESULTS

Rather than citing fabricated benchmark numbers, CarePulse is measured by verified implementation evidence: complete architectural coverage across modern technologies, explicit finite state models, centralized validation boundaries, and fully responsive multi-device execution.

8+
CORE TECHNOLOGIES

Next.js 14, TypeScript, Appwrite, Tailwind CSS, shadcn/ui, Twilio, Sentry, and Vercel.

3
APPOINTMENT STATES

Strict finite states: PENDING, SCHEDULED, and CANCELLED with zero ambiguous statuses.

2
PRIMARY USER FLOWS

Patient onboarding/booking portal and administrative appointment management dashboard.

3
VALIDATION BOUNDARIES

User identity layer, full clinical registration layer, and polymorphic appointment layer.

ENGINEERING EVIDENCE

Every architectural claim in this case study is grounded in concrete repository source files. The codebase demonstrates clear modularity, strict separation of concerns, and typed boundaries across server actions, validation schemas, and UI components.

SYSTEM INTEGRATION

CarePulse represents a complete, cohesive full-stack product architecture. From validated onboarding and patient records through appointment state transitions, Appwrite BaaS integration, file vault storage, and automated Twilio SMS dispatches, every component works in synchronized unison without artificial architectural inflation.

CAREPULSE COMPLETE SYSTEM INTEGRATION
CAREPULSE
│
┌────────────┴────────────┐
│ │
PATIENT ADMIN
│ │
▼ ▼
REGISTRATION DASHBOARD
│ │
▼ │
PATIENT DATA │
│ │
└──────────┬──────────────┘
▼
APPOINTMENTS
│
┌─────────┼─────────┐
▼ ▼ ▼
PENDING SCHEDULED CANCELLED
│ │ │
└─────────┼─────────┘
▼
APPWRITE
┌─────────┼─────────┐
▼ ▼ ▼
USERS DATABASE STORAGE
│
▼
DOCUMENTS
+
MESSAGING
│
▼
SMS

Fig 17.1: Comprehensive system synthesis: bridging patient onboarding, administrative triage, finite state appointments, Appwrite BaaS primitives, and real-time SMS messaging.

HORIZONTAL SCROLL ON MOBILE ↔