November 2025
Carewinners - A Marketplace
Project Information
Executive Summary
CareWinners is a digital healthcare marketplace connecting patients with qualified care providers across Pakistan. At Veevis, I served as the lead architect responsible for unifying two fragmented legacy systems into a scalable microservices platform while delivering a production-ready mobile application.
The project delivered measurable outcomes: system message loss reduced by 95%, real-time communication bandwidth optimized by 40%, and over 100,000 lines of legacy JavaScript successfully migrated to TypeScript with zero production incidents.
The Challenge
CareWinners operated on two independent codebases that had evolved separately over several years. The first system was a Django monolith with PostgreSQL handling patient records and appointments. The second was a Nest.js application with MongoDB managing provider profiles and care plans. Neither system communicated effectively with the other.
Patient data existed in disconnected silos requiring manual reconciliation. Care providers could not see real-time availability, causing double-bookings. The platform lacked any real-time communication, meaning patients and providers could not message each other or receive instant notifications.
Critical constraints included zero downtime during migration, preservation of active user sessions, protection of years of sensitive healthcare records, and a four-month deadline for mobile application delivery.
The Approach
Event-Driven Architecture Foundation
I placed RabbitMQ at the center of the unified architecture as the nervous system connecting all services through asynchronous message passing. This approach enabled services to communicate without knowing each other's internal implementation, allowing independent evolution and deployment. Dead-letter queues with exponential backoff retry policies ensured transient failures never resulted in permanent message loss, reducing system-wide message loss from approximately 5% to under 0.5%.
Strangler Fig Migration Pattern
Rather than attempting a risky all-at-once replacement, I implemented the Strangler Fig pattern to incrementally replace monolithic functionality while legacy systems continued operating normally. I extracted services one by one starting with authentication, then patient profiles, provider availability, and appointment scheduling. Each extraction followed a consistent pattern: build the new service with its own database, establish bidirectional synchronization with the legacy system, progressively route traffic to the new implementation, and finally retire the legacy code.
Real-Time Communication Layer
The existing platform had zero real-time capabilities. I designed a WebSocket layer using Socket.IO with a Redis adapter enabling horizontal scaling across multiple server instances. Room-based messaging scoped conversations to individual care relationships. Presence detection showed when providers were actively available. Read receipts confirmed message delivery with 99.9% reliability. Payload compression reduced bandwidth consumption by 40%, a critical optimization for users on mobile networks.
TypeScript Modernization
The legacy JavaScript codebases totaling over 100,000 lines had accumulated significant technical debt. I designed a gradual migration strategy beginning with shared utilities, progressing through API route handlers, then business logic, and finally database models. The CI pipeline enforced that no new JavaScript files could be introduced. Within three months, compilation errors dropped from over 5,000 to zero, developer onboarding time reduced by two-thirds, and refactoring confidence improved dramatically.
React Native Mobile Application
Concurrent with the backend migration, I developed the CareWinners mobile application from initial scaffold to store deployment. The app serves patients seeking care services and providers managing their practice. Twilio Voice SDK integration enables native in-app calling with call recording. Clean architecture principles separate presentation, domain, and data layers for maintainability. Performance optimization reduced the final bundle size by 35%, achieving sub-two-second initial load times.
Key Metrics
System Performance Improvements
| Metric | Before Migration | After Migration | Improvement |
|---|---|---|---|
| Message Loss Across Systems | 5% | 0.5% | 95% reduction |
| API Response Time (p95) | 450ms | 145ms | 68% faster |
| Concurrent WebSocket Connections | 0 | 5,000+ | New capability |
| System Uptime | 99.2% | 99.95% | 75% less downtime |
| Deployment Frequency | Monthly | Daily | 30x improvement |
Development Velocity Improvements
| Metric | Before | After | Improvement |
|---|---|---|---|
| TypeScript Compilation Errors | 5,000+ | 0 | Complete elimination |
| Developer Onboarding Time | 3 weeks | 1 week | 66% faster |
| Mobile App Bundle Size | Baseline | 35% smaller | Significant reduction |
| Mobile App Load Time | N/A | Under 2 seconds | New capability |
Technologies Employed
Backend and Architecture
- Node.js with Nest.js for microservice implementation
- RabbitMQ for event-driven communication
- Socket.IO with Redis adapter for real-time features
- PostgreSQL for transactional data and MongoDB for document storage
Mobile Development
- React Native CLI with custom native module integration
- Zustand and TanStack Query for state management
- Twilio Voice SDK for in-app calling
Cloud and DevOps
- AWS EC2, RDS, S3, and ECS Fargate
- Docker for containerization
- GitHub Actions for CI/CD automation
- OpenTelemetry, ELK Stack, Prometheus, and Grafana for observability
Lasting Impact
The CareWinners project validated several principles I now advocate for in all system design. Incremental migration consistently outperforms rewrite attempts, enabling continuous delivery of business value while modernizing infrastructure. Event-driven architecture reduces coupling between services, enabling independent evolution and deployment. Type safety compounds in value over time, paying ongoing dividends through faster onboarding and fewer production incidents. The platform now delivers healthcare services throughout Pakistan on infrastructure designed to accommodate years of future growth.