How hu553in/telekilogram works
Project type and purpose
• Telekilogram is a single-service, backend-only Telegram bot written in Go.
• Purpose: allow users to follow RSS/Atom/JSON feeds and public Telegram channels, store feed subscriptions, schedule and send 24h digests or individual posts back to users via Telegram.
File structure
• Top level:
• main.go – application entry point
• justfile, scripts/ – build/deploy automation
• .env.example – environment configuration
• Package directories:
• bot/ – transport layer: Telegram API handlers (commands, callbacks, messages)
• feed/ – core business logic: fetching, parsing RSS/Atom/JSON, integrating with siftrss filters
• scheduler/ – job scheduler for daily digests
• database/ – persistence layer: migrations, DB connection, SQL queries
• models/ – domain models shared across layers
• ratelimiter/ – cross-cutting concern to throttle external API calls or message sends
• markdown/ – helper utilities to format content
• Support files:
• .github/workflows/ci.yml – CI pipeline
• scripts/ – systemd or Docker deployment scripts
README
• Describes functionality: follow/unfollow feeds, daily digest, manual digest, settings.
• Technical stack: Go, PostgreSQL (implied by SQL migrations), Telegram Bot API, Just, golangci-lint.
• Workflow: user → Telegram → Bot → Feed fetcher/parser → Database → Scheduler triggers digest → Bot → user.
1. Telegram Bot Interface (bot package)
2. Feed Processor (feed package + markdown helpers)
3. Scheduler (scheduler package)
4. Database (PostgreSQL + database/migrations + queries)
5. Rate Limiter (ratelimiter package)
6. External Services:
– Telegram API
– RSS/Atom/JSON feed endpoints
– Optional siftrss filter service
– User ↔ Telegram API ↔ Bot Interface
– Bot Interface → Database (read/write subscriptions & settings)
– Scheduler → Feed Processor (trigger fetch/parse)
– Feed Processor → Rate Limiter → External feeds
– Feed Processor → siftrss (optional filtering)
– Feed Processor → Database (store/update feed entries)
– Scheduler/On-demand commands → Bot Interface (render & send messages)
c. Architectural patterns & principles:
– Layered architecture:
• Transport layer (bot)
• Application/business layer (feed, scheduler)
• Data access layer (database)
• Cross-cutting (ratelimiter, logging)
– Modular monolith: packages grouped by functionality
– Dependency injection via package globals or passed contexts
d. Technologies & frameworks:
– Go modules (go.mod)
– PostgreSQL with SQL migrations (database/migrations)
– Telegram Bot API (bot.go handlers)
– Job scheduling (custom scheduler in scheduler package)
– Just build tool & shell scripts for deployment