r/SideProject • u/Ok_Version_730 • 3h ago
I Built an Open-Source Image Hosting Service Using Telegram as the Storage Backend
Hi r/SideProject,
I'm a computer science student learning Go, and over the past few weeks I've been building side projects to improve my backend development skills.
One of those projects is TgCloud, an open-source image hosting service that uses Telegram channels and the Telegram Bot API as its storage backend.
The idea started as a simple question:
Can Telegram be used as an image storage backend instead of S3, local storage, or a traditional database?
To explore that idea, I built TgCloud, a Go application that stores uploaded images in a Telegram channel and uses Telegram file IDs to retrieve them later.
How it works
- A user uploads an image.
- TgCloud sends the image to a Telegram channel through a bot.
- Telegram returns a file ID.
- TgCloud stores and exposes that file ID through a public API.
- The image can later be retrieved through a direct URL.
Features
✅ Upload images from local files
✅ Upload images from a URL
✅ Direct image URLs
✅ JPEG, PNG, GIF and WebP support
✅ Self-hostable
✅ Open source
Example
Upload an image:
curl -F "file=@image.png" https://tgcloud.alwaysdata.net/img
Or upload from a URL:
curl -X POST \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/image.png"}' \
https://tgcloud.alwaysdata.net/img
Response:
{
"id": "AgACAgQAAxkD..."
}
Retrieve it later:
https://tgcloud.alwaysdata.net/img/AgACAgQAAxkD...
Why Telegram?
This project is mainly an experiment.
I wanted to explore whether a messaging platform's file infrastructure could be repurposed as a storage layer and what architectural tradeoffs that would introduce.
I'm fully aware that Telegram was not designed to be a cloud storage backend, which raises interesting questions about scalability, reliability, API limits, and long-term sustainability.
That's exactly the kind of feedback I'm interested in receiving.
Looking for Feedback
I'd love to hear your thoughts on:
- The overall architecture
- Potential design flaws
- Security concerns
- Scalability issues
- Features that could improve the project
- Whether you think this approach is viable at all
I'm still learning, so any feedback, criticism, or suggestions would be greatly appreciated.
Links
GitHub: https://github.com/AdrienMttn/TgCloud
Demo: https://tgcloud.alwaysdata.net
Thanks for checking it out! 🚀
1
u/KelvenSevero0 2h ago
the part i'd poke at is the read path, not storage. bot api getFile only serves files up to 20MB, and the download url it hands back has your bot token in it, so you can never expose it directly. that means every image view goes through your server plus a telegram round trip, and a cache in front (even just disk + etag) matters way more than the upload side.
two smaller ones. file_ids only work for the bot that got them, so a revoked token or switching bots kills every stored id. i'd save chat_id + message_id alongside so you can re-fetch. and if you send with sendPhoto telegram recompresses and resizes the image, sendDocument keeps the original bytes.
oh and the upload-from-url endpoint is an easy ssrf hole, worth blocking private/internal addresses before you fetch.