The Problem
Cloud storage is expensive. S3, GCS, Azure Blob — they all charge per GB stored and per request. For personal projects, side hustles, or small teams, these costs add up fast.
I wanted something that was:
- Free (actually free, not free-tier-that-expires)
- S3-compatible (works with aws-cli, rclone, any S3 SDK)
- Serverless (no servers to maintain)
- Unlimited storage
The Solution: TG-S3
I built TG-S3 — an S3-compatible storage gateway that uses Telegram as the storage backend and runs on Cloudflare Workers (free tier).
How It Works
TG-S3 uses a 3-tier storage hierarchy:
- Cloudflare CDN — cached content for fast reads
- Cloudflare R2 — persistent cache for files up to 20MB
- Telegram API — unlimited file storage (up to 2GB per file with VPS proxy)
Metadata lives in Cloudflare D1 (SQLite), and the S3 API gateway runs serverlessly on Cloudflare Workers.
Features
- 21 S3 API operations including multipart uploads and presigned URLs
- Works with aws-cli, rclone, any S3 client
- Telegram Bot with file management commands
- Web Mini App built into Telegram (EN/CN/JP/FR)
- Share links with password protection, expiration, download limits
- Multi-credential auth with per-bucket permissions
- Optional media processing (image conversion, video transcoding)
-
One-command deployment:
./deploy.sh
Cost
- Core functionality: $0 (Cloudflare free tier)
- Large file support (>20MB): ~$4/month VPS (optional)
Quick Start
git clone https://github.com/gps949/tg-s3.git
cd tg-s3
# Configure your Telegram bot token and chat ID
./deploy.sh
Then use it like any S3 bucket:
aws s3 ls s3://my-bucket --endpoint-url https://your-worker.workers.dev
aws s3 cp ./photo.jpg s3://my-bucket/photos/ --endpoint-url https://your-worker.workers.dev
Or with rclone:
[tg-s3]
type = s3
provider = Other
endpoint = https://your-worker.workers.dev
access_key_id = your-key
secret_access_key = your-secret
Architecture
The system is built with TypeScript, uses AWS SigV4 for authentication, and deploys via Wrangler v3. The Telegram Bot API handles file upload/download, while Cloudflare's edge network handles caching and CDN.
Cloudflare Tunnel integration is available for secure VPS connectivity when large file support is needed.
Why Telegram?
Telegram offers unlimited cloud storage for files up to 2GB, with a generous API. Files stored on Telegram are persistent, encrypted, and accessible globally. By using Telegram as a storage backend and wrapping it with an S3-compatible API, we get the best of both worlds.
Open Source
TG-S3 is fully open source. Check it out, star it, and let me know what you think!
TG-S3
Telegram-backed S3-compatible storage on Cloudflare Workers
TG-S3 turns Telegram into an S3-compatible object storage backend. Files are stored as Telegram messages, metadata lives in Cloudflare D1, and the whole thing runs on Cloudflare Workers with zero runtime dependencies.
Features
- S3-compatible API -- 21 operations including multipart upload, presigned URLs, and conditional requests
- Unlimited free storage -- Telegram provides the storage layer at no cost
- Three-tier caching -- CF CDN (L1) -> R2 (L2) -> Telegram (L3) for fast reads
- Telegram Bot -- Manage files, buckets, and shares directly from Telegram
- Mini App -- Full-featured web UI inside Telegram with file browser, uploads, and share management
- File sharing -- Password-protected share links with expiry, download limits, and inline preview
- Large file support -- Files up to 2GB via optional VPS proxy with Local Bot API
- Media processing -- Image conversion (HEIC/WebP), video transcoding…
Built with TypeScript, Cloudflare Workers, and the Telegram Bot API.
United States
NORTH AMERICA
Related News
CBS News Shutters Radio Service After Nearly a Century
3h ago
Officer Leaks Location of French Aircraft Carrier With Strava Run
3h ago
White House Unveils National AI Policy Framework To Limit State Power
3h ago
Microsoft Says It Is Fixing Windows 11
3h ago
Can Private Space Companies Replace the ISS Before 2030?
3h ago