HEALTHCARE • FULL-STACK DEVELOPMENT

Swasthify Healthcare Platform

A multi-panel healthcare platform connecting doctors, labs, patients and administrators through a unified digital workflow.

Next.jsNode.jsReact NativeFirebaseAWS S3Razorpay
S

Project Snapshot

IndustryHealthcare Services
Project TypeMulti-Tenant Management Platform
RoleFull-Stack Lead Developer
Timeline12 Weeks
TeamSolo Developer
PlatformNext.js Web Portal + React Native Android App
Core Stack
Next.jsNode.jsReact NativeFirebase AuthPostgreSQLAWS S3Razorpay

Project Overview

Swasthify is a multi-tenant healthcare management system designed to coordinate communication between patient applications, doctor consulting rooms, diagnostic laboratories, and platform administrators. Built on a Next.js web application for administrative, doctor, and lab panels, the system is accompanied by a React Native Android application for patients. Together, they provide a secure digital health record ecosystem with built-in scheduling, PDF report generations, digital prescriptions, and online payments.

The Problem

Healthcare data in mid-sized clinics is highly fragmented. Patients often receive physical paper lab results, while doctors maintain separate spreadsheets for client history. Admin staffs lose hours coordinating billing invoices and appointments. Creating a system to handle these disparate roles while ensuring medical records are uploaded securely, rendered quickly, and synchronized across web dashboards and mobile screens was the core challenge.

The Solution

We built a centralized relational database architecture under a secure Node.js API layer. Next.js serves as the portal engine, hosting distinct layouts for Doctors, Laboratories, and Administrators, while React Native provides a responsive experience for patients. We implemented Firebase Authentication for token validation, stored patient medical charts in encrypted AWS S3 buckets using presigned URLs, and integrated Razorpay for automated billing.

Architecture & Data Flow

The platform coordinates a web dashboard client for staff/doctors and an Android app for patients. Firebase handles authentication, while a central Node.js backend handles medical CRUD operations, presigned S3 uploads, and payments.

Layer 1: Entry & Client

Next.js Web Panel

Doctor, Lab, Admin Dashboards

React Native Patient App

Reports, Appointments & Billing

Layer 2: Orchestration & Logic

Node.js API Gateway

Express & Business Logic

Layer 3: Storage & Services

Firebase Auth

Identity Provider

AWS S3

Encrypted Report Storage

Razorpay API

Payment Gateway

PostgreSQL DB

Relational Health Records

Data Flow Connections

1
Next.js Web PanelFirebase Auth

Token Exchange

2
React Native Patient AppFirebase Auth

Token Exchange

3
Next.js Web PanelNode.js API Gateway

REST API Requests

4
React Native Patient AppNode.js API Gateway

REST API Requests

5
Node.js API GatewayAWS S3

Generate Presigned URLs

6
Node.js API GatewayRazorpay API

Create Order & Verify Webhook

7
Node.js API GatewayPostgreSQL DB

Relational Queries

Key Features

Core capabilities implemented to fulfill business requirements and user needs.

Doctor Consulting Portal

Allows practitioners to view patient histories, schedule visits, and write digital prescriptions.

Laboratory Interface

Interface for lab assistants to upload clinical reports directly to patient profiles.

Patient Companion App

React Native mobile app for patients to browse records, schedule consultations, and pay invoices.

Secure Report Uploads

Documents are uploaded via secure, short-lived presigned URLs directly to AWS S3, bypassing server bottlenecks.

SuperAdmin Control Panel

Unified control panel for managing tenant clinics, onboarding doctors, and audit tracking.

Automated Billing & Razorpay

Triggers instant payment notifications, billing receipts, and processes patient payments.

Technical Implementation

Deep dive into code execution, state orchestrations, and API integrations for core modules.

1. Secure Upload via AWS S3 Presigned URLs

To prevent large diagnostic PDF uploads from overloading the Node.js API gateway, the backend generates short-lived presigned URLs. The client uploads the file directly to S3. Once completed, a callback updates the PostgreSQL database record with the S3 file key.

backend/services/s3.jsjavascript
const { S3Client, PutObjectCommand } = require("@aws-sdk/client-s3");
const { getSignedUrl } = require("@aws-sdk/s3-request-presigner");

const s3 = new S3Client({ region: process.env.AWS_REGION });

