A web-based telemedicine platform built with MoonBit, leveraging WebAssembly (WASM) for high performance and AI-native features for intelligent health data processing. The dashboard enables real-time video/chat communication, health data visualization, appointment management, and AI-driven insights for patients and healthcare providers.
- Features
- Tech Stack
- Prerequisites
- Installation
- Usage
- Project Structure
- API Endpoints
- Running the Application
- Contributing
- License
- Contact
- Real-Time Communication: Video calls and text chat via WebRTC and WebSocket (using JavaScript interop).
- Health Data Visualization: Real-time charts for patient vitals (e.g., heart rate, blood pressure) with anomaly detection.
- Appointment Management: Schedule, manage, and send reminders for patient appointments.
- AI-Driven Insights: Automated patient data summaries and anomaly detection using MoonBit's AI assistant and torch library.
- Secure Data Handling: Encrypted data transmission and storage, with type-safe data validation using MoonBit's type system.
- Cross-Platform: Runs in browsers via WASM and supports mobile devices through responsive design.
- MoonBit: Core language for backend and frontend logic, compiled to WASM for performance.
- WebAssembly (WASM): Ensures fast, secure, and lightweight execution in browsers.
- JavaScript Interop: Integrates WebRTC (video), Chart.js (visualization), and database access.
- MoonBit Libraries: http, http_router for REST APIs, async for non-blocking operations, torch for ML-based anomaly detection.
- Frontend: Chart.js for data visualization, with potential React integration via JavaScript interop.
- Backend: WASM-compatible serverless platforms (e.g., Cloudflare Workers) or traditional servers.
- MoonBit CLI: Install the MoonBit compiler and toolchain (see MoonBit Docs).
- Node.js: For JavaScript interop and frontend dependencies (version 16+ recommended).
- WASM Runtime: A WASM-compatible environment (e.g., browser or serverless platform).
- Optional: Database (e.g., PostgreSQL) for persistent storage, accessed via JavaScript interop.
-
Clone the Repository:
git clone https://github.com/SHA888/TMDash.git cd TMDash -
Install MoonBit CLI:
- Follow instructions at MoonBit Docs.
- Alternatively, use the cloud IDE at try.moonbitlang.com for no-install setup.
-
Install Node.js Dependencies:
npm install
This installs Chart.js, WebRTC libraries, and other JavaScript dependencies.
-
Set Up Environment Variables: Create a
.envfile in the root directory:PORT=8080 DATABASE_URL=your-database-url
-
Run the Development Server:
moon run
Starts the MoonBit HTTP server on http://localhost:8080.
-
Access the Dashboard: Open http://localhost:8080 in a browser to view the dashboard.
-
Interact with Features:
- Video/Chat: Start a consultation via the video or chat interface (requires WebRTC setup).
- Vitals: Submit health data via the
/vitalsendpoint and view charts. - Appointments: Schedule or manage appointments through the dashboard UI.
- AI Insights: View AI-generated summaries or alerts in the doctor's panel.
TMDash/
├── src/
│ ├── main.mbt # Entry point for the HTTP server
│ ├── models/ # Data models (e.g., PatientData, Vital)
│ │ ├── vitals.mbt
│ │ ├── appointments.mbt
│ ├── routes/ # API route handlers
│ │ ├── vitals.mbt
│ │ ├── appointments.mbt
│ ├── ai/ # AI-driven logic (e.g., anomaly detection)
│ │ ├── anomaly.mbt
│ ├── frontend/ # WASM-based frontend code
│ │ ├── dashboard.mbt
│ ├── docs/ # Markdown-oriented docs (.mbt.md)
│ │ ├── patient-reports.mbt.md
├── public/ # Static assets (HTML, CSS, JS for interop)
├── moon.pkg.json # MoonBit package configuration
├── package.json # Node.js dependencies for JavaScript interop
├── README.md # Project documentation
└── .env # Environment variables
| Endpoint | Method | Description |
|---|---|---|
/vitals |
POST | Submit patient vitals (e.g., heart rate) |
/vitals/:patient_id |
GET | Retrieve vitals history for a patient |
/appointments |
POST | Schedule a new appointment |
/appointments/:id |
GET | Get appointment details |
/chat |
WS | WebSocket for real-time chat |
curl -X POST http://localhost:8080/vitals \
-H "Content-Type: application/json" \
-d '{"patient_id": "123", "vital": {"HeartRate": 85}, "timestamp": "2025-06-05T12:00:00Z"}'{
"status": "Normal",
"value": 85
}moon runCompiles and runs the MoonBit server with hot reloading.
- Compile to WASM:
moon build --target wasm
- Deploy to a WASM-compatible platform (e.g., Cloudflare Workers) or a Node.js server with WASM runtime.
- Ensure HTTPS for secure data transmission.
moon testRuns unit tests for API endpoints and AI logic.
We welcome contributions! Follow these steps:
- Fork the repository.
- Create a feature branch:
git checkout -b feature/your-feature. - Commit changes:
git commit -m "Add your feature". - Push to the branch:
git push origin feature/your-feature. - Open a pull request.
Please adhere to the Code of Conduct and include tests for new features.
This project is licensed under the MIT License. See the LICENSE file for details.
- Project Maintainer: Kresna Sucandra on X @ks_sha888
Built with MoonBit for performance and scalability. Start exploring at try.moonbitlang.com!