Skip to content

Latest commit

 

History

History
274 lines (214 loc) · 8.19 KB

File metadata and controls

274 lines (214 loc) · 8.19 KB

VaxTrust Deployment Guide

Complete step-by-step guide to deploy VaxTrust (Backend + Frontend + Mobile App).


Architecture Overview

Component Tech Deploy To
Backend API Flask (Python) Render.com (free tier)
Web Frontend React Netlify (free tier)
Mobile App Expo (React Native) EAS Build.apk / .ipa

STEP 1: Deploy the Backend (Flask API) on Render

1.1 Prepare the code (already done)

The following files have been created:

  • Procfile — tells Render how to start the server
  • runtime.txt — specifies Python version
  • requirements.txt — includes flask, flask-cors, gunicorn

1.2 Push to GitHub

cd /home/shreyas/code/VaxTrust
git add Procfile runtime.txt requirements.txt
git commit -m "Add deployment config for Render"
git push origin main

1.3 Deploy on Render.com

  1. Go to https://render.com and sign up (free).
  2. Click "New +""Web Service"
  3. Connect your GitHub repo: shreyasmene06/Vaxtrust
  4. Configure:
    • Name: vaxtrust-api
    • Region: Oregon (or closest)
    • Branch: main
    • Build Command: pip install -r requirements.txt
    • Start Command: cd backend && gunicorn app:app --bind 0.0.0.0:$PORT --workers 2 --timeout 120
    • Instance Type: Free
  5. Click "Create Web Service"

1.4 Note your backend URL

After deploy, Render gives you a URL like:

https://vaxtrust-api.onrender.com

Save this URL — you'll need it for the frontend and mobile app.

Note: Free-tier Render services spin down after 15 min of inactivity. First request after idle takes ~30s.


STEP 2: Deploy the Web Frontend on Netlify

2.1 Update the frontend API URL

Create a production .env for the frontend:

# In frontend/.env.production
REACT_APP_API_URL=https://vaxtrust-api.onrender.com

2.2 Build and test locally

cd frontend
npm run build

2.3 Deploy on Netlify (Option A — Drag & Drop)

  1. Go to https://app.netlify.com and sign up (free).
  2. Click "Add new site""Deploy manually"
  3. Drag the frontend/build/ folder into the upload area.
  4. Done! You get a URL like https://vaxtrust.netlify.app

2.4 Deploy on Netlify (Option B — Git Integration)

  1. Go to Netlify → "Add new site""Import from Git"
  2. Connect your GitHub repo: shreyasmene06/Vaxtrust
  3. Configure:
    • Base directory: frontend
    • Build command: npm run build
    • Publish directory: frontend/build
  4. Add Environment Variables (under Site settings → Environment):
    REACT_APP_API_URL = https://vaxtrust-api.onrender.com
    REACT_APP_FIREBASE_API_KEY = AIzaSyAdJPll5ePyORu-Wj53KXtJ1Bl_e7VgAn4
    REACT_APP_FIREBASE_AUTH_DOMAIN = vaxtrust-b131c.firebaseapp.com
    REACT_APP_FIREBASE_PROJECT_ID = vaxtrust-b131c
    REACT_APP_FIREBASE_STORAGE_BUCKET = vaxtrust-b131c.firebasestorage.app
    REACT_APP_FIREBASE_MESSAGING_SENDER_ID = 887152363532
    REACT_APP_FIREBASE_APP_ID = 1:887152363532:web:7a529cc46564a9f44a4629
    
  5. Click "Deploy site"

2.5 Set a custom domain (optional)

