"What gets measured, gets managed."
"Your Health, In Sync."
SwasthyaSync is a privacy-first, all-in-one personal health operating system. It is a living ecosystem where individuals can track, store, analyze, and share every dimension of their health — from daily vitals and hydration to medical documents, doctor visits, nutrition, and metabolic trends.
- India-First, World-Ready: Culturally-aware tracking for Indian diets, regional cuisines, and Ayurvedic wisdom.
- Privacy as a Feature: Temporary access links, audit logs, and encrypted storage. Your data stays yours.
- Hexagonal Engine: Built on a high-maturity enterprise architecture (Ports & Adapters) for maximum scalability and testability.
- Unified Pulse: Aggregating fitness, medical, and wellness data into a single, intelligent dashboard.
SwasthyaSync follows a strict Hexagonal (Ports & Adapters) Architecture with Dependency Inversion (DIP) and Domain-Driven Design (DDD) principles.
The absolute core. Contains logic that doesn't change when technology does.
- Entities: Pure TypeScript Interfaces (e.g.,
Metric.ts). - Interfaces: Port contracts for repositories.
- Events: Domain-meaningful state changes (e.g.,
MetricLoggedEvent.ts).
Orchestrates business logic through Use Cases.
- Use Cases: Atomic business actions (e.g.,
LogMetricUseCase.ts). - DTOs: The only objects allowed to leave the Application boundary.
- Mappers: Translators (ACL) between Entities and DTOs.
- Validators: Zod-based entry validation.
The "Adapters" that connect the domain to the outside world.
- Repositories: Drizzle ORM implementations for PostgreSQL.
- Adapters: External systems like BullMQ (background jobs) and Redis.
The Brain of each module. It instantiates infrastructure, wires them into Use Cases, and subscribes side-effects (BullMQ/Analytics) to Domain Events.
| Layer | Technology |
|---|---|
| Framework | Next.js 15 (App Router) |
| Language | TypeScript (Strict Mode) |
| API | tRPC (End-to-end typesafe API) |
| Database | PostgreSQL + Drizzle ORM |
| Auth | Better Auth / Supabase Auth |
| Background Jobs | BullMQ + Redis |
| Validation | Zod |
| Styling | Tailwind CSS v4 + Vanilla CSS |
| Icons | Lucide React + React Icons |
Track key metrics like Height, Weight, Blood Group, and BMI. Data is processed through the hexagonal pipeline with background job triggers for AI analysis.
- Workout Logging: Sets, reps, RPE, and duration tracking.
- Nutrition: Meal logging with macro/micro-nutrient breakdown.
- Metabolic Engine: Adaptive TDEE calculation based on weight trends and calorie intake.
- Document Management: Store prescriptions, lab reports, and X-rays.
- Doctor Meetups: Schedule and track appointments with specialty-based filtering.
- Vault Search: Tag-based search and filtering for all medical records.
- Hydration Tracker: Multi-beverage tracking with daily goals.
- Sleep Logs: Track duration and quality scores.
- Fasting: Intermittent fasting timer and history.
- Unified Pulse: A master dashboard aggregating data from all repositories in parallel.
src/
├── app/ # Next.js App Router (UI Layer)
├── components/ # Shared UI components
├── lib/ # Shared utilities (DB, Events, Auth)
│ ├── db/ # Drizzle schema & client
│ └── events/ # Internal EventBus implementation
├── modules/ # Hexagonal Feature Modules
│ ├── health/ # Health metrics module
│ ├── fitness/ # Fitness, Nutrition, & Metabolic module
│ └── medical/ # Appointments & Vault module
│ ├── domain/ # Entities & Repository Interfaces
│ ├── application/ # Use Cases, DTOs, & Mappers
│ ├── infrastructure/# Drizzle Repos & Adapters
│ └── *.composition.ts # Module wiring
└── server/ # tRPC router definitions
Detailed architectural diagrams are available in the /diagram directory:
- ER Diagram: Database schema and relationships.
- Class Diagram: Hexagonal architecture and class relationships.
- Sequence Diagrams: Runtime flows for key operations.
- Use Case Diagram: Actor-feature interactions.
- Node.js 20+
- PostgreSQL
- Redis (for BullMQ)
git clone https://github.com/DikshantJangra/SwasthyaSync.git
cd SwasthyaSync
npm installCreate a .env file based on .env.example:
DATABASE_URL=postgresql://...
REDIS_URL=redis://...
BETTER_AUTH_SECRET=...npx drizzle-kit pushnpm run dev- Phase 1: Foundation Hardening (Next.js migration, Zod validation).
- Phase 2: Indian-First Calorie Tracker (Regional cuisines, Thali builder).
- Phase 3: Activity & Yoga Integration.
- Phase 4: Prescription OCR & Medicine Reminders.
- Phase 5: Family Health Hub & Caregiver Mode.
- Phase 6: Doctor Portal with Temporary Access Links.
- Phase 7: AI Health Intelligence (Trend prediction, anomaly detection).
"We're not building another health app. We're building a health revolution — one sync at a time." 🚀