This guide will help you deploy your Healthcare Management System to Netlify (frontend) and various backend hosting services.
- GitHub account
- Netlify account (free tier available)
- Make sure all your code is committed and pushed to GitHub
- Ensure your
netlify.tomlfile is in the root directory - Verify the
_redirectsfile is in thefrontend/directory
- Login to Netlify: Go to netlify.com and sign in
- New Site from Git: Click "New site from Git"
- Choose GitHub: Select GitHub as your Git provider
- Select Repository: Choose your healthcare management repository
- Configure Build Settings:
- Base directory:
frontend - Build command:
npm run build - Publish directory:
frontend/dist
- Base directory:
- Environment Variables: Add environment variables in Netlify dashboard:
- Go to Site settings → Environment variables
- Add:
VITE_API_BASE_URL=https://your-backend-url.com/api
- Deploy: Click "Deploy site"
# Install Netlify CLI
npm install -g netlify-cli
# Login to Netlify
netlify login
# Build your frontend
cd frontend && npm run build
# Deploy
netlify deploy --prod --dir=dist- In Netlify dashboard, go to Site settings → Domain management
- Add your custom domain
- Configure DNS settings as instructed
Railway offers easy MySQL database hosting and application deployment.
- Sign up: Go to railway.app
- Create New Project: Click "New Project"
- Deploy from GitHub: Connect your repository
- Add MySQL Database: Add a MySQL service to your project
- Environment Variables: Set the following in Railway:
DATABASE_URL=mysql://username:password@host:port/database PORT=3000 NODE_ENV=production CORS_ORIGIN=https://your-netlify-site.netlify.app - Deploy: Railway will automatically deploy your backend
- Install Heroku CLI: Download from heroku.com
- Login:
heroku login - Create App:
heroku create your-app-name - Add MySQL:
heroku addons:create jawsdb:kitefin - Set Environment Variables:
heroku config:set NODE_ENV=production heroku config:set CORS_ORIGIN=https://your-netlify-site.netlify.app
- Deploy:
git subtree push --prefix backend heroku main
- Create Account: Sign up at digitalocean.com
- Create App: Use the App Platform
- Connect Repository: Link your GitHub repository
- Configure Build: Set source directory to
backend - Add Database: Create a managed MySQL database
- Environment Variables: Configure in the dashboard
- Deploy: DigitalOcean will build and deploy automatically
- Sign up: Go to render.com
- New Web Service: Create from your GitHub repository
- Configure:
- Root Directory:
backend - Build Command:
npm install - Start Command:
npm start
- Root Directory:
- Add Database: Create a PostgreSQL database (you'll need to modify your code)
- Environment Variables: Set in Render dashboard
- Deploy: Render will automatically deploy
-
Import Schema: Run the SQL files in your hosting service:
-- Run backend/sql/schema.sql first -- Then run backend/sql/sample_data.sql
-
Update Connection: Make sure your environment variables match your database:
DATABASE_URL=mysql://username:password@host:port/database_name
You'll need to convert your MySQL schema to PostgreSQL syntax.
Your repository includes a GitHub Actions workflow that:
- Automatically builds your frontend when you push to main
- Deploys to Netlify using secrets
Add these secrets in your GitHub repository settings:
NETLIFY_AUTH_TOKEN: Your Netlify personal access tokenNETLIFY_SITE_ID: Your Netlify site IDVITE_API_BASE_URL: Your backend API URL
VITE_API_BASE_URL=https://your-backend-api.com/api# Database
DATABASE_URL=mysql://username:password@host:port/database
# OR individual variables:
DB_HOST=your-db-host
DB_USER=your-db-user
DB_PASSWORD=your-db-password
DB_NAME=your-db-name
# Server
PORT=3000
NODE_ENV=production
# CORS
CORS_ORIGIN=https://your-netlify-site.netlify.app- Frontend: Visit your Netlify URL
- Backend: Test API endpoints at your backend URL
- Integration: Ensure frontend can communicate with backend
- Database: Verify data persistence and retrieval
-
CORS Errors:
- Ensure
CORS_ORIGINmatches your Netlify URL exactly - Include both
http://andhttps://if needed
- Ensure
-
API Not Found:
- Check
VITE_API_BASE_URLis correct - Verify backend is running and accessible
- Check
-
Database Connection Issues:
- Verify
DATABASE_URLformat - Check database server is running
- Ensure firewall allows connections
- Verify
-
Build Failures:
- Check Node.js version compatibility
- Verify all dependencies are in package.json
- Review build logs for specific errors
If you encounter issues:
- Check the logs in your hosting service dashboard
- Verify all environment variables are set correctly
- Test locally first with production-like settings
- Consult hosting service documentation
Remember to update your frontend/_redirects file with your actual backend URL before deploying!