Deployment - Kaleemunnisa/CS691-Spring2025-Team6 GitHub Wiki

# πŸš€ Deployment Manual

This document provides step-by-step instructions to deploy and run the application in a **production or local setup** environment. It is designed for **developers outside the original team** to get the app running smoothly.

---

## πŸ“ Project Overview

- **Frontend**: Expo (React Native, SDK 52) – requires Node.js v18 or above (tested with v22)
- **Backend**: FastAPI – requires Python 3
- **Startup Script**: `start.sh` handles both frontend and backend launch
- **Environment**: `.env` required for frontend

---

## βœ… Prerequisites

Ensure you have the following installed on your system:

- Node.js (v18+ recommended)
- Python 3 and pip3
- Git
- Expo CLI:
  ```bash
  npm install -g expo-cli
  ```

πŸš€ Quick Start (Unified)

You can run the entire app (both frontend and backend) using the provided script:

1. Make the Script Executable

chmod +x start.sh

2. Run the Script

./start.sh

This will:

  • Start the FastAPI backend (on port 8000)
  • Start the Expo frontend development server

πŸ“ Ensure environment variables are set correctly before running the script.


🧩 Frontend Setup (Expo React Native)

1. Install Dependencies

npm install --legacy-peer-deps

⚠️ Use this to avoid common peer dependency conflicts.

2. For Expo SDK Compatibility

If a dependency causes issues, install it via Expo:

npx expo install <module-name>

3. Set Up Environment Variables

Create a .env file in the frontend root directory.

You can copy from .env.example:

cp .env.example .env

Sample .env:

# πŸ”‘ API Keys
GEOAPIFY_KEY=your_geoapify_api_key_here
TICKETMASTER_API_KEY=your_ticketmaster_api_key_here

# πŸ”₯ Firebase Configuration
FIREBASE_API_KEY=your_firebase_api_key
FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
FIREBASE_PROJECT_ID=your_project_id
FIREBASE_STORAGE_BUCKET=your_project_storage_bucket
FIREBASE_MESSAGING_SENDER_ID=your_messaging_sender_id
FIREBASE_APP_ID=your_firebase_app_id

# 🌐 Backend API Endpoint
RECOMMEND_API_URL=http://your-backend-host:8000/events/recommend

⚠️ Do not commit the actual .env file. Use .env.example in version control.


🐍 Backend Setup (FastAPI)

Here’s the revised section with a recommendation to use a Python virtual environment (venv) for better isolation and manageability:


🐍 Backend Setup (FastAPI)

1. Create and Activate a Virtual Environment (Recommended)

It's best practice to use a virtual environment to avoid dependency conflicts:

python3 -m venv venv
source venv/bin/activate  # On Linux or macOS
# OR
venv\Scripts\activate     # On Windows

2. Install Dependencies

Make sure you are in the backend directory:

pip3 install -r requirements.txt

3. Run the Backend Server

Recommended production command using uvicorn:

uvicorn main:app --host 0.0.0.0 --port 8000 --workers 4

🌐 This allows the backend to be accessed from external devices (like mobile phones on the same network).

4. Update Frontend .env

Set the backend URL in your frontend .env:

RECOMMEND_API_URL=http://<your-ip>:8000/events/recommend

🧠 Replace <your-ip> with your local IP address or public server IP.


Let me know if you'd like this change added to the full markdown file again.

πŸ§ͺ Testing Access

  • Backend: Open a browser and visit http://<your-ip>:8000/docs to access the Swagger UI.
  • Frontend: The Expo Dev Tools UI should launch automatically. Use QR code or emulator to test.

πŸ“Œ Notes

  • Use consistent environments across team members (Node.js 18+, Python 3)
  • Use npx expo install to avoid breaking SDK compatibility
  • Keep .env files private
  • Use start.sh for hassle-free local development

πŸ› οΈ Troubleshooting

  • Port already in use? Use lsof -i :8000 (or :19000 for Expo) to identify and kill conflicting processes.
  • Expo not detecting device? Ensure your phone and computer are on the same network.

⚠️ **GitHub.com Fallback** ⚠️