A microservices-based medical management application built with Node.js, TypeScript, and PostgreSQL.
MedHub is a healthcare management platform built with a microservices architecture. The system is designed to handle user authentication, administrative functions, and email communications for medical facilities.
MedHub follows a microservices architecture with three main services:
- Users Service - Authentication and user management
- Admin Service - Administrative functions and facility management
- Email Service - Communication and notification system
- Backend: Node.js with TypeScript
- Database: PostgreSQL with Prisma ORM
- Message Queue: RabbitMQ for inter-service communication
- Authentication: JWT tokens
- Email: Resend for email notifications
- Validation: Zod for schema validation
- User registration and login
- JWT-based authentication
- Password recovery system
- Account verification
- Profile management
- User profile creation and updates
- Account deletion
- Token refresh mechanism
- Email service integration
- Notification system via RabbitMQ
- Administrative dashboard
- Facility management
- User oversight and control
- Node.js (v18 or higher)
- PostgreSQL database
- RabbitMQ server
- npm or yarn
git clone <repository-url>
cd MedHubCreate .env files for each service:
DATABASE_URL="postgresql://username:password@localhost:5432/medhub_users"
JWT_SECRET="your-jwt-secret"
JWT_REFRESH_SECRET="your-refresh-secret"
RABBITMQ_URL="amqp://localhost:5672"DATABASE_URL="postgresql://username:password@localhost:5432/medhub_admin"
RABBITMQ_URL="amqp://localhost:5672"RABBITMQ_URL="amqp://localhost:5672"
RESEND_API_KEY="your-resend-api-key"# Install dependencies for all services
cd services/users && npm install
cd ../admin && npm install
cd ../email && npm install# Run migrations for each service
cd services/users && npm run migrate:dev
cd ../admin && npm run migrate:dev
cd ../email && npm run migrate:dev# Start all services in separate terminals
# Terminal 1 - Users Service
cd services/users && npm run dev
# Terminal 2 - Admin Service
cd services/admin && npm run dev
# Terminal 3 - Email Service
cd services/email && npm run devPOST /api/signup # User registration
POST /api/login # User login
GET /api/logout # User logout
GET /api/get-me # Get current user
POST /api/refresh-token # Refresh access token
POST /api/verify-account # Verify account
POST /api/forgot-password # Password recovery
POST /api/reset-password # Verify password reset code
PUT /api/change-password # Change password
POST /api/delete-account # Delete account
PUT /api/update-profile # Update profilePOST /api/doctors # Create new doctor profilePOST /api/appointments # Create new appointment slot
POST /api/book-appointments # Book appointment for patient# Email service endpoints for notifications
# Account verification emails
# Password reset notifications
# Appointment reminders
# (Implementation in progress)Services communicate through RabbitMQ message queue for:
- Email notifications
- Inter-service messaging
- Event-driven architecture
MedHub/
βββ services/
β βββ users/ # Authentication & User Management
β β βββ src/
β β β βββ controllers/ # Request handlers
β β β βββ middlewares/ # Express middlewares
β β β βββ routes/ # API routes
β β β β βββ v1/ # Version 1 routes
β β β β β βββ signup-route.ts
β β β β β βββ login-route.ts
β β β β β βββ logout-route.ts
β β β β β βββ get-me-route.ts
β β β β β βββ refresh-token-route.ts
β β β β β βββ verify-account-route.ts
β β β β β βββ forgot-password-route.ts
β β β β β βββ verify-forgot-password-code-route.ts
β β β β β βββ change-password-route.ts
β β β β β βββ delete-account.ts
β β β β β βββ update-profile-route.ts
β β β β β βββ index.ts
β β β β βββ index.ts
β β β βββ services/ # Business logic
β β β βββ utils/ # Utility functions
β β β βββ repo/ # Repository layer
β β β βββ schema/ # Validation schemas
β β β βββ generated/ # Generated files
β β β βββ prisma.ts # Prisma client
β β β βββ index.ts # Service entry point
β β βββ prisma/ # Database schema & migrations
β β β βββ schema.prisma # Database schema
β β β βββ migrations/ # Database migrations
β β βββ package.json # Dependencies
β β βββ tsconfig.json # TypeScript config
β β βββ .gitignore
β βββ admin/ # Administrative Functions
β β βββ src/
β β β βββ controllers/ # Admin request handlers
β β β βββ middlewares/ # Admin middlewares
β β β βββ routes/ # Admin API routes
β β β β βββ v1/ # Version 1 admin routes
β β β β β βββ create-doctor-route.ts
β β β β β βββ create-appointment-route.ts
β β β β β βββ book-appointment-route.ts
β β β β β βββ index.ts
β β β β βββ index.ts
β β β βββ services/ # Admin business logic
β β β βββ utils/ # Admin utilities
β β β βββ repo/ # Admin repository layer
β β β βββ schema/ # Admin validation schemas
β β β βββ generated/ # Generated admin files
β β β βββ prisma.ts # Admin Prisma client
β β β βββ index.ts # Admin service entry point
β β βββ prisma/ # Admin database schema
β β β βββ schema.prisma # Admin database schema
β β β βββ migrations/ # Admin migrations
β β βββ package.json # Admin dependencies
β β βββ tsconfig.json # Admin TypeScript config
β β βββ .gitignore
β βββ email/ # Email Communication
β βββ src/
β β βββ controllers/ # Email request handlers
β β βββ middlewares/ # Email middlewares
β β βββ routes/ # Email API routes
β β β βββ v1/ # Version 1 email routes
β β β βββ index.ts
β β βββ services/ # Email business logic
β β βββ utils/ # Email utilities
β β βββ repo/ # Email repository layer
β β βββ schema/ # Email validation schemas
β β βββ generated/ # Generated email files
β β βββ prisma.ts # Email Prisma client
β β βββ index.ts # Email service entry point
β βββ prisma/ # Email database schema
β β βββ schema.prisma # Email database schema
β β βββ migrations/ # Email migrations
β βββ tests/ # Email service tests
β βββ package.json # Email dependencies
β βββ tsconfig.json # Email TypeScript config
β βββ .gitignore
βββ README.md # This file
βββ .gitignore # Git ignore rules
This project is licensed under the ISC License - see the LICENSE file for details.
Mohammad Arkan
- Microservices architecture setup
- User authentication system
- Database schema with Prisma
- Email service integration
- RabbitMQ message queue setup
- Basic API endpoints for user management
- Admin service structure
- Email service structure
- User management and oversight
- Facility administration
- System configuration
- Role and permission management
- Administrative dashboard
- Facility analytics and reporting
- Account verification emails
- Password reset notifications
- Appointment confirmations
- Reminder notifications
- System announcements
- Custom email templates
This project is now complete and no further contributions will be accepted.
The MedHub medical management system has been fully implemented with all core features and services. The microservices architecture is complete with user authentication, administrative functions, and email communication systems. All planned features have been delivered and the project is considered finished.
For support and questions:
- Create an issue in the repository
- Contact with me via this email => mdarkanurl@gmail.com
- Check the code and try to resolve the problem you face or email me
MedHub - Building the future of healthcare management.