ArylHive File Share Infrastructure
This core document provides an architectural breakdown of the File Share System within ArylHive. It details how users convert their underlying storage assets into securely shareable, gated links that handle millions of requests gracefully on the edge.
1. High-Level Architecture Overview
The File Share system utilizes a globally distributed Cloudflare Worker Edge combined with Turso (LibSQL) at the edge for sub-millisecond route resolution.
2. Core Components
A. The Edge Router (Worker)
The Cloudflare Worker evaluates every incoming request to *.aryl.cloud:
- Subdomain Extraction: It strips the
[id]from[id].aryl.cloud. - Metadata Lookup: Queries the isolated Turso
share_dbfor the routing metadata associated with that ID. - Access Control: Evaluates whether the file requires authentication, a password, or lead capture (email gate).
- Proxying / Streaming: It creates a secure stream directly from the underlying file location (R2, B2, or Google Drive) directly to the end user without exposing original cloud URLs.
B. The Shares Database (Turso)
To ensure maximum speed, all share links belong to a dedicated Turso database isolated from the main application database.
id(Primary Key, nanoID) - e.g.,6p8r6kuser_id- The creator string referencefile_id/r2_path- The target asset pointerprovider- E.g.,google-drive,r2,b2visibility-publicorprivatepassword- Hashed password for gaterequire_email- Boolean gate for Lead Captureexpires_at- Timestamp logic for Guest user cleanups
C. The Lead Capture System (D1)
If a share link is gated behind require_email, the Worker intercepts the request and returns a lightweight visual UI form instead of the file.
- Emails are validated natively via RFC regex and Disposable Email Domain blocklists.
- Verified via Cloudflare DNS-over-HTTPS for active MX records.
- Automatically written to a highly-available Cloudflare D1 SQLite database rather than Turso to lower operational write-costs.
- A secure, short-lived cookie is dropped on the visitor's browser granting access to the asset.
3. The Request Lifecycle (Visualized)
Here is the exact step-by-step sequence of what happens when a user clicks a shared link like https://try-now-6p8r6k.aryl.cloud.
4. Advanced Technical Decisions
Cross-Origin / Domain Strategy
The platform separates raw website deployments (*.aryl.app) from shared files (*.aryl.cloud). Doing so prevents security vulnerabilities like cookie-stealing and XSS. If a user uploads a malicious HTML file and shares it via the platform, dropping it on .aryl.cloud prevents it from accessing the local context or cookies of their website deployments on .aryl.app.
Analytics Engine vs. Relational DB
File views are tracked using Cloudflare Analytics Engine rather than SQL UPDATE views = views + 1. Since a popular file share could get hit thousands of times a second, updating a relational database counter would cause extreme lock contention or API rate limits. Writing to Analytics Engine is non-blocking (fire-and-forget), immensely fast, and highly scalable. Periodically, the UI aggregates these raw edge events for the dashboard.
Next: Learn about The Edge Network →
