#!/bin/bash # Cultural Shift Sandbox - Deployment Script for Hugging Face Spaces # This script prepares the files for deployment echo "🚀 Preparing Cultural Shift Sandbox for Hugging Face Spaces deployment..." # Create deployment directories echo "📁 Creating deployment directories..." # Backend deployment mkdir -p deploy/backend cp -r server/* deploy/backend/ cp Dockerfile deploy/backend/ cp package.json deploy/backend/ 2>/dev/null || echo "⚠️ package.json not found in root" # Frontend deployment mkdir -p deploy/frontend cp -r client/* deploy/frontend/ cp client/Dockerfile deploy/frontend/ cp nginx.conf deploy/frontend/ # Create deployment instructions cat > deploy/README.md << 'EOF' # Deployment Instructions ## Backend Deployment (Hugging Face Spaces) 1. Create a new Space on Hugging Face: - Go to https://huggingface.co/spaces - Click "Create new Space" - Choose "Docker" as the SDK - Name: `your-username/transcreation-backend` 2. Upload files from `backend/` folder: - All files in this directory - Dockerfile - package.json and package-lock.json 3. Set Environment Variables: - MONGODB_URI=your_mongodb_atlas_connection_string - NODE_ENV=production - PORT=5000 ## Frontend Deployment (Hugging Face Spaces) 1. Create another Space: - Name: `your-username/transcreation-frontend` - Choose "Docker" as the SDK 2. Upload files from `frontend/` folder: - All files in this directory - Dockerfile - nginx.conf 3. Set Environment Variables: - REACT_APP_API_URL=https://your-backend-space-url.hf.space/api ## Database Setup 1. Create MongoDB Atlas account 2. Create a new cluster 3. Get your connection string 4. Add it as MONGODB_URI environment variable ## URLs - Backend: https://your-username-transcreation-backend.hf.space - Frontend: https://your-username-transcreation-frontend.hf.space EOF echo "✅ Deployment files prepared!" echo "" echo "📂 Files are ready in the 'deploy/' directory:" echo " - deploy/backend/ (for backend Space)" echo " - deploy/frontend/ (for frontend Space)" echo "" echo "📖 See deploy/README.md for detailed instructions" echo "" echo "🔗 Next steps:" echo " 1. Set up MongoDB Atlas database" echo " 2. Create Hugging Face Spaces" echo " 3. Upload files and configure environment variables" echo " 4. Deploy and test!"