Deployment Guide

Deploy your app to production stores and hosting

⚠️ Stop! Before You Deploy
Make sure you have tested the app locally and configured Firebase correctly. Deploying without proper testing can result in broken functionality and frustrated users.

Quick Pre-Flight Checklist

Complete these essential items before proceeding with deployment:

✅ All items checked? Great! You're ready to deploy.

Deployment Overview

This guide covers deploying all components of Missão:

Android App

Deploy to Google Play Store

iOS App

Deploy to Apple App Store

Admin Panel

Deploy to Firebase Hosting

Cloud Functions

Deploy backend services

Pre-Deployment Checklist (Detailed)

Before deploying: Ensure all these items are completed.

Configuration

Branding

Testing

Deploy Admin Panel (Web)

Step 1: Build the Web App

# Build for production
flutter build web --release --dart-define-from-file=.env.prod

# Optional: Optimize with tree shaking
flutter build web --release --dart-define-from-file=.env.prod --web-renderer html

Step 2: Configure Firebase Hosting Target

# Set up hosting target (first time only)
firebase target:apply hosting admin YOUR_PROJECT_ID

Step 3: Deploy to Firebase Hosting

# Deploy only hosting
firebase deploy --only hosting:admin

# Or deploy everything
firebase deploy

Step 4: Verify Deployment

Your admin panel will be available at:

Custom Domain Setup

  1. Go to Firebase Console → Hosting
  2. Click "Add custom domain"
  3. Enter your domain (e.g., admin.yourdomain.com)
  4. Add the provided DNS records to your domain registrar
  5. Wait for SSL certificate provisioning (usually 24 hours)

Deploy Cloud Functions

Step 1: Verify Functions Build

cd functions
npm run lint
npm run build
cd ..

Step 2: Deploy Functions

# Deploy all functions
firebase deploy --only functions

# Deploy specific function
firebase deploy --only functions:inviteAdmin,functions:validateAdminAccess

# Deploy with environment config
firebase functions:config:set app.admin_url="https://admin.yourdomain.com"
firebase deploy --only functions

Step 3: Verify Deployment

# Check function logs
firebase functions:log

# Check specific function
firebase functions:log --only inviteAdmin
Cold starts: First invocation after deployment may be slow. Consider using min instances for critical functions.

Deploy Android App

Step 1: Update Version

Edit pubspec.yaml:

version: 1.0.0+1  # Format: version_name+version_code

Step 2: Build Release APK/Bundle

# Build APK (for testing)
flutter build apk --release --dart-define-from-file=.env.prod

# Build App Bundle (for Play Store - recommended)
flutter build appbundle --release --dart-define-from-file=.env.prod

Output files:

Step 3: Create Play Console Listing

  1. Go to Google Play Console
  2. Click "Create app"
  3. Fill in app details:
    • App name
    • Default language
    • App or game
    • Free or paid
  4. Complete all required sections in the dashboard

Step 4: Upload to Play Store

  1. Go to Release → Production
  2. Click "Create new release"
  3. Upload the .aab file
  4. Add release notes
  5. Review and roll out

Required Store Listing Assets

Asset Specifications
App icon 512 x 512 px, PNG
Feature graphic 1024 x 500 px, PNG/JPEG
Phone screenshots Min 2, 16:9 or 9:16 aspect ratio
Tablet screenshots Optional but recommended
Short description Max 80 characters
Full description Max 4000 characters

Deploy iOS App

Step 1: Update Version

Edit pubspec.yaml:

version: 1.0.0+1

Step 2: Configure Xcode Project

  1. Open ios/Runner.xcworkspace in Xcode
  2. Select Runner target
  3. Set version and build number in General tab
  4. Configure signing (select your Team)
  5. Set deployment target (iOS 12.0+)

Step 3: Build for Release

# Build iOS release
flutter build ios --release --dart-define-from-file=.env.prod

Step 4: Archive and Upload

  1. Open Xcode
  2. Select Product → Archive
  3. Wait for archive to complete
  4. In Organizer, click "Distribute App"
  5. Select "App Store Connect"
  6. Follow the wizard to upload

Step 5: Configure App Store Connect

  1. Go to App Store Connect
  2. Click "My Apps""+""New App"
  3. Fill in app information
  4. Complete all required sections
  5. Submit for review

Required App Store Assets

Asset Specifications
App icon 1024 x 1024 px, PNG (no alpha)
iPhone screenshots 6.5" (1284 x 2778) and 5.5" (1242 x 2208)
iPad screenshots 12.9" (2048 x 2732)
App preview video Optional, 15-30 seconds
Description Max 4000 characters
Keywords Max 100 characters
Privacy Policy URL Required
App Review: Apple reviews typically take 24-48 hours but can take longer. Ensure your app complies with App Store Guidelines.

Deploy Security Rules

Firestore Rules

firebase deploy --only firestore:rules

Storage Rules

firebase deploy --only storage

Verify Rules

Test your security rules in Firebase Console → Firestore → Rules → Rules Playground

Post-Deployment

Monitoring

Set Up Alerts

  1. Go to Google Cloud Console → Monitoring
  2. Create alerting policies for:
    • Function errors
    • High latency
    • Budget thresholds

Backup Strategy

Set up automated Firestore backups:

# Enable Firestore exports (requires Blaze plan)
gcloud firestore export gs://YOUR_BACKUP_BUCKET --async

Continuous Deployment (Optional)

GitHub Actions for Web

# .github/workflows/deploy-web.yml
name: Deploy Admin Panel

on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: subosito/flutter-action@v2
        with:
          flutter-version: '3.38.0'
          channel: 'stable'

      - name: Install dependencies
        run: flutter pub get

      - name: Build web
        run: flutter build web --release --dart-define-from-file=.env.prod

      - uses: FirebaseExtended/action-hosting-deploy@v0
        with:
          repoToken: '${{ secrets.GITHUB_TOKEN }}'
          firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
          channelId: live
          projectId: YOUR_PROJECT_ID

GitHub Actions for Functions

# .github/workflows/deploy-functions.yml
name: Deploy Cloud Functions

on:
  push:
    branches: [main]
    paths: ['functions/**']

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: '22'

      - name: Install dependencies
        run: cd functions && npm ci

      - name: Lint
        run: cd functions && npm run lint

      - uses: w9jds/firebase-action@master
        with:
          args: deploy --only functions
        env:
          FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

Next Steps

After deployment:

  1. Customization - Further customize your app
  2. FAQ - Common questions and troubleshooting