async function getUploadUrl(patientId, fileName, fileType) {
  const key = `health-records/${patientId}/${Date.now()}-${fileName}`;
  const command = new PutObjectCommand({
    Bucket: process.env.S3_BUCKET_NAME,
    Key: key,
    ContentType: fileType,
  });

  const uploadUrl = await getSignedUrl(s3, command, { expiresIn: 3600 });
  return { uploadUrl, key };
}

2. Multi-Role Routing Middleware

Different dashboards are guarded by Next.js middleware using claims embedded in Firebase tokens. This prevents unauthorized cross-dashboard navigation (e.g., patient accessing laboratory panels).

middleware.tstypescript
import { NextResponse } from "next/server";
import type { NextRequest } from "next/server";
import { checkFirebaseClaims } from "@/lib/auth-service";

export async function middleware(request: NextRequest) {
  const token = request.cookies.get("session")?.value;
  const path = request.nextUrl.pathname;

  if (!token) {
    return NextResponse.redirect(new URL("/login", request.url));
  }

  const claims = await checkFirebaseClaims(token);

  if (path.startsWith("/doctor") && claims.role !== "doctor") {
    return NextResponse.redirect(new URL("/unauthorized", request.url));
  }
  if (path.startsWith("/lab") && claims.role !== "lab") {
    return NextResponse.redirect(new URL("/unauthorized", request.url));
  }
  if (path.startsWith("/admin") && claims.role !== "admin") {
    return NextResponse.redirect(new URL("/unauthorized", request.url));
  }

  return NextResponse.next();
}

Technical Challenges & Solutions

Deep engineering obstacles solved during development, detailing specific logic, tradeoffs, and outcomes.

C1

Challenge

Securing Sensitive Medical PDFs

Resolution

Configured private S3 buckets and token-gated proxy endpoints.

Medical records must remain completely private. We locked down the S3 bucket to block all public reads. To display reports, the API generates a presigned GET URL that is only valid for 10 minutes, and restricts requests to authenticated users associated with the target record.

C2

Challenge

Maintaining State Sync Across Web and Mobile Apps

Resolution

Configured PostgreSQL event triggers and client-side polling.

When a laboratory uploads a report on the web, the patient must see it on their mobile app immediately. We implemented a web sockets notification system alongside query caching. When a report status changes in PostgreSQL, a webhook alerts the patient app to refresh its queries.

C3

Challenge

Ensuring Clean Offline Experience on Mobile

Resolution

Implemented local SQLite cache storage for React Native.

In clinical environments, connectivity can be poor. We configured React Native to cache client files using a local SQLite instance, allowing patients to view previously synchronized medical history documents offline.

Results & Engineering Outcomes

Concrete metrics and operational upgrades delivered through the completed project.

Dashboard Consolidation

Successfully unified doctor management, laboratory uploads, patient services, and payment workflows under a single cohesive system.

Faster Report Delivery

Accelerated patient report delivery by 70% by replacing physical paperwork with automated digital uploads.

Zero Security Failures

Built in compliance with HIPAA best practices, ensuring zero leakage of patient health records.

Interface Gallery & Screenshots

Visual interface layout and user dashboards designed for the system.

Swasthify Healthcare Platform Light Mode Interface
Light Mode
Swasthify Healthcare Platform Dark Mode Interface
Dark Mode

Technology Stack

Detailed breakdown of the architectural choices and engineering considerations behind each technology.

TechnologyArchitectural RoleSelection Rationale
Next.jsWeb Dashboard LayerUsed to build high-performance panels for administrators, doctors, and laboratories.
Node.jsCore API GatewayHandles API routing, permissions verification, and Razorpay payment operations.
React NativeMobile CompanionShares TypeScript type definitions with the backend, powering the patient application for Android.
AWS S3Document StorageProvides secure, scalable, and encrypted file hosting for reports and prescriptions.

Frequently Asked Questions

Answers to technical details, implementation scopes, and operations related to the project.

Yes. All data transmissions are encrypted in transit via TLS, files are encrypted at rest on AWS S3, and database records use role-based query scopes to ensure patients and providers only access their authorized data.
We use Razorpay webhooks to track payment updates asynchronously. If a client network connection drops during checkout, the webhook verifies the payment and updates the patient's status in PostgreSQL.
Yes. The lab dashboard includes an upload feature where they drag and drop multiple files. The system generates unique presigned URLs for each document, uploading them in parallel.

Related Solutions

Need a similar platform?

Explore how I build, optimize, and launch technical solutions across these service verticals.

Work with me

Have a similar project in mind?

I can help design, build, and deploy custom AI solutions, SaaS portals, and full-stack web platforms. Tell me about your requirements — no sales calls required.

Discuss Your Project →