Overview
Deploying to a cloud platform provides 24/7 availability with all features enabled. This guide covers deploying to Render and Railway, plus general instructions for any platform supporting Python applications.Cloud deployment enables bank sync, mutual funds, and persistent settings accessible from anywhere.
Platform Comparison
| Platform | Free Tier | Auto-Sleep | Persistent Storage | Best For |
|---|---|---|---|---|
| Render | 750 hrs/month | Yes (15 min idle) | Requires paid tier | Production |
| Railway | $5 free credit | No | Yes | Development |
| Heroku | Deprecated | - | - | Not recommended |
| Fly.io | 3 VMs free | No | Yes | Global deployment |
Render Deployment
Render is recommended for production due to its simplicity and reliability.Prerequisites
Create Render Account
Sign up at render.com
Deployment Steps
Create Web Service
- In Render Dashboard, click New → Web Service
- Connect your repository
- Select branch:
main
Configure Service
Basic Settings:
- Name:
spendwisely-george - Environment:
Python 3 - Region: Choose closest to your location
- Branch:
main
-
Build Command:
-
Start Command:
Configure Environment Variables
Add these in the Environment section:
Render automatically sets
PORT. The server reads it via os.environ.get("PORT", 8000) (server.py:240).Persistent Storage on Render
Solutions:- Persistent Disk (Paid)
- External Database
- Re-login After Sleep
Render’s Persistent Disk feature (requires paid plan):
- In service settings, add a Disk
- Mount path:
/opt/render/project/data - Update
server.pyto use disk paths:
- Set environment variable:
Render Configuration File
Createrender.yaml in your repository root for infrastructure-as-code:
render.yaml
Railway Deployment
Railway offers simpler setup with better free tier storage.Create Railway Project
- Sign up at railway.app
- Click New Project → Deploy from GitHub repo
- Select your repository
Railway Persistent Storage
Railway provides persistent volumes on all tiers, including free.
- In Railway dashboard, go to Volumes
-
Add volume:
- Mount path:
/app/data - Size: 1GB
- Mount path:
-
Update
server.py:
- Set environment variable:
Fly.io Deployment
For global edge deployment with automatic region routing.Unfold Binary Considerations
Architecture Compatibility
| Platform | Default Architecture | Compatible? |
|---|---|---|
| Render | Linux x86_64 | ✓ Yes |
| Railway | Linux x86_64 | ✓ Yes |
| Fly.io | Linux x86_64 (default) | ✓ Yes |
| AWS Lambda | Custom runtime | ⚠️ Requires layer |
Building for ARM (Apple Silicon)
If deploying to ARM-based platforms:Environment Variables Reference
Required
None - all configuration is file-based by default.Optional
Post-Deployment Setup
Login to Fold
- Go to Settings → Bank Sync
- Enter phone number and verify OTP
- The server saves tokens to
unfold_config.yaml
Monitoring and Logs
- Render
- Railway
- Fly.io
Troubleshooting
Server fails to start: 'Address already in use'
Server fails to start: 'Address already in use'
Cause:
PORT environment variable not set correctlySolution: Remove hardcoded port in server.py. It should be:Unfold binary not found after deployment
Unfold binary not found after deployment
Cause: Binary not committed to repository or incorrect pathSolution:
- Ensure
unfold/unfoldis in your repo (check.gitignore) - Verify permissions:
Database resets on every deployment
Database resets on every deployment
Cause: No persistent storage configuredSolution: See platform-specific persistent storage sections above.
CORS errors from frontend
CORS errors from frontend
Cause: Frontend trying to access different domainSolution: The server allows all origins (server.py:23-28). If still blocked:
Mutual fund API calls fail
Mutual fund API calls fail
Cause: Outbound HTTPS blocked or API rate limitingSolution:
- Check platform firewall settings
- Add retry logic in
server.py:213 - Consider caching NAV data
Security Best Practices
Current Vulnerabilities
- No authentication - Anyone with the URL can access the app
- CORS allows all origins - Open to CSRF attacks
- Tokens stored in plaintext -
unfold_config.yamlis not encrypted
Recommended Improvements
Cost Estimation
Free Tier Limits
| Platform | Monthly Cost | Limitations |
|---|---|---|
| Render Free | $0 | 750 hrs, sleeps after 15 min idle, no persistent disk |
| Railway Free | 5 credit) | ~23 days runtime, persistent storage included |
| Fly.io Free | $0 | 3 shared-cpu VMs, 160GB bandwidth, 3GB storage |
Paid Tier Recommendations
For production use:- Render Starter: $7/month (persistent disk, no sleep, 24/7 uptime)
- Railway Pro: $20/month (unlimited projects, priority support)
- Fly.io Paid: ~$5/month (1 dedicated VM + volume)
Next Steps
API Reference
Explore all available endpoints
Local Setup
Run SpendWisely George on your local machine