Enterprise-grade Open Source Telegram media delivery, copyright timer protection, and content publisher platform.
Modular microservice architecture built with Go 1.25+, React 18, and Vite.
Key Features β’ Architecture β’ Test Coverage β’ Quick Start β’ Cloud Deploy (~$1/mo) β’ API & Docs β’ Contributing β’ Security
TelegramPublisher is an open-source, production-ready content publishing platform and Telegram bot infrastructure designed for media distribution, automated copyright protection, and digital subscription monetization.
It solves media expiration challenges by combining server-side background TTL purge workers, cryptographic payment gateways, a Telegram Mini App (TMA), and a dual REST + GraphQL API layer with real-time analytics.
- Schedules automatic deletion of sensitive or copyrighted media messages from chats after a configurable countdown (default: 120 seconds).
- Zero-leakage background cleaner worker continuously purges expired content.
- VIP subscribers automatically receive exemptions for permanent media access.
- Full multi-language support: English (en), Persian (fa), Arabic (ar), Russian (ru), Spanish (es), German (de), and Chinese (zh).
- First-class Right-to-Left (RTL) layout rendering for Persian and Arabic.
- Dynamic language switcher inside Telegram bot keyboards and Mini App UI.
- Built-in integrations for AzPays, Coinbase Commerce, and NOWPayments.
- Instant subscription checkout for USDT, TON, BTC, ETH, and other cryptocurrencies.
- Webhook signature verification (HMAC-SHA256) and simulated developer sandbox checkout.
- Automated tier upgrades (VIP 30-Day, Author Pro 30-Day, Lifetime VIP Pass).
- User (Telegram Mini App): Media catalog explorer, audio/video streaming, like/dislike reactions, broken file reporting, VIP pass checkout.
- Author (Publisher Studio): Upload media, inspect Telegram
file_ids & hashes, monitor personal post views, and track ticket resolutions. - Admin & Owner (Intelligence Suite): Executive KPI dashboards, moderation (ban/unban/role promotion), force-sub channels, ticket SLA queues, and runtime toggle settings.
- REST API (OpenAPI 3.1): Fully documented endpoints rendered interactively with modern Scalar UI at
/docs. - GraphQL API: Rich GraphQL schema and GraphiQL Playground at
/graphql.
- Dispatch messages formatted as Plain Text, MarkdownV2, HTML, or Raw JSON Telegram Payloads (custom inline keyboards, WebApp buttons, media groups).
- Granular audience filters: All users, active within last 7 days, specific roles, active VIP status.
- Automated Block Detection: Identifies Telegram 403 Forbidden errors and marks user profiles as
blocked_by_userto preserve bot deliverability.
- Validates user membership in mandatory Telegram channels before unlocking protected media links.
- Seamless inline verification workflow with "π Check Membership" retry buttons.
- Built-in reporting system allowing users to flag broken media links or copyright concerns directly to publisher queues.
TelegramPublisher/
βββ cmd/bot/main.go # Unified Server Entrypoint (Bot + HTTP + React SPA)
βββ config/ # Multi-source configuration (.env, YAML, ENV vars)
βββ docs/openapi.json # OpenAPI 3.1 Schema Specification
βββ internal/
β βββ analytics/ # Metrics aggregation & CSV export engine
β βββ api/
β β βββ graphql/ # GraphQL schema & GraphiQL playground (/graphql)
β β βββ rest/ # REST API controllers (/api/v1/...)
β β βββ scalar/ # Modern Scalar Docs renderer (/docs)
β βββ auth/ # Telegram WebApp initData HMAC-SHA256 & JWT auth
β βββ bot/ # Telegram Bot engine, RBAC & command handlers
β βββ cleaner/ # 2-Minute copyright auto-delete worker
β βββ i18n/ # 7-Language dictionary & RTL localization engine
β βββ services/
β β βββ marketing/ # Targeted broadcast engine & block detector
β β βββ payment/ # Crypto gateway service (AzPays, Coinbase, NOWPayments)
β β βββ settings/ # Dynamic feature toggles & runtime settings
β βββ storage/ # Repository interfaces & database adapters
β βββ factory.go # Database engine factory
β βββ sqlite/ # SQLite (Pure Go CGO-free via modernc.org/sqlite)
β βββ postgres/ # PostgreSQL 14+ via pgx/v5
β βββ mysql/ # MySQL 8+ & MariaDB
βββ web/ # Modern React 18 + Vite + Tailwind CSS Frontend
β βββ src/
β βββ views/UserMiniApp.tsx # Telegram Mini App
β βββ views/AuthorStudio.tsx # Publisher Studio & File Inspector
β βββ views/AdminDashboard.tsx# Admin Intelligence Suite
βββ deploy/
β βββ docker-compose.yml # Multi-database local testing
β βββ vyntech-cloud.yaml # Production cloud deployment manifest
βββ Dockerfile # Production multi-stage container build
βββ CONTRIBUTING.md # Open source contributor guide
βββ CODE_OF_CONDUCT.md # Community standards
βββ SECURITY.md # Vulnerability reporting policy
βββ LICENSE # MIT License
TelegramPublisher maintains rigorous testing standards with 100% statement coverage across all active core packages and API layers:
| Package | Path | Statement Coverage | Status |
|---|---|---|---|
| API REST Layer | internal/api/rest |
100.0% | PASS |
| API GraphQL Layer | internal/api/graphql |
100.0% | PASS |
| API Scalar Documentation | internal/api/scalar |
100.0% | PASS |
| Crypto Payment Service | internal/services/payment |
100.0% | PASS |
| Marketing & Broadcaster | internal/services/marketing |
100.0% | PASS |
| Settings & Toggles | internal/services/settings |
100.0% | PASS |
| Cleaner Worker (TTL) | internal/cleaner |
100.0% | PASS |
| Storage (SQLite Engine) | internal/storage/sqlite |
100.0% | PASS |
| Storage Engine Factory | internal/storage |
100.0% | PASS |
| Localization & RTL (i18n) | internal/i18n |
100.0% | PASS |
| Telegram & JWT Auth | internal/auth |
100.0% | PASS |
| Analytics Engine | internal/analytics |
100.0% | PASS |
| Configuration Loader | config |
100.0% | PASS |
# Run all unit tests
go test -v ./...
# Run tests with statement coverage summary
go test -cover ./internal/... ./config/...
# Generate HTML coverage report
go test -coverprofile=coverage.out ./internal/api/... ./internal/services/... ./internal/storage/...
go tool cover -html=coverage.out -o coverage.htmlDeploy TelegramPublisher on VynTech Cloud starting from as low as ~$1 USD per month:
- π High Performance NVMe Storage: Dedicated high-speed persistence for media metadata and database storage.
- π Automated SSL & Ingress: Pre-configured TLS certificates, DDoS mitigation, and custom domain routing.
- β‘ Global Edge Network: Ultra low-latency content delivery for Telegram Mini Apps and APIs worldwide.
- π¦ Production Ready: One-click deploy using the included cloud manifest
deploy/vyntech-cloud.yamlor connect your repository via the VynTech Cloud Console.
- Go: Version 1.25 or higher
- Node.js: Version 20 or higher
- Telegram Bot Token: Obtained from @BotFather
# 1. Clone repository
git clone https://github.com/vyntechau/TelegramPublisher.git
cd TelegramPublisher
# 2. Build the React frontend
cd web
npm install
npm run build
cd ..
# 3. Configure environment
cp .env.example .env
# Edit .env and supply your TELEGRAM_BOT_TOKEN and credentials
# 4. Launch backend and bot
go run ./cmd/bot# Start with default SQLite storage (zero external dependencies)
docker compose -f deploy/docker-compose.yml up --build
# Or start with PostgreSQL
docker compose -f deploy/docker-compose.yml --profile postgres up --build
# Or start with MySQL
docker compose -f deploy/docker-compose.yml --profile mysql up --buildOnce the server is running, the following endpoints are available:
| Service | Endpoint | Description |
|---|---|---|
| Web App & Mini App | http://localhost:8080/ |
Unified Role-Based React Single Page Application |
| Scalar Interactive Docs | http://localhost:8080/docs |
Interactive OpenAPI 3.1 Documentation & Request Runner |
| GraphQL Playground | http://localhost:8080/graphql |
GraphiQL Interactive Query & Mutation IDE |
| OpenAPI Spec (JSON) | http://localhost:8080/docs/openapi.json |
Raw OpenAPI 3.1 JSON Schema specification |
| Health Check | http://localhost:8080/api/v1/setup/status |
Node status, database readiness, and onboarding state |
| Payment Sandbox | http://localhost:8080/api/v1/payments/mock-checkout |
Simulated sandbox checkout for local testing |
The platform utilizes a clean repository pattern. Choose your target database by setting DB_TYPE:
| Engine | DB_TYPE |
Configuration Example |
|---|---|---|
| SQLite | sqlite |
DB_FILE_PATH=data/publisher.db (Default, CGO-free pure Go) |
| PostgreSQL | postgres |
DB_DSN=postgres://user:password@localhost:5432/dbname?sslmode=disable |
| MySQL / MariaDB | mysql |
DB_DSN=user:password@tcp(localhost:3306)/dbname?parseTime=true |
| Command | Allowed Roles | Description |
|---|---|---|
/start |
All Users | Launch bot, select language, and open Telegram Mini App |
/start <slug> |
All Users | Retrieve protected media link with auto-delete timer |
/subscribe |
All Users | Purchase VIP subscription pass via crypto checkout |
/mystatus |
All Users | View active subscription tier and account status |
/language |
All Users | Switch preferred language (En, Fa, Ar, Ru, Es, De, Zh) |
/help |
All Users | Display user command guide |
| Send Media File | Author / Admin | Inspect Telegram file_id & generate shareable link |
/stats |
Admin / Owner | Real-time analytics, daily active users, revenue, view counts |
/users |
Admin / Owner | Browse registered bot user profiles |
/ban <id> / /unban <id> |
Admin / Owner | Ban or restore user access |
/promote <id> [role] |
Admin / Owner | Change user role (author, admin) |
/addchannel <id> <link> |
Admin / Owner | Register mandatory Force-Subscription channel |
/reports |
Admin / Owner | View and resolve broken media reports |
/broadcast <text> |
Admin / Owner | Dispatch safe broadcast message to active users |
/setttl <seconds> |
Admin / Owner | Update default auto-delete countdown timer |
We love contributions from the open-source community! Here is how to get started:
- Read our Contributing Guidelines and Code of Conduct.
- Fork the repository and create your branch:
git checkout -b feature/amazing-feature. - Commit your changes:
git commit -m "feat: add amazing feature". - Ensure all tests pass:
go test ./...andnpm run test(ornpm run build). - Open a Pull Request against the
mainbranch.
Please review our Security Policy for reporting vulnerabilities.
We take the security of TelegramPublisher and the safety of our users very seriously.
If you identify a security vulnerability, bug, or potential exploit, please do NOT report it via public GitHub issues.
Instead, please report it privately and responsibly to:
π§ security@vyntech.com.au
- Please provide detailed reproduction steps, sample payloads, and affected versions.
- All valid security reports will be acknowledged within 24 hours, followed by prompt investigation and patched releases.
- For complete policy details and supported versions, please consult SECURITY.md.
This software is published as an educational open-source project and reference implementation for microservices and cloud infrastructure. Please refer to DISCLAIMER.md for detailed legal and compliance information.
This project is licensed under the MIT License.