Zero-Cost Deployment Environments
Relevant source files
The following files were used as context for generating this wiki page:
Infinity OS utilizes a "Zero-Cost Stack" architecture, leveraging the free tiers of cloud providers to deploy a browser-native, AI-augmented virtual operating system. By orchestrating services across Cloudflare, Supabase, and Fly.io, the project achieves a monthly infrastructure cost of $0.00 while maintaining enterprise-grade security, scalability, and performance.
Sources: README.md:14-18, README.md:387-400
Core Infrastructure Providers
The environment is distributed across three primary providers, each serving a specific layer of the stack. This modularity ensures that components can scale independently within their respective free-tier limits.
Zero-Cost Service Matrix
| Service | Provider | Free Tier Allocation | Purpose |
|---|---|---|---|
| Frontend Hosting | Cloudflare Pages | Unlimited bandwidth, 500 builds/month | Hosting the Shell and Portal PWAs |
| Edge Computing | Cloudflare Workers | 100,000 requests/day | Running Identity, HIVE, and Void services |
| Database | Supabase | 500MB PostgreSQL, 50K MAU | Persistent storage and Row Level Security |
| File Storage | Cloudflare R2 | 10GB, zero egress fees | Object storage for files and assets |
| Edge Cache | Cloudflare KV | 100,000 reads/day | High-speed configuration and session storage |
| Backend API | Fly.io | 3 shared VMs (256MB RAM each) | Hosting the FastAPI production backend |
| AI Features | Cloudflare AI | 10,000 neurons/day | Edge-based LLM and image generation |
Sources: README.md:387-400, DEPLOY_GUIDE.md:204-210, dashboard/index.html:120-135
Deployment Architecture
The deployment flow is designed to be idempotent and automated, utilizing a "One-Command" philosophy. The architecture separates the static frontend from the dynamic backend and edge-based microservices.
Infrastructure Data Flow
The following diagram illustrates how user requests are routed through the zero-cost components.
This diagram shows the relationship between the edge-native workers and the centralized backend/database layers.
Sources: DEPLOY_GUIDE.md:13-30, README.md:41-55
Deployment Workflows
1. Live Production Deployment
The deploy-live.sh script automates the full-stack deployment. It handles the provisioning of Fly.io resources, database attachment, and frontend builds.
Sources: scripts/deploy-live.sh:11-21
- Backend (Fly.io): Provisions a PostgreSQL cluster and deploys the FastAPI app. It automatically handles secret rotation for
SECRET_KEYandJWT_SECRET_KEYusing Python'ssecretsmodule. - Frontend (Cloudflare Pages): Injects production environment variables (
VITE_BACKEND_API_URL,VITE_WS_URL) during the Vite build process and pushes thedistdirectory to Cloudflare.
Sources: scripts/deploy-live.sh:76-130
2. Idempotent Stack Deployment
The deploy.sh script provides a more granular approach, allowing developers to skip specific modules like Vault or Workers. It includes "Preflight Checks" to detect CPU architecture (amd64, arm64) and verify the existence of required tools like pnpm and docker-compose.
Sources: scripts/deploy.sh:100-145
Deployment Logic Sequence
The deployment sequence ensures that the backend is live before the frontend is built, allowing the backend URL to be injected into the frontend assets.
Sources: scripts/deploy-live.sh:205-230, DEPLOY_GUIDE.md:55-100
Environment Configuration
Deployment environments rely on specific environment variables and Cloudflare KV namespaces to manage state and security.
Required Cloudflare KV Namespaces
To enable the API Gateway features (Rate Limiting and Caching), specific KV namespaces must be created and linked in the wrangler.toml configuration.
Sources: scripts/setup-cloudflare.sh:58-85
| Namespace | Binding | Purpose |
|---|---|---|
RATE_LIMIT | KV_RATE_LIMIT | Tracking request frequency per IP |
CACHE | KV_CACHE | Storing edge-cached API responses |
SESSIONS | SESSIONS_KV | Managing user session state |
Sources: scripts/setup-cloudflare.sh:66-78, PROJECT_PULSE_SESSION18.md:144-148
Security and Secrets Management
The zero-cost environment enforces security through GitHub Secrets and provider-specific secret stores (e.g., fly secrets).
- CLOUDFLARE_API_TOKEN: Required for Pages and Workers deployment.
- D1_DATABASE_ID: Required for the Auth API database.
- JWT_SECRET: Used for signing tokens across the edge and backend.
Sources: PROJECT_PULSE_SESSION18.md:144-160, DEPLOY_GUIDE.md:118-135
Post-Deployment Verification
The validate-production.sh script performs a suite of checks to ensure the environment is correctly configured after deployment.
Sources: scripts/validate-production.sh:1-15
- Core API Health: Checks
/health,/docs, and/redocendpoints. - Security Headers: Validates the presence of
X-Content-Type-Options,X-Frame-Options, andStrict-Transport-Security. - Service Routing: Pings internal routers for AI, Billing, and Compliance to verify connectivity.
Sources: scripts/validate-production.sh:90-115, scripts/validate-production.sh:135-145
Conclusion
The Zero-Cost Deployment Environment of Infinity OS represents a shift toward "Edge-native" infrastructure. By utilizing the distributed capabilities of Cloudflare Workers and the rapid provisioning of Fly.io, the platform maintains a resilient, quantum-safe architecture without incurring traditional server costs. This model is critical for the project's sustainability and its alignment with the "2060 Modular Standard."
Sources: README.md:14-25, ECOSYSTEM_PRODUCTION_READINESS_V4.md:110-120