This guide covers multiple deployment options for your Exoplanet Classifier React/FastAPI application.
# Build and run with Docker Compose
docker-compose up --build
# Or build manually
docker build -t exoplanet-classifier .
docker run -p 8000:8000 exoplanet-classifier- Push your code to GitHub
- Connect your repository to your cloud provider
- Use the provided
Dockerfileanddocker-compose.yml
Railway automatically detects the railway.json configuration.
- Sign up at railway.app
- Connect GitHub repository
- Deploy - Railway will automatically:
- Build the React frontend
- Install Python dependencies
- Start the FastAPI server
- Serve both frontend and backend
PORT- Railway sets this automaticallyPYTHONPATH=/app
Deploy frontend to Vercel and backend to Railway for optimal performance.
- Connect your GitHub repo to vercel.com
- Set root directory to
frontend/ - Update
frontend/vercel.jsonwith your Railway backend URL - Deploy
- Deploy backend using Railway (see above)
- Copy your Railway app URL
- Update
frontend/vercel.jsonto point to your Railway URL
- Install Heroku CLI
- Login and create app:
heroku login heroku create your-app-name
- Deploy:
git push heroku main
- Use the provided
Dockerfile - Deploy to ECS (AWS), Cloud Run (GCP), or Container Instances (Azure)
- Backend: Deploy FastAPI to AWS Lambda, Google Cloud Functions, or Azure Functions
- Frontend: Deploy React build to S3 + CloudFront (AWS), Cloud Storage (GCP), or Blob Storage (Azure)
# Backend
PYTHONPATH=/app
PYTHONUNBUFFERED=1
PORT=8000
# Frontend (if separate deployment)
VITE_API_URL=https://your-backend-url.railway.appIf deploying separately, update frontend/src/lib/api.ts:
const API_BASE_URL = import.meta.env.VITE_API_URL || 'http://localhost:8000'Your deployment includes:
- Health check endpoint at
/ - API documentation at
/docs - Automatic restarts on failure
- Static file serving for React app
-
Frontend not loading:
- Ensure React build files exist in
static/directory - Check that static file serving is enabled
- Ensure React build files exist in
-
API not responding:
- Verify all Python dependencies are installed
- Check that model file exists:
properly_trained_model.joblib
-
CORS errors:
- Backend includes CORS middleware for
localhost:5173 - For production, update CORS origins in
api/main.py
- Backend includes CORS middleware for
- Railway: Check deployment logs in dashboard
- Heroku:
heroku logs --tail - Docker:
docker logs <container-id>
For beginners: Use Railway - it's the easiest and handles everything automatically.
For production: Use Railway + Vercel - backend on Railway, frontend on Vercel for optimal performance.
For enterprise: Use AWS/GCP/Azure with container services for full control.