Set up a clean staging environment with:
developbranch deploying to staging backendmainbranch deploying to production backend- TestFlight builds pointing to appropriate environments
- Backend: Fly.io (Elysia.js + Bun)
- Frontend: Expo/React Native + EAS builds
- Database: Neon PostgreSQL (with staging branch)
- Secrets: Doppler (staging + prod configs)
- App name:
tldr-summarizer-api-staging - URL: https://tldr-summarizer-api-staging.fly.dev
- Config file:
fly.staging.toml
- File:
.github/workflows/deploy.yml - Deploys to staging on push to
develop - Deploys to production on push to
main - Requires
FLY_API_TOKENsecret in GitHub
Resolved several issues with Bun workspace resolution in Docker:
| Issue | Solution |
|---|---|
zod@catalog: failed to resolve |
Copy root package.json + bun.lock |
Workspace not found "frontend" |
Copy all workspace package.json files |
frontend/package.json not found |
Updated .dockerignore to allow it |
Cannot find package 'zod' in shared |
Install shared deps with --filter |
Final working approach: Simple Dockerfile that installs from backend directory.
fly tokens create deploy -a tldr-summarizer-api-stagingThen add FLY_API_TOKEN to GitHub repo → Settings → Secrets → Actions
doppler secrets download --config staging --no-file | fly secrets import -a tldr-summarizer-api-staginggit checkout main
git pull origin main
git checkout -b develop
git push -u origin develop| Branch | Rules |
|---|---|
main |
Require PR, require status checks, no direct push |
develop |
Require PR from feature branches (optional) |
Add to frontend/eas.json:
{
"build": {
"staging": {
"distribution": "internal",
"channel": "staging",
"env": {
"EXPO_PUBLIC_API_URL": "https://tldr-summarizer-api-staging.fly.dev"
}
},
"production": {
"autoIncrement": true,
"channel": "production",
"env": {
"EXPO_PUBLIC_API_URL": "https://tldr-summarizer-api.fly.dev"
}
}
}
}Then build with:
eas build --profile staging --platform ios- Build staging:
eas build --profile staging --platform ios - Submit:
eas submit --platform ios - In App Store Connect → TestFlight → Internal Testing:
- Create "Staging Testers" group
- Add staging builds to this group
| File | Status |
|---|---|
fly.staging.toml |
✅ Created |
.github/workflows/deploy.yml |
✅ Created |
Dockerfile |
✅ Fixed for workspaces |
.dockerignore |
✅ Modified |
frontend/eas.json |
⏳ Needs staging profile |
feature/* → develop (staging) → main (production)
│ │
▼ ▼
tldr-summarizer-api-staging tldr-summarizer-api
(Fly.io) (Fly.io)
│ │
Neon staging Neon production
Doppler staging Doppler prod