A production-grade, screamingly-fast static file CDN paired with a stunning dark-themed CRUD admin dashboard. Engineered to run entirely at the Vercel Edge for sub-millisecond delivery, maximum scalability, and bulletproof security.
Live URL Example: https://static.yourdomain.com/gamepad/styles.css
Admin Portal: https://static.yourdomain.com/admin (Auth-protected)
graph TB
subgraph "Client Tier"
Browser["Browser / Client App"]
end
subgraph "Vercel Global Edge Network"
CDN["Vercel Edge CDN Cache"]
end
subgraph "Next.js App Router (Edge Runtime)"
Middleware["middleware.ts (Clerk Gatekeeper)"]
CDNEngine["/[...path]/route.ts<br/>(Edge serving, headers, CORS)"]
PublicStats["/api/public-stats<br/>(Edge aggregate stats)"]
end
subgraph "Next.js Serverless Tier (Node.js)"
AdminPages["Admin Panel Dashboard UI"]
APIRoutes["Admin APIs (CRUD, Purge, Sign-in)"]
end
subgraph "High-Performance Cloud Storage"
Blob["Vercel Blob (Object Storage)"]
KV["Vercel KV / Upstash Redis (Metadata & Limits)"]
end
Browser -->|"GET /gamepad/styles.css"| CDN
CDN -->|"Cache MISS"| CDNEngine
CDNEngine -->|"Fetch Meta"| KV
CDNEngine -->|"Stream / Proxy"| Blob
Browser -->|"GET /admin/*"| Middleware
Middleware -->|"Allow Authenticated"| AdminPages
AdminPages -->|"Fetch Admin APIs"| APIRoutes
Browser -->|"Direct Upload (Multipart)"| Blob
APIRoutes -->|"Presign Upload / Delete"| Blob
APIRoutes -->|"Write metadata indexes"| KV
- Framework: Next.js 14 (App Router)
- CDN Engine: Built entirely as a Next.js Catch-All route running on the Edge Runtime to bypass serverless cold starts and stream files globally with zero latency.
- Storage: Vercel Blob for highly available, scalable file object storage.
- Metadata & Indexing: Vercel KV (Upstash Redis) for sub-millisecond mapping of custom paths to physical Blob URLs, folder structures, and real-time statistics.
- Authentication: Clerk Authentication with secure OAuth and passwordless single-sign-on (SSO) integrated at the edge.
- Rate Limiting: Custom Edge-native sliding-window rate limiter using Redis pipelines. Identifies clients via secure SHA-256 multi-dimensional environment fingerprinting (IP + User Agent + Accept Language + Platform).
- Premium UI Design: Hand-crafted, zero-dependency Dark UI incorporating backdrop filters (glassmorphism), harmonized HSL color tokens, responsive layouts, skeleton states, and micro-animations.
To run this project, you need credentials for Vercel Blob, Vercel KV, and Clerk.
Create a .env.local file in the root directory (based on .env.local.example):
# Vercel Blob Token
STATIC_BLOB_READ_WRITE_TOKEN="vercel_blob_rw_..."
# Vercel KV (Upstash Redis)
STATIC_KV_REST_API_URL="https://..."
STATIC_KV_REST_API_TOKEN="..."
# Clerk Authentication Keys
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY="pk_..."
CLERK_SECRET_KEY="sk_..."
# Clerk Redirect Mappings
NEXT_PUBLIC_CLERK_SIGN_IN_URL=/admin/sign-in
NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL=/admin
NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL=/admin
# Application Context
NEXT_PUBLIC_CDN_BASE="https://static.yourdomain.com"
MAX_FILE_SIZE_MB=500This CDN is designed to be open source while providing commercial-grade security for your files:
- Anti-Scraping / No Direct Directory Listing: It is impossible to list, scrape, or search for files without knowing the exact URL. Requests for missing files or blocked sessions return generic 404s to block directory scanners.
- Edge Traversal Blocking: Aggressive path parameter sanitization blocks double encoding, control characters, null bytes, and traversal commands (e.g.
../). - Robust CORS Control: Serves files with
Access-Control-Allow-Origin: *so you can hotlink fonts, styles, scripts, and media across different sites safely, complete with instant Edge-basedOPTIONSpreflight responses. - Caching Headers: Files are served with
public, max-age=31536000, immutablealongside server ETag checking, resulting in instant304 Not Modifiedpayload-free responses. - Robots.txt & X-Robots-Tag: Built-in dynamic robots handler and HTTP headers instruct AI scrapers and search bots to bypass indexing your asset files and administrative backends.
- Interactive Analytics: Track storage usage against limits, check indexed counts, and watch live status logs.
- File Browser: Fluid visual hierarchy supporting grid/list layouts, real-time filtering, instant breadcrumb jumps, folder nesting, renaming, moving, and link generation.
- Direct Multipoint Uploads: Supports drag-and-drop multi-file concurrent uploads. Employs secure client-side pre-signing so uploads bypass Serverless Function timeouts/limits entirely.
- Instant Cache Purger: Purge metadata and invalidate Vercel CDN caches instantly for any given file path.
This project is built to deploy on Vercel with a single click.
Create a new repository on your GitHub account and push the code:
git remote add origin git@github.com:yourusername/static.git
git branch -M main
git push -u origin main- Go to Clerk.com and create a new application.
- Enable the Sign In options you prefer (Email, Google, etc.).
- Under API Keys, copy the Publishable Key and Secret Key.
- Log in to your Vercel Dashboard.
- Click Add New > Project, and select your GitHub repository.
- In the Environment Variables section, add all keys from
.env.local.example(using your Clerk keys, Vercel KV URLs, etc.). - Click Deploy.
- Once deployed, navigate to the Storage tab on your Vercel Project Dashboard.
- Connect a new Vercel Blob database.
- Connect a new Vercel KV (Redis) database.
- Vercel will automatically inject
STATIC_BLOB_READ_WRITE_TOKEN,KV_URL,STATIC_KV_REST_API_URL, andSTATIC_KV_REST_API_TOKENto your Environment Variables. - Redeploy/Promote to Production so Vercel hooks up the storage tokens.
-
Install Dependencies:
npm install
-
Start Dev Server:
npm run dev
-
Quality Verification Hooks:
# TypeScript verification npx tsc --noEmit # Lint check npm run lint # Production build npm run build
This project is open source and licensed under the MIT License.