AssetManagementPlatform

GitHub Pages + Free Backend Deployment Guide

This guide explains how to deploy the Asset Management Platform using GitHub Pages (free) for the frontend and free backend hosting services for the API and database.

🎯 Free Hosting Strategy

πŸš€ Quick Deploy

Step 1: Enable GitHub Pages

  1. Go to your repository Settings β†’ Pages
  2. Set Source to β€œGitHub Actions”
  3. The workflow will automatically deploy your frontend

Step 2: Set up GitHub Secrets (Optional for demo)

For full functionality, add these secrets in Settings β†’ Secrets and variables β†’ Actions:

JWT_SECRET=your_jwt_secret_here
JWT_REFRESH_SECRET=your_refresh_secret_here
GOOGLE_CLIENT_ID=your_google_oauth_client_id

Step 3: Deploy Frontend

The frontend deploys automatically on every push to main/master, or manually:

  1. Go to Actions tab
  2. Select Deploy to GitHub Pages workflow
  3. Click Run workflow
  4. Optionally specify your backend URL

Step 4: Deploy Backend

Choose one of these free backend hosting services:

  1. Sign up at render.com
  2. Connect your GitHub repository
  3. Create a new Web Service
  4. Set build settings:
    • Environment: Docker
    • Dockerfile Path: ./backend/Dockerfile
  5. Add environment variables:
    NODE_ENV=production
    DATABASE_URL=<provided-by-render>
    JWT_SECRET=<your-secret>
    JWT_REFRESH_SECRET=<your-secret>
    JWT_ACCESS_TOKEN_EXPIRY=15m
    JWT_REFRESH_TOKEN_EXPIRY=7d
    JWT_ACCESS_TOKEN_EXPIRY_REMEMBER=1h
    JWT_REFRESH_TOKEN_EXPIRY_REMEMBER=30d
    GOOGLE_CLIENT_ID=<your-client-id>
    
  6. Deploy!

πŸƒ Option B: Railway

  1. Sign up at railway.app
  2. Connect your GitHub repository
  3. Railway will auto-detect your project
  4. Add environment variables (same as above)
  5. Deploy!

πŸͺΆ Option C: Fly.io

  1. Sign up at fly.io
  2. Install Fly CLI: curl -L https://fly.io/install.sh | sh
  3. Run: fly launch in your project root
  4. Configure with your backend/Dockerfile
  5. Set secrets: fly secrets set JWT_SECRET=your-secret
  6. Deploy: fly deploy

πŸ“‹ Environment Variables

Required for Backend

# Database (provided by hosting service)
DATABASE_URL=postgresql://...

# Authentication
JWT_SECRET=your_jwt_secret_here
JWT_REFRESH_SECRET=your_refresh_secret_here
JWT_ACCESS_TOKEN_EXPIRY=15m
JWT_REFRESH_TOKEN_EXPIRY=7d
JWT_ACCESS_TOKEN_EXPIRY_REMEMBER=1h
JWT_REFRESH_TOKEN_EXPIRY_REMEMBER=30d

# Google OAuth
GOOGLE_CLIENT_ID=your_google_client_id_here

# Environment
NODE_ENV=production

Frontend Configuration

The frontend automatically gets the backend URL via the VITE_API_URL environment variable during build.

πŸ—„οΈ Database Setup

Most free hosting services provide PostgreSQL databases. For initial data setup:

  1. After backend deployment, connect to your database
  2. Run the initialization scripts:
    # Install dependencies
    npm install
    
    # Initialize database schema
    cd scripts
    npm run init-db
    
    # Seed with sample data
    python3 simple_db_seed.py
    

🌐 URLs After Deployment

πŸ”„ Updating Deployment

Frontend Updates

Backend Updates

πŸ§ͺ Testing Deployment

Local Testing

# Test the deployment setup locally
./test-deployment.sh

Health Checks

πŸ†“ Free Tier Limits

GitHub Pages

Backend Services (approximate free limits)

πŸ”§ Troubleshooting

Frontend Issues

Backend Issues

CORS Issues

πŸ’‘ Pro Tips

  1. Custom Domain: Add a custom domain to GitHub Pages for a professional look
  2. Monitoring: Set up uptime monitoring for your free services
  3. Backup: Regularly backup your database data
  4. Scaling: Monitor usage and upgrade plans as needed

πŸŽ‰ You’re Done!

Your Asset Management Platform is now live using free hosting! 🎊

Enjoy your deployed application! πŸš€