Distributed personal cloud storage powered by Telegram file transport, Supabase metadata, and a React web interface.
TDrive is a full-stack file storage platform that chunks large files, streams chunk uploads through Telegram, and tracks file metadata in Supabase. The application provides a modern dashboard for upload, search, starring, trash/restore, and download workflows, while offloading edge-sensitive operations to dedicated Cloudflare Workers.
- 🚀 Large files are split into chunks for resilient, incremental uploads.
- 🔐 User-level access is enforced via Supabase Auth tokens validated by the backend.
- 🌍 Cloudflare Workers handle edge upload/download tasks close to users.
- 🧩 Frontend, backend, and edge runtimes are cleanly separated for independent scaling.
TDrive/
|- frontend/ # React + Vite client application (UI, auth session, upload orchestration)
|- backend/ # Express API (auth guard, file metadata lifecycle, business rules)
|- cloudflare/
| - tdrive-uploader/ # Worker: receives chunks, forwards to Telegram, writes chunk metadata
| - tdrive-worker/ # Worker: fetches Telegram file binaries for downloads
|- README.md
| Directory | Responsibility | Key Runtime |
|---|---|---|
| frontend | User interface, Supabase session handling, chunk upload coordination | Browser (React + Vite) |
| backend | Authenticated API, metadata CRUD, file lifecycle, search, download link assembly | Node.js + Express |
| cloudflare | Edge upload and download workers for Telegram/Supabase integration | Cloudflare Workers |
- React 19
- Vite 7
- React Router
- Axios
- Supabase JS client
- Tailwind CSS 4 + Radix UI primitives
- Vitest + Testing Library
- Node.js (ES modules)
- Express 5
- Grammy (Telegram Bot API)
- Supabase JS client
- Express Rate Limit + CORS + dotenv
- Cloudflare Workers (Wrangler)
- Worker A: upload proxy + chunk metadata persistence
- Worker B: Telegram file stream proxy for downloads
- Vitest for Worker tests
- Node.js 18+
- npm 9+
- A Supabase project with tables from backend/database/schema.sql
- Telegram bot token and chat ID
- Cloudflare account for Worker deployment/testing
git clone https://github.com/your-org/tdrive.git
cd tdriveInstall dependencies:
cd frontend
npm installCreate environment template and local env file:
# macOS/Linux
cp .env.example .env
# Windows (PowerShell)
Copy-Item .env.example .envSuggested frontend .env.example:
VITE_API_URL=http://localhost:8080
VITE_UPLOAD_WORKER_URL=http://127.0.0.1:8787
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your_supabase_anon_keyRun frontend dev server:
npm run devInstall dependencies:
cd ../backend
npm installCreate environment template and local env file:
# macOS/Linux
cp .env.example .env
# Windows (PowerShell)
Copy-Item .env.example .envSuggested backend .env.example:
PORT=8080
BOT_TOKEN=your_telegram_bot_token
CHAT_ID=your_telegram_chat_id
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
CLOUDFLARE_URL=http://127.0.0.1:8788Run backend API:
node index.jsUploader worker:
cd ../cloudflare/tdrive-uploader
npm install
npm run devSet worker secrets/vars used at runtime:
- BOT_TOKEN
- TELEGRAM_CHAT_ID
- SUPABASE_URL
- SUPABASE_SERVICE_ROLE_KEY
Download worker:
cd ../tdrive-worker
npm install
npm run devSet worker secret:
- BOT_TOKEN
# frontend tests
cd ../../frontend
npm run test:ci
# worker tests
cd ../cloudflare/tdrive-uploader && npm test
cd ../tdrive-worker && npm testTDrive is designed to deploy each layer independently:
- Frontend deploys as a static React build (for example on Cloudflare Pages, Vercel, or Netlify).
- Backend deploys as a Node.js service (for example Docker/container host, VM, or PaaS).
- Cloudflare Workers deploy with Wrangler and provide the edge bridge to Telegram and Supabase.
- Frontend sends upload metadata to backend.
- Frontend streams chunks to tdrive-uploader Worker.
- Uploader Worker sends chunks to Telegram and records chunk references in Supabase.
- Backend finalizes upload and exposes file metadata APIs.
- On download, backend resolves Telegram file paths and returns Cloudflare download URLs.
- tdrive-worker fetches chunk binaries from Telegram and streams them back.
Contributions are welcome and appreciated.
- Fork the repository.
- Create a feature branch.
- Run tests before opening a pull request.
- Open a PR with a clear description, rationale, and screenshots/logs where relevant.
Built for practical, distributed file handling across web, API, and edge runtimes.