How himanshukaswa7/carepulse works
Project Type and Purpose
• CarePulse is a full-stack healthcare management web application.
• Frontend: Next.js (app directory) with React/TypeScript, Tailwind CSS, ShadCN UI.
• Backend: Appwrite (BaaS) for authentication, database, functions.
• Integrations: Twilio for SMS notifications, Sentry for monitoring.
Main Components
a. Frontend Application
• Next.js app folder (app/layout.tsx, pages, React components in components/)
• UI library (ShadCN UI under components/ui)
• Data-entry components (forms, modals, tables)
b. Backend Services (Appwrite)
• Authentication (users/patients)
• Database service (collections for Patients, Appointments)
• Functions (if any custom serverless functions)
c. API Routes
• Next.js Route Handler at app/api/sentry-example-api/route.ts
• Any wrapper around Appwrite SDK calls (lib/actions/*.ts)
d. External Services
• Twilio (via lib/actions/appointment.action.ts)
• Sentry (client/server/edge config files)
e. Hosting / CDN
• Vercel (deployment)
• Public assets folder (public/assets/…)
Relationships & Data Flows
• User ↔ Frontend: Browses pages, submits registration or appointment forms.
• Frontend → Appwrite SDK (lib/actions):
• Patient registration → Appwrite Auth & Database collection “patients”.
• Appointment booking → Appwrite Database collection “appointments”.
• Backend → Twilio API: On appointment creation, send SMS.
• Frontend & API Routes → Sentry: Error logging & performance monitoring.
Architectural Patterns & Design Principles
• Server-Side Rendering & API Routes (Next.js 13 app directory).
• Component-driven UI (ShadCN + Tailwind).
• Service-oriented backend via Appwrite (BaaS).
• Separation of concerns: UI components vs. SDK actions vs. configuration.
• Externalization of configurations (appwrite.config.ts, .env.local).
• Entities:
1. Patient
• patient_id (PK)
• name, email, phone, created_at
2. Appointment
• appointment_id (PK)
• patient_id (FK → Patient.patient_id)
• datetime, status (confirmed/pending/canceled), created_at
• Relationships:
• One-to-Many: Patient → Appointment
• Attributes & Keys: Clearly label PK (underline) and FK.