Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

R2Upload SaaS Infrastructure Architecture

Lead Architect: Md. Kamruzzaman
Engineering Lab: BizSafer
Live Production: https://r2upload.io
Enterprise Inquiries: kamruzzaman@bizsafer.com

System Overview

R2Upload is a secure enterprise file management and cloud storage platform. This repository details the high-availability infrastructure and deployment architecture designed to support heavy enterprise payloads across global Tier-1 markets.

The environment is strictly Production-First. It bridges a high-performance decoupled application core with industrial-grade reliability.

Infrastructure Topology

graph TD
    Client([Enterprise API Consumers]) -->|HTTPS / WSS| CF[Cloudflare WAF & CDN Edge]
    
    subgraph Zero-Downtime Orchestration
        CF -->|Validated Traffic| Proxy[Kamal Proxy]
        
        subgraph Edge Delivery Nodes
            Proxy -->|Dashboard Routes| NextJS[Next.js 16 Standalone]
        end
        
        subgraph Unified Application Core
            Proxy -->|API Traffic| Laravel[Laravel 12 API & Nginx]
            Laravel -->|Supervisord Managed| Worker[Internal Queue Workers]
            Worker -.->|Fires Webhook Events| Client
        end
        
        subgraph Stateful Persistence Layer
            Laravel -->|Tenant & Billing Data| PG[(PostgreSQL 16)]
            Laravel -->|High-Concurrency Queue| Redis[(Redis 8 Accessory)]
            Worker -->|Job State| Redis
            Laravel -->|Direct Payload Stream| R2[(Cloudflare R2 Storage Vaults)]
            Worker -->|Async Remote Uploads| R2
        end
    end
    
    classDef proxy fill:#2563eb,stroke:#fff,stroke-width:2px,color:#fff
    classDef edge fill:#f59e0b,stroke:#fff,stroke-width:2px,color:#fff
    classDef core fill:#dc2626,stroke:#fff,stroke-width:2px,color:#fff
    classDef data fill:#059669,stroke:#fff,stroke-width:2px,color:#fff
    classDef external fill:#4b5563,stroke:#fff,stroke-width:2px,color:#fff
    
    class Proxy proxy
    class NextJS edge
    class Laravel,Worker core
    class PG,Redis,R2 data
    class Client external
Loading

Repository Architecture (V2 Enterprise Refactor)

This repository contains the sanitized reference blueprints for the R2Upload SaaS infrastructure. We use these specific configurations to enforce strict GitOps immutability and multi-node orchestration.

  • .github/workflows/: We use these pipelines to completely eliminate manual server interventions. It contains the exact Continuous Integration gates and Continuous Deployment actions required to execute atomic traffic swapping and optimize registry storage.
  • .kamal/: We use these lifecycle hooks to execute pre-flight billing validation and dispatch automated post-deployment telemetry. It also houses the strict zero-trust secret templates required to map Cloudflare R2 tokens into the orchestrator.
  • r2upload-api/: We use this isolated environment to compile the PHP 8.4 and Laravel 12 core. The reference Dockerfile proves our usage of Supervisord to natively manage internal Redis queue workers and Nginx within a single unified container boundary.
  • config/: We use these orchestration files (deploy.yml and deploy.web.yml) to govern our Kamal 2 traffic proxy. They prove our specific FinOps routing to Cloudflare R2 storage vaults and our zero-downtime health check parameters.
  • r2upload-web/: We use this boundary to containerize the Next.js 16 edge nodes. The multi-stage Dockerfile proves our strict standalone extraction methodology engineered to guarantee sub-200ms global latency.
  • docker-compose.yml: We use this localized configuration to guarantee 100% stateful parity between a developer's local machine and the live production database cluster without relying on heavy cloud simulations.

Locked Performance Baselines

  • Uptime Target: >99.9% via a zero single point of failure container-native architecture.
  • Global Latency: Sub-200ms latency enforced by edge computing and optimized database indexing.
  • MTTR: <60s via automated self-healing rollouts and strict continuous delivery pipelines.

The Architecture Stack

The system operates on a fully decoupled micro-architecture.

  • Edge Delivery & Security: Cloudflare CDN, WAF, and global DNS routing.
  • Frontend Edge Node: Next.js 16 deployed as a standalone Docker container.
  • API Core: Laravel 12 API handling rate limiting, Stripe billing, and asynchronous webhook dispatching.
  • Stateful Persistence: PostgreSQL 16 for relational data and multi-tenant resource quotas.
  • High-Concurrency Queue: Redis 8 managing background job processing and caching layers.
  • External Storage: S3-Compatible Storage nodes strictly isolated for enterprise payload persistence.

Deployment & Orchestration

The deployment pipeline is fully automated to guarantee zero-downtime rollouts.

  • Containerization: 100% Dockerized environments isolating the Next.js frontend, Laravel API, PostgreSQL, and Redis instances.
  • Continuous Integration: GitHub Actions pipelines handle automated testing, static analysis via PHPStan, and pushing immutable images to GitHub Container Registry.
  • Continuous Delivery: Kamal 2 orchestration utilizing kamal-proxy to execute atomic traffic swapping, manage zero-downtime rolling updates, and instantly roll back unhealthy deployments.

Security Posture

  • Multi-layer defense-in-depth utilizing Cloudflare WAF to block malicious payloads at the edge.
  • Hardened Nginx reverse proxies within the API containers.
  • Strict API key validation and rate-limiting middleware segmented by subscription tiers.

About

V2 Enterprise Refactor: High-availability SaaS architecture for R2Upload. Features a decoupled Next.js edge and Laravel 12 API core. Engineered for Zero-Egress cloud economics utilizing Cloudflare R2 Vaults and Supervisord-managed Redis workers. Orchestrated via Kamal 2 for >99.9% uptime.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Contributors

Languages