Static-Hosting

What problem does this solve?

Static hosting is how you host static files. IE if I have an HTML page I want to expose, or MP3 files I want to share, where do I put them in a deployment app?

What options exist?

Managed CDN wrappers are often the go-to choice, both handling file hosting and distribution, with CDNs.

  • Vercel / Netlify / AWS Amplify Hosting / Github Pages

For pure static hosting, we have a few options:

  • In the cloud: Object storage, like S3 buckets (AWS-Cloud), Cloudflare R2, CGS
  • Self-hosting: Nginx, Caddy, Apache

Trade Off Table

Managed CDNsObject Storagenginx
AvailabilityExtremely HighExtremely HighSingle point failure
DurabilityDepends on underlying object storageExtremely highLocal server reliability (no guarantee for backups, that’s a whole different topic)
ScalibilityDepends on underlying object storageArbitrarily highLocal server, capped to its horizontal capabilities
CostSimilar to object storage + small convenience premium; often free at small scaleDepends on provider: S3 is $0.023 per GB per month, although different tiers exist depending on data needs (access frequency)Minimal/none, just the cost of compute
SpeedFastest baseline, uses CDNLocation based, should be paired with CDNLocation based, should be CDN
File updatesDepends on CDN cache invalidation (TTL, or active invalidation)FastFast
Use caseFastest path to production, low configurationHighest configurability (e.g. geoblocking your application). Also great for serving user uploads.Sharing local resources, small batches of files to share, personal plex server

CDN - Static files should be paired with a CDN nearly every time.