Skip to main content

Getting Started for Hospital IT Teams

This comprehensive guide will help IT administrators set up, configure, and maintain the Medfeed Medical Feedback AI platform.

System Overview​

Medfeed consists of two main components:

  • Backend API (bl-engine): Node.js/TypeScript server with Express.js
  • Frontend App: Next.js React application with TypeScript

Prerequisites​

System Requirements​

  • Node.js: v22.14.0 (backend) / v18+ (frontend)
  • Database: MongoDB 6.x
  • Cache: Redis 5.x+
  • Storage: AWS S3 (for file uploads)
  • Memory: 4GB RAM minimum, 8GB recommended
  • Storage: 50GB minimum for application and logs

Required Services​

  • MongoDB database server
  • Redis cache server
  • SMTP server for email notifications
  • AWS account for S3 storage
  • SSL certificates for HTTPS

Installation Guide​

1. Backend Setup (bl-engine)​

Clone and Install​

git clone <repository-url>
cd bl-engine
npm install

Environment Configuration​

Create .env file with required variables:

NODE_ENV=production
PORT=3000
MONGODB_URI=mongodb://localhost:27017/medfeed
REDIS_URL=redis://localhost:6379
JWT_SECRET=your-jwt-secret-key
AWS_ACCESS_KEY_ID=your-aws-key
AWS_SECRET_ACCESS_KEY=your-aws-secret
S3_BUCKET_NAME=your-s3-bucket
SMTP_HOST=your-smtp-server
SMTP_PORT=587
SMTP_USER=your-smtp-username
SMTP_PASS=your-smtp-password

Database Setup​

# Start MongoDB service
sudo systemctl start mongod

# Create database and collections
npm run build
npm start

Production Deployment​

# Build application
npm run build

# Start with PM2
npm run deploy:prod

2. Frontend Setup (app)​

Clone and Install​

cd app
npm install

Environment Configuration​

Create .env.local file:

NEXT_PUBLIC_API_URL=https://your-api-domain.com
MEDFEED_BE_HOST=https://your-api-domain.com
NEXTAUTH_SECRET=your-nextauth-secret
NEXTAUTH_URL=https://your-frontend-domain.com

Build and Deploy​

# Build for production
npm run build

# Start production server
npm start

Backend Docker Setup​

cd bl-engine
docker build -t medfeed-backend .
docker run -d -p 3000:3000 --env-file .env medfeed-backend

Frontend Docker Setup​

cd app
docker build -t medfeed-frontend .
docker run -d -p 3001:3000 --env-file .env.local medfeed-frontend

Docker Compose​

version: '3.8'
services:
backend:
build: ./bl-engine
ports:
- "3000:3000"
environment:
- NODE_ENV=production
depends_on:
- mongodb
- redis

frontend:
build: ./app
ports:
- "3001:3000"
depends_on:
- backend

mongodb:
image: mongo:6
ports:
- "27017:27017"
volumes:
- mongodb_data:/data/db

redis:
image: redis:7-alpine
ports:
- "6379:6379"

volumes:
mongodb_data:

Configuration​

1. Database Configuration​

MongoDB Setup​

  • Create dedicated database for Medfeed
  • Set up proper indexes for performance
  • Configure backup schedules
  • Set up replica sets for high availability

Redis Configuration​

  • Configure memory limits
  • Set up persistence if needed
  • Configure clustering for scale

2. Security Configuration​

SSL/TLS Setup​

server {
listen 443 ssl;
server_name your-domain.com;

ssl_certificate /path/to/certificate.crt;
ssl_certificate_key /path/to/private.key;

location / {
proxy_pass http://localhost:3001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}

location /api {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}

Firewall Rules​

# Allow HTTP/HTTPS
sudo ufw allow 80
sudo ufw allow 443

# Allow SSH (restrict to admin IPs)
sudo ufw allow from YOUR_ADMIN_IP to any port 22

# Block direct access to application ports
sudo ufw deny 3000
sudo ufw deny 3001

3. User Management​

Admin Account Setup​

  1. Access the admin panel at /admin
  2. Create initial admin user
  3. Configure organization settings
  4. Set up departments and roles

Staff Invitation Process​

  1. Navigate to User Management
  2. Send email invitations to staff
  3. Configure role-based permissions
  4. Monitor user activation status

Monitoring and Maintenance​

1. Application Monitoring​

Log Management​

  • Backend logs: bl-engine/src/logs/
  • Frontend logs: Check browser console and server logs
  • Set up log rotation to prevent disk space issues

Health Checks​

# Backend health check
curl http://localhost:3000/health

# Database connection check
curl http://localhost:3000/api/health/db

2. Performance Monitoring​

Key Metrics to Monitor​

  • API response times
  • Database query performance
  • Memory and CPU usage
  • Disk space utilization
  • Active user sessions

Monitoring Tools​

  • Use PM2 for process monitoring
  • Set up MongoDB monitoring
  • Configure Redis monitoring
  • Implement application performance monitoring (APM)

3. Backup and Recovery​

Database Backups​

# MongoDB backup
mongodump --host localhost:27017 --db medfeed --out /backup/mongodb/

# Automated backup script
#!/bin/bash
DATE=$(date +%Y%m%d_%H%M%S)
mongodump --host localhost:27017 --db medfeed --out /backup/mongodb/$DATE/

File Backups​

  • S3 bucket backups (automatic with versioning)
  • Application code backups
  • Configuration file backups

Troubleshooting​

Common Issues​

Backend Issues​

# Check application status
pm2 status

# View logs
pm2 logs medfeed-backend

# Restart application
pm2 restart medfeed-backend

Database Issues​

# Check MongoDB status
sudo systemctl status mongod

# Check Redis status
sudo systemctl status redis

# Monitor connections
mongo --eval "db.serverStatus().connections"

Performance Issues​

  • Monitor memory usage: htop or free -h
  • Check disk space: df -h
  • Monitor network: netstat -tulpn

Support Escalation​

  1. Level 1: Check logs and restart services
  2. Level 2: Database and infrastructure issues
  3. Level 3: Application code issues (contact development team)

Security Best Practices​

1. Access Control​

  • Implement role-based access control (RBAC)
  • Use strong password policies
  • Enable two-factor authentication
  • Regular access reviews

2. Data Protection​

  • Encrypt data at rest and in transit
  • Regular security updates
  • HIPAA compliance measures
  • Audit logging

3. Network Security​

  • Use VPN for admin access
  • Implement network segmentation
  • Regular security scans
  • Intrusion detection systems

Scaling Considerations​

Horizontal Scaling​

  • Load balancer configuration
  • Multiple backend instances
  • Database clustering
  • CDN for static assets

Vertical Scaling​

  • Increase server resources
  • Optimize database queries
  • Implement caching strategies
  • Monitor resource utilization

For end-user guidance, refer to the Doctors/Nurses Guide.