Overview
The FE Monorepo uses different deployment strategies for each application:- SPA & Web: Vercel for hosting and deployment
- Expo: EAS (Expo Application Services) for building and distributing to app stores
SPA Deployment (Vercel)
The SPA is built with Vite and deployed to Vercel.Building for Production
Build for Development
Build with development environment:This uses
.env.dev and builds in development mode.Build for Production
Build with production environment:This uses
.env.prod and optimizes for production.Vercel Configuration
Connect Repository
- Go to Vercel Dashboard
- Click “Add New Project”
- Import your Git repository
Configure Build Settings
Set the following in Vercel project settings:
- Framework Preset: Vite
- Root Directory:
apps/spa - Build Command:
bun run build:prod - Output Directory:
dist - Install Command:
bun install
Set Environment Variables
Add environment variables from
apps/spa/.env.prod:- Go to Settings → Environment Variables
- Add each variable (e.g.,
VITE_API_URL) - Set the appropriate environment scope (Production, Preview, Development)
Vercel automatically deploys previews for pull requests and production builds for the main branch.
Web Deployment (Vercel)
The Web app is a Next.js 16 application deployed to Vercel.Building for Production
Vercel Configuration
Connect Repository
- Go to Vercel Dashboard
- Click “Add New Project”
- Import your Git repository
Configure Build Settings
Set the following in Vercel project settings:
- Framework Preset: Next.js
- Root Directory:
apps/web - Build Command:
bun run build:prod - Output Directory:
.next - Install Command:
bun install
Set Environment Variables
Add environment variables from
apps/web/.env.prod:- Go to Settings → Environment Variables
- Add database URL, auth secrets, and public variables
- Ensure
BETTER_AUTH_URLpoints to your production domain
Configure Database
Set up PostgreSQL database:
- Use Vercel Postgres or external provider
- Add
DATABASE_URLto environment variables - Run migrations if needed
Bundle Analysis
Analyze the production bundle size:Expo Deployment (EAS)
Expo uses EAS for building and distributing apps to Google Play Store and Apple App Store.Prerequisites
Build Profiles
The monorepo includes three build profiles ineas.json:
- Development: For development builds with dev client
- Preview: For internal distribution (TestFlight, Google Play Beta)
- Production: For app store submission
Development Builds
Development builds include the Expo Dev Client for rapid development:Local builds create
.apk files for Android and .tar.gz files for iOS in the project root.Preview Builds
Preview builds are for internal distribution via TestFlight (iOS) and Google Play Beta (Android):Preview builds require an Apple Developer Account ($99/year) for iOS.
Production Builds
Production builds are optimized for app store submission:OTA Updates
Send over-the-air updates for non-native changes (JS, styling, images):OTA updates only work for JavaScript changes. Native code changes require a new build.
App Store Submission
Google Play Store Setup
Requirements:
- Google Play Developer Account
- Google Service Account key
- Production build (
.aab)
Apple App Store Setup
Requirements:
- Apple Developer Account ($99/year)
- Production build (
.ipa) - App Store Connect configured
Follow best practices for app store submission including screenshots, descriptions, and privacy policies.
Bundle Size Optimization
Analyze the JavaScript bundle size:Shift+M and open Expo Atlas to view the bundle analysis.
CI/CD Integration
GitHub Actions
The monorepo includes CI workflows for building and testing:.github/workflows/ci.yml
EAS Workflows
EAS supports automated workflows for Expo apps. Run manually:Connect your EAS project to GitHub repository to trigger workflows automatically on push/PR events.
Environment-Specific Deployments
Development Environment
- SPA/Web: Deploy to Vercel preview URL
- Expo: Development builds with EAS
- Purpose: Testing new features
Preview/Staging Environment
- SPA/Web: Vercel preview deployments from PRs
- Expo: Preview builds distributed via TestFlight/Google Play Beta
- Purpose: Internal testing and QA
Production Environment
- SPA/Web: Vercel production deployment from main branch
- Expo: Production builds submitted to app stores
- Purpose: Public release
Troubleshooting
Vercel Deployment Issues
Build fails:- Check build logs in Vercel dashboard
- Verify environment variables are set correctly
- Test build locally:
bun run build:prod
- Check browser console for errors
- Verify API endpoints are accessible
- Ensure environment variables use production values
EAS Build Issues
Build fails on EAS:- Check EAS build logs
- Verify
eas.jsonconfiguration - Test local build first
- Ensure Apple Developer Account is connected
- Run
eas credentialsto manage certificates
- Production builds (
.aab,.ipa) can only be installed through app stores - Use preview builds for local testing
Quick Reference
| App | Platform | Build Command | Deploy Target |
|---|---|---|---|
| SPA | Web | bun spa build:prod | Vercel |
| Web | Web | bun web build:prod | Vercel |
| Expo | Android | bun expo build:android:prod | Google Play Store |
| Expo | iOS | bun expo build:ios:prod | Apple App Store |
Deployment URLs
- Vercel Dashboard: https://vercel.com/dashboard
- EAS Dashboard: https://expo.dev/
- Google Play Console: https://play.google.com/console
- App Store Connect: https://appstoreconnect.apple.com/