Netlify → Domain settings → Add custom domain → vaxtrust.app (you'd need to buy this)


STEP 3: Build the Mobile App (.APK for Android / .IPA for iOS)

This is how you make a real installable app that people can download.

3.1 Install EAS CLI

npm install -g eas-cli

3.2 Login to Expo

cd vaxtrust-mobile
eas login

Create an account at https://expo.dev if you don't have one.

3.3 Update the production API URL in the mobile app

Edit vaxtrust-mobile/src/services/api.js — change the production URL:

// Production URL - replace with your deployed backend
return 'https://vaxtrust-api.onrender.com';

3.4 Build an APK (Android — no developer account needed!)

cd vaxtrust-mobile
eas build --platform android --profile preview

This will:

  • Upload your code to Expo's cloud build servers
  • Compile a real .apk file
  • Give you a download link for the APK

Total time: ~10-15 minutes for first build.

Once done, you'll see:

✔ Build finished
🤖 Android build: https://expo.dev/artifacts/eas/xxxxx.apk

Download that APK → transfer to any Android phone → install it → you have a real app!

3.5 Build for iOS

Option A: iOS Simulator build (free, for testing on Mac)

eas build --platform ios --profile preview

This creates a .app file you can run in the iOS Simulator on any Mac.

Option B: Real iOS device (requires Apple Developer Account — $99/year)

eas build --platform ios --profile production

You need:

  1. An Apple Developer account ($99/year at developer.apple.com)
  2. EAS will guide you through creating provisioning profiles and certificates

3.6 Install the APK on Android

  1. Download the .apk from the EAS build link
  2. Transfer to your phone (email it, Google Drive, direct download)
  3. On your phone: Settings → Security → Enable "Install from unknown sources"
  4. Open the .apk → Install
  5. Done! VaxTrust is on your phone!

3.7 Internal distribution (share with testers)

# Register devices for internal testing
eas device:create

# Build for internal distribution
eas build --platform android --profile preview
eas build --platform ios --profile preview

STEP 4: Publish to App Stores (Optional — for public release)

Google Play Store

  1. Create a Google Play Developer account ($25 one-time fee) at play.google.com/console
  2. Build a production AAB:
    # Edit eas.json — change production android buildType to "app-bundle"
    eas build --platform android --profile production
  3. Upload the .aab file to Google Play Console
  4. Fill in listing details (screenshots, description, etc.)
  5. Submit for review (~1-3 days)

Apple App Store

  1. Apple Developer account ($99/year)
  2. Build:
    eas build --platform ios --profile production
  3. Submit:
    eas submit --platform ios
  4. Fill in App Store Connect listing
  5. Submit for review (~1-7 days)

Quick Command Reference

# ===== BACKEND (Render) =====
git add . && git commit -m "deploy" && git push origin main
# Render auto-deploys from GitHub

# ===== FRONTEND (Netlify) =====
cd frontend && npm run build
# Netlify auto-deploys from GitHub, or drag build/ folder

# ===== MOBILE APP (EAS) =====
cd vaxtrust-mobile

# Build Android APK (FREE — no account needed)
eas build --platform android --profile preview

# Build iOS simulator .app (FREE)
eas build --platform ios --profile preview

# Build for App Store (needs Apple Dev account)
eas build --platform ios --profile production

Environment Variables Checklist

Where Variable Value
Netlify REACT_APP_API_URL https://vaxtrust-api.onrender.com
Netlify REACT_APP_FIREBASE_* Your Firebase credentials
Render None needed Config is in code
Mobile .env EXPO_PUBLIC_FIREBASE_* Your Firebase credentials
Mobile api.js Production URL https://vaxtrust-api.onrender.com

Troubleshooting

Problem Solution
Backend 503 on Render Free tier spins down — first request takes 30s, wait and retry
CORS errors Ensure flask-cors is in requirements.txt (already added)
Firebase auth not working Add your Netlify domain to Firebase Console → Authentication → Authorized domains
APK won't install Enable "Install from unknown sources" in Android Settings
EAS build fails Run eas diagnostics and check the build logs on expo.dev
API calls fail in app Update the production URL in api.js to your Render URL

Cost Summary

Service Cost
Render (Backend) Free (with cold starts) or $7/mo for always-on
Netlify (Frontend) Free (100GB bandwidth/mo)
Expo EAS Build Free (30 builds/mo)
Google Play Store $25 one-time
Apple App Store $99/year
Custom Domain ~$10-15/year

Total to get a working deployed app with APK: $0