A comprehensive backend system for managing hospital/educational institution operations including admissions, examinations, faculty management, fee processing, grievance handling, leave management, student records, and thesis tracking.
- Node.js/TypeScript
- PostgreSQL (Database)
- Redis (Caching)
- AWS S3 (File Storage)
- SendGrid (Email Service)
- Express.js (Web Framework)
- TypeORM (ORM)
- Handlebars (Email Templates)
Before setting up the project, ensure you have the following installed:
-
Node.js
- Download Node.js LTS from nodejs.org
- Install and verify with:
node --version npm --version
-
PostgreSQL
- Download from postgresql.org
- Run installer (remember your password)
- Add PostgreSQL bin to PATH if not done automatically
-
Redis
- Install Windows Subsystem for Linux (WSL2)
- Open WSL terminal and run:
sudo apt-get update sudo apt-get install redis-server sudo service redis-server start
-
Git
- Download from git-scm.com
- Run installer with default options
-
Node.js
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - sudo apt-get install -y nodejs
-
PostgreSQL
sudo apt-get install postgresql postgresql-contrib
-
Redis
sudo apt-get install redis-server sudo systemctl enable redis-server.service
-
Clone the repository
git clone <repository-url> cd Hospital-Information-System
-
Install dependencies
npm install
-
Environment Setup Create a
.env
file in the root directory:PORT=3000 NODE_ENV=development DB_HOST=localhost DB_PORT=5432 DB_USERNAME=your_username DB_PASSWORD=your_password DB_NAME=hospital_system REDIS_URL=redis://localhost:6379 AWS_ACCESS_KEY_ID=your_aws_key AWS_SECRET_ACCESS_KEY=your_aws_secret AWS_REGION=your_region AWS_S3_BUCKET=your_bucket SENDGRID_API_KEY=your_sendgrid_key JWT_SECRET=your_jwt_secret
-
Database Setup
CREATE DATABASE hospital_system; CREATE DATABASE hospital_system_test;
-
Run Migrations
npm run migrate
-
Setup Test Environment Create a
.env.test
file:PORT=3001 NODE_ENV=test DB_HOST=localhost DB_PORT=5432 DB_USERNAME=your_username DB_PASSWORD=your_password DB_NAME=hospital_system_test REDIS_URL=redis://localhost:6379 AWS_ACCESS_KEY_ID=your_aws_key AWS_SECRET_ACCESS_KEY=your_aws_secret AWS_REGION=your_region AWS_S3_BUCKET=your_test_bucket SENDGRID_API_KEY=your_sendgrid_key JWT_SECRET=test_secret
-
Run Test Migrations
npm run migrate:test
-
Execute Tests
npm test # Run all tests npm run test:watch # Run tests in watch mode
src/
├── app.ts # Express app setup
├── server.ts # Server entry point
├── config/ # Configuration files
├── controllers/ # Route controllers
├── db/ # Database configuration
├── middlewares/ # Express middlewares
├── models/ # TypeORM entities
├── routes/ # API routes
├── services/ # Business logic
├── templates/ # Email templates
├── tests/ # Test files
├── types/ # TypeScript types
└── utils/ # Utility functions
-
Authentication
- User registration
- Login
- Password reset
-
Student Management
- Student profiles
- Academic records
- Course enrollment
-
Faculty Management
- Faculty profiles
- Course assignments
- Schedule management
-
Examination System
- Exam scheduling
- Result management
- Grade processing
-
Fee Management
- Fee structure
- Payment processing
- Payment history
-
Grievance System
- Submit grievances
- Track status
- Resolution management
-
Leave Management
- Apply for leave
- Approval workflow
- Leave balance tracking
-
Thesis Management
- Thesis submission
- Review process
- Status tracking
-
Admission Management
- Application processing
- Document verification
- Admission status
-
Audit System
- Activity logging
- User tracking
- System monitoring
Development mode:
npm run dev
Production mode:
npm run build
npm start
Verify system health:
curl http://localhost:3000/api/health
-
Database Connection Issues
- Verify PostgreSQL is running
- Check database credentials
- Ensure database exists
-
Redis Connection Issues
- Verify Redis server is running
- Check Redis connection URL
- For Windows: Ensure WSL is running
-
Email Service Issues
- Validate SendGrid API key
- Check email templates
- Verify sender email configuration
-
File Upload Issues
- Check AWS credentials
- Verify S3 bucket permissions
- Ensure proper file size limits
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.