Documentation Index
Fetch the complete documentation index at: https://mintlify.com/jho426/handoff/llms.txt
Use this file to discover all available pages before exploring further.
Overview
This guide covers deploying the Nurse Handoff Helper application to production. The application consists of two main components:- Frontend: React application built with Vite
- Backend: Express.js API server
Prerequisites
Before deploying to production, ensure you have:- Node.js 18 or higher
- A Supabase project with production database
- Anthropic API key for Claude
- A hosting platform (see recommendations below)
- SSL/TLS certificates for HTTPS
- Environment variables securely configured
Build Process
Frontend Build
The frontend uses Vite for building and bundling:- Compiles React components and assets
- Optimizes JavaScript and CSS with Tailwind CSS v4
- Outputs production-ready files to the
dist/directory - Minifies and tree-shakes code for optimal performance
Build Output Details
Build Output Details
The build process creates:
dist/index.html- Main HTML entry pointdist/assets/- Optimized JS, CSS, and static assets- Source maps (optional, configure in
vite.config.js)
- Custom base URL if deploying to a subdirectory
- Build optimizations
- Environment-specific configurations
Preview Production Build
Test the production build locally before deploying:dist/ on a local server, allowing you to verify the production build works correctly.
Environment Configuration
Backend Environment Variables
Required environment variables for production:VITE_SUPABASE_URLandVITE_SUPABASE_ANON_KEYare exposed to the frontendSUPABASE_SERVICE_KEYis server-side only and enables admin operationsANTHROPIC_API_KEYis server-side only and never exposed to the browser
Environment Variable Management
Production Environment Setup
Production Environment Setup
Best Practices:
- Use environment-specific files: Create separate configurations for staging and production
- Secret management: Use your hosting platform’s secret management (e.g., Heroku Config Vars, Vercel Environment Variables)
- Rotation policy: Regularly rotate API keys and service role keys
- Access control: Limit who can view/modify production environment variables
- Backup: Document which services use which keys (without storing actual keys)
Hosting Options
Option 1: Monolithic Deployment (Same Server)
Deploy both frontend and backend on the same server. Suitable platforms:- Heroku
- DigitalOcean App Platform
- AWS Elastic Beanstalk
- Google Cloud Run
- Configure the backend to serve static files:
- Create a production start script in
package.json:
- Deploy with both frontend and backend together
Option 2: Separated Deployment (Recommended)
Deploy frontend and backend separately for better scalability. Frontend platforms:- Vercel
- Netlify
- Cloudflare Pages
- AWS S3 + CloudFront
- Heroku
- Railway
- Render
- AWS Lambda + API Gateway
- Google Cloud Functions
- Frontend: Update API endpoint in your React app
- Backend: Configure CORS for your frontend domain
Database Setup
Supabase Configuration
Ensure your production Supabase project has:-
Required tables:
nurses- with columns:id,email,name,auth_user_idpatients- patient recordsrooms- room assignmentstasks- patient taskslogs- activity logs
- Row Level Security (RLS): Enable RLS policies to restrict data access
- Auth configuration: Configure Supabase Auth with appropriate settings
Creating Nurse Accounts
After deployment, create authentication accounts for nurses:- Creates Supabase Auth accounts for all nurses in the database
- Generates temporary passwords
- Links auth users to nurse records
- Requires
SUPABASE_SERVICE_KEYto be configured
Server Configuration
Port Configuration
The server runs on port 3001 by default. To change:File Upload Limits
The application limits file uploads to 10MB. To adjust:Request Size Limits
JSON payload limit is 50MB. To adjust:Health Checks
The API provides a health check endpoint:- Load balancer health checks
- Monitoring and alerting
- Verifying API key configuration
Deployment Checklist
Pre-Deployment Checklist
Pre-Deployment Checklist
- Run
npm run buildand verify no errors - Test production build with
npm run preview - Configure all environment variables
- Set up SSL/TLS certificates
- Configure CORS for production domains
- Enable Supabase Row Level Security
- Test database connections
- Verify API keys are valid
- Set up monitoring and logging
- Configure backup strategy
- Document deployment process
- Create incident response plan
- Verify HIPAA compliance measures
Post-Deployment Checklist
Post-Deployment Checklist
- Test all API endpoints
- Verify frontend loads correctly
- Test user authentication flow
- Create nurse accounts
- Test AI analysis features
- Verify file upload functionality
- Check health endpoint
- Set up monitoring alerts
- Document production URLs
- Train staff on production system
Scaling Considerations
Horizontal Scaling
The application is stateless and can be scaled horizontally:- Add more server instances behind a load balancer
- Use session-based authentication (already implemented with Supabase)
- Consider a CDN for static assets
Database Scaling
As your patient database grows:- Monitor Supabase usage and upgrade plan as needed
- Implement database indexing on frequently queried fields
- Consider archiving old patient records
- Set up regular database backups
API Rate Limits
Monitoring and Logging
Application Logging
The server logs important events to console:- API errors
- Database operations
- AI provider requests
- Authentication events
- Datadog
- New Relic
- LogDNA
- Papertrail
Performance Monitoring
Monitor:- API response times
- Database query performance
- AI provider latency
- Server resource usage (CPU, memory)
- Error rates
Backup and Recovery
- Database backups: Supabase provides automated backups on paid plans
- Environment configuration: Keep encrypted backups of environment variables
- Code repository: Ensure code is committed to version control
- Documentation: Maintain up-to-date deployment documentation
Rollback Strategy
In case of deployment issues:- Keep previous version deployable
- Use blue-green deployment if possible
- Document rollback procedures
- Test rollback process in staging environment
Next Steps
- Review Security Best Practices
- Set up Troubleshooting procedures
- Configure monitoring and alerts
- Train staff on the production system
