43e36b76294560dbd31f66b6cd070cb27f7b688e
Optimize the S3 GET path for chunked/multipart objects and reduce Telegram API round-trips: - object-stream: fetch object parts concurrently (bounded, in-order fan-in) instead of serializing N sequential Telegram CDN fetches. Response latency is now ~the slowest part fetch, not the sum of all part fetches. - bot-pool.getFileInfo: cache file_id -> file_path in the existing in-memory cache so repeated S3 GET/HEAD of the same object skip the Telegram API call (file-controller had its own cache wrapper; the S3 path did not). - chunked-storage + s3-controller: resolve multipart/chunked part CDN URLs concurrently via Promise.all instead of sequentially. - s3-controller multipart: await writer.end() before re-reading the temp part file to avoid a flush race. Adds object-stream-parallel.test.ts covering in-order fan-in, byte ranges, and single-part responses even when the slowest part resolves out of order.
Telegram Bot Uploader Backend
Backend production-ready untuk upload file ke Telegram yang tersimpan di private channel.
Setup
- Siapkan PostgreSQL database (produksi: database
uploadervia PgBouncer pool di100.121.180.82:6432) - Setup environment:
cp .env.example .env - Edit
.envdengan nilai yang sesuai (lihatDATABASE_URL,PORT=4000) - Create table:
bun run db:migrate - Install dependencies:
bun install
Telegram Private Channel Setup
- Buat private channel Telegram
- Tambah bot sebagai admin di channel
- Dapatkan
STORAGE_CHANNEL_ID(misalnya -1001234567890)
Running
bun run dev # Development mode
bun run start # Production mode
Deployment (Produksi — Nix + systemd)
Infra lama berbasis Docker + Traefik sudah dihapus dari orangevps (2026-08-02).
- Host: orangevps
- Service: systemd unit
teleuploader(env via/etc/teleuploader/env/ BWS secrets) - Build: Nix flake (
flake.nix) —nix build .#teleuploader→nix copy→systemctl restart teleuploader - CI:
.github/workflows/deploy.yml(Gitea Actions / GitHub Actions) - Port:
4000(PORTenv) - Domain:
https://upload.asepharyana.my.id - Reverse proxy: Caddy (bukan Traefik/Docker)
- Database:
postgresql://asephs:***@100.121.180.82:6432/uploader(PgBouncer pool di imrnes, bukan 5432/localhost) deploy.sh&Dockerfile&docker-compose.ymlbersifat legacy — jangan dipakai untuk deploy produksi.
API Endpoints
POST /api/upload- Upload fileGET /f/:public_id- Download redirectGET /file/:public_id/info- File metadataGET /health- Health check
FAQ
URL permanen maksudnya apa?
URL backend tetap permanen: https://upload.asepharyana.my.id/f/{public_id}
Ini berarti URL service Anda fix, bukan jaminan file Telegram abadi.
Testing
Gunakan bot Telegram untuk upload, atau upload API langsung via HTTP.
Languages
TypeScript
90.1%
HTML
7.6%
Shell
1.7%
Nix
0.5%
Dockerfile
0.1%