Powered by Cloudflare Workers, Cloudflare KV, and Telegram's very generous (and free) file infrastructure.
Tired of paying for S3 / Cloudinary / Imgix / ... ?
Ever looked at Telegram and thought:
“This thing has unlimited storage and a CDN — why not abuse it politely?”
Welcome to Pichost — a clean, fast, personal image host that treats Telegram like a free object store.
- You upload → image goes to your private Telegram channel via bot
- Metadata (file_id + owner) saved in Cloudflare KV
- Viewing → Worker asks Telegram for temporary file URL → streams directly through Cloudflare Edge (with caching)
Cloudflare never stores or buffers the full image — pure proxy + edge cache bliss.
sequenceDiagram
autonumber
actor You
participant Frontend
participant Worker
participant KV
participant Telegram
You->>Frontend: Drag / Paste / Select image
Frontend->>Worker: POST /upload (with session cookie)
Worker->>Telegram: sendPhoto(chat_id, file)
Telegram-->>Worker: {ok, result: {photo: […], message_id}}
Worker->>KV: put(`img:${shortId}`, {file_id, owner, message_id, uploaded})
Worker-->>Frontend: {id, raw: `/raw/${id}`}
Note over You,Telegram: ───── Viewing ─────
Frontend->>Worker: GET /raw/abc12345
Worker->>KV: get(`img:abc12345`)
KV-->>Worker: {file_id, …}
Worker->>Telegram: getFile(file_id)
Telegram-->>Worker: {file_path}
Worker->>Telegram: https://api.telegram.org/file/bot…/${file_path}
Telegram-->>Worker: image bytes (stream)
Worker-->>You: image stream + Cache-Control: public, max-age=86400
- Zero storage cost — Telegram pays the bill
- Authentication:
- Username + password (stored as SHA-256 hash in KV)
- “Sign in with Google” (OAuth ID token validation)
- Modern single-file frontend (no build tools, no npm)
- Drag & drop + Ctrl+V (paste) support
- Responsive gallery with lazy loading
- One-click copy link / view full / delete (owner only)
- Dark mode (system + manual toggle)
- 4 accent colors: blue (default), emerald, violet, rose
- Glassmorphism + Lucide icons
- Edge-cached image delivery via Cloudflare
- Session cookie (HttpOnly, Secure, SameSite=None)
When you first open index.html, it points to the demo backend:
https://pichost.vivekpereiraalbert.workers.dev
→ Feel free to test everything instantly (drag images, try Google login, etc.).
BUT — very important:
Every image you upload through this default backend lands in my private Telegram channel.
Technically I can see them.
I’m not watching and I don’t care about your memes — but privacy matters.
Strong recommendation:
Deploy your own Worker + KV + Telegram bot/channel (takes ~10–15 min).
Then change the backend URL in the Settings tab (or pre-settings modal).
Your images → your channel → only you can see them (and anyone you give the direct /raw/xxxxxx link to).
-
Talk to @BotFather →
/newbot→ copy Bot Token -
Create a private channel
-
Add your bot as Administrator (must allow posting & deleting)
-
Get Chat ID:
- Forward any message from the channel to @userinfobot
- It usually looks like
-1001234567890
You can deploy the backend in two ways.
This will automatically:
- Deploy the
worker.jsbackend - Ask your Telegram Bot Token
- Ask your Telegram Chat ID
- Create and bind the IMG_KV namespace
Click below and follow the prompts:
After deployment finishes, Cloudflare will give you a Worker URL, which will look like:
https://pichost-yourname.workers.dev
Save this — you'll need it for the frontend.
- Go to Cloudflare Dashboard → Workers & Pages → Create Worker
- Give it a name (for example
pichost-myname) - Open the Worker editor and replace the default code with the contents of
backend/worker.js - Go to Settings → Variables
- Add the following variables:
TELEGRAM_BOT_TOKEN = your bot token
TELEGRAM_CHAT_ID = your channel ID (with the -100…)
- Go to Settings → KV Namespace
- Create a namespace named:
IMG_KV
- Bind it to the Worker with variable name:
IMG_KV
- Click Deploy
Once deployed, you will receive a Worker URL like:
https://pichost-yourname.workers.dev
-
Google Cloud Console → APIs & Services → Credentials
-
Create OAuth 2.0 Client ID → Web application
-
Add Authorized JavaScript origins:
https://your-domain.pages.dev(orhttp://localhost:5500etc.)
-
Copy Client ID
-
Paste it into
index.htmlline containing:const GOOGLE_CLIENT_ID = "…";
-
Save
index.htmlsomewhere -
Serve it properly (cookies won’t work with
file://):- VS Code Live Server
npx serve- Cloudflare Pages / Vercel / Netlify / GitHub Pages
-
Open → if backend not set → pre-settings modal appears → enter your Worker URL
Done. Upload away.
- Telegram Bot API: 20 MB per file (photo)
- Images are public by link —
/raw/xxxxxxis guessable (8-char short ID)
→ great for sharing, terrible for private documents - No bulk delete / folders / search (yet)
- Abuse Telegram too hard → bot/channel can get banned
- KV list operation limited to 1000 keys per call (pagination not implemented)
Use responsibly — personal use, portfolios, small projects, memes.
- Telegram — for absurdly generous free file hosting & CDN
- Cloudflare — free Workers, KV, edge caching/streaming
Made with ☕, rage against cloud bills, and questionable life choices
by Vivek Pereira Albert (@TheGT2Angel)
License
MIT — fork it, break it, host cat pictures with it — just don’t blame me when Telegram eventually notices.
Enjoy your $0 storage. 🚀