Architectural Overview & Production Playbook
End-to-end instructions for deploying the Proofly API backend, PostgreSQL database on Supabase, AWS SES email delivery, AWS S3 storage, custom domain DNS onrovel.dev, and building the production Flutter Android APK.
┌────────────────────────┐
│ Custom Domain / DNS │
│ (https://rovel.dev) │
└───────────┬────────────┘
│
┌──────────────────────┴──────────────────────┐
│ │
▼ ▼
┌────────────────────────┐ ┌─────────────────────────┐
│ Proofly Web UI & API │ │ Proofly Mobile App │
│ (Express + TypeScript) │ │ (Flutter Android / iOS) │
└───────┬────────┬───────┘ └────────────┬────────────┘
│ │ │
│ ├────────────► AWS SES (Emails) ◄─────────┤
│ ├────────────► AWS S3 (PDFs/Assets) ◄─────┤
│ │ │
▼ ▼ ▼
┌──────────┐ ┌──────────────────────────────────────────────┐
│ Supabase │ │ Polygon Amoy Blockchain (Chain ID: 80002) │
│ Postgres │ │ Contract: 0xfb960EB42729f84C48040eBe264b1147 │
└──────────┘ └──────────────────────────────────────────────┘
Create a .env file on your server (or add these variables in your cloud hosting provider's dashboard):
# ==========================================
# Proofly Production Environment
# ==========================================
# Server & Network
PORT=4000
NODE_ENV=production
API_BASE_URL=https://rovel.dev/api/v1
APP_URL=https://rovel.dev
JWT_SECRET=your_production_jwt_secret_key_here
# Supabase (PostgreSQL Database & Auth)
SUPABASE_URL=https://your-project-id.supabase.co
SUPABASE_ANON_KEY=YOUR_SUPABASE_ANON_KEY
SUPABASE_SERVICE_ROLE_KEY=YOUR_SUPABASE_SERVICE_ROLE_KEY
# Polygon Blockchain (Amoy Testnet V1 / Polygon Mainnet)
CHAIN_ID=80002
NETWORK_NAME=polygon-amoy
POLYGON_AMOY_RPC_URL=https://polygon-amoy.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY
CONTRACT_ADDRESS=0xfb960EB42729f84C48040eBe264b11473d926006
RELAYER_PRIVATE_KEY=YOUR_POLYGON_RELAYER_PRIVATE_KEY
POLYGONSCAN_API_KEY=YOUR_POLYGONSCAN_API_KEY
# Storage Layer (AWS S3)
STORAGE_PROVIDER=s3
AWS_REGION=ap-south-1
AWS_ACCESS_KEY_ID=YOUR_AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY=YOUR_AWS_SECRET_ACCESS_KEY
AWS_S3_BUCKET=proofly-certificates
# Email Service (AWS SES)
EMAIL_FROM=no-reply@rovel.dev- Connect your GitHub Repository to Railway.app or Render.com.
- Set the Build Command:
npm install && npm run build - Set the Start Command:
npm run start:api
- In the Environment Variables settings, paste all variables from Section 2.
- Add your custom domain
rovel.devin Settings ➔ Domains.
- OS: Ubuntu Server 24.04 LTS (x86_64 or ARM64)
- Instance Type:
t3.smallort4g.small(Free tier / Low cost) - Security Group Inbound Rules:
HTTP(Port 80) ➔0.0.0.0/0HTTPS(Port 443) ➔0.0.0.0/0SSH(Port 22) ➔Your IP
sudo apt update && sudo apt upgrade -y
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs git nginx certbot python3-certbot-nginx
sudo npm install -g pm2git clone https://github.com/your-username/Proofly.git /var/www/proofly
cd /var/www/proofly
npm install
npm run build# Start API server and background indexer
pm2 start npm --name "proofly-api" -- run start:api
pm2 start npm --name "proofly-indexer" -- run indexer
pm2 save
pm2 startupEdit /etc/nginx/sites-available/proofly:
server {
server_name rovel.dev www.rovel.dev;
client_max_body_size 25M;
location / {
proxy_pass http://localhost:4000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cache_bypass $http_upgrade;
}
}Enable site & get free SSL with Certbot:
sudo ln -s /etc/nginx/sites-available/proofly /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
sudo certbot --nginx -d rovel.dev -d www.rovel.devIn your domain registrar (e.g. Name.com):
| Type | Host / Name | Answer / Target | TTL | Purpose |
|---|---|---|---|---|
| A | @ (rovel.dev) |
YOUR_SERVER_PUBLIC_IP |
300 | Web & API Root |
| CNAME | www |
rovel.dev |
300 | WWW Redirection |
| CNAME | xxxx._domainkey |
xxxx.dkim.amazonses.com |
300 | AWS SES DKIM 1 |
| CNAME | yyyy._domainkey |
yyyy.dkim.amazonses.com |
300 | AWS SES DKIM 2 |
| CNAME | zzzz._domainkey |
zzzz.dkim.amazonses.com |
300 | AWS SES DKIM 3 |
- AWS SES:
- Region:
ap-south-1(Mumbai). - Domain:
rovel.dev(DKIM records verified). - Production Access: In SES Console ➔ Click "Request production access" (Transactional, website:
https://rovel.dev).
- Region:
- AWS S3:
- Bucket:
proofly-certificatesinap-south-1. - Brand Logo: Stored at
brand/proofly_logo.png. - Certificates: Auto-uploaded under
certificates/<certNumber>.pdf.
- Bucket:
To build the release Android APK connected to your live production domain:
cd apps/mobile
# Build release APK with production API endpoint
flutter build apk --release --dart-define=API_URL=https://rovel.dev/api/v1The compiled standalone APK will be located at:
apps/mobile/build/app/outputs/flutter-apk/app-release.apk
To host it for direct download on your site:
# Copy release APK to public web directory
cp apps/mobile/build/app/outputs/flutter-apk/app-release.apk services/api/public/proofly.apk# Check running PM2 processes
pm2 status
# View live API logs
pm2 logs proofly-api
# Check Nginx status
sudo systemctl status nginx
# Test on-chain blockchain connection
cd services/api
npx ts-node src/scripts/test-live-flow.ts
# Test AWS SES email delivery
npx ts-node -e "import { emailService } from './src/services/email.service'; emailService.sendClaimInvitation({ toEmail: 'your-email@gmail.com', recipientName: 'Admin', certificateTitle: 'Test Certificate', organizationName: 'Proofly', certificateNumber: 'TEST-001', claimUrl: 'https://rovel.dev/claim/test-token' }).then(console.log);"