DEV Community

TateLyman
TateLyman

Posted on

How I Built a Telegram Trading Bot with 44 Commands (Full Architecture Breakdown)

I built @solscanitbot — a Telegram trading bot for Solana with 44 commands, 12 background workers, and 21 data files. Here's the architecture.

Stack

  • Pure Node.js (no framework, built-in https module)
  • Solana Web3.js for blockchain interaction
  • Jupiter V6 API for swaps
  • Jito MEV protection for transaction bundling
  • Helius RPC for fast reads

Core Features

  • Buy/sell any Solana token
  • Copy trading (mirror any wallet)
  • DCA (dollar cost averaging)
  • Limit orders
  • Token sniping (new token launches)
  • Portfolio tracking
  • Price alerts
  • Referral system (50% fee share)
  • Premium tiers (Telegram Stars + SOL payment)
  • Admin panel

Architecture

Single File Design

The entire bot is one 5,500-line JavaScript file. No TypeScript, no build step, no framework overhead. Just node bot.js and it runs.

Why? Because:

  • Zero cold start time
  • No dependency management nightmares
  • Easy to deploy (copy one file)
  • Simple to debug (everything is grep-able)

Data Storage

21 JSON files for user wallets, positions, alerts, orders, settings, referrals, etc. No database needed — JSON files are fast enough for 30 users.

Revenue Streams Built In

  1. 1% trading fee (0.5% premium)
  2. Premium subscriptions (Stars + SOL)
  3. Referral kickbacks
  4. Token promotion fees
  5. Volume bot fees
  6. P2P transfer fees

Background Workers

12 interval-based workers running:

  • Price monitoring
  • Order execution
  • DCA scheduling
  • Alert checking
  • Copy trade mirroring
  • Competition tracking

What I Learned

  1. Start with one file. Split later only if you need to.
  2. JSON files are fine for small user bases.
  3. Telegram API is excellent — inline keyboards, Stars payments, Mini Apps all work great.
  4. MEV protection matters on Solana. Jito bundles prevent sandwich attacks.
  5. Revenue from day one. Build monetization into the core, not as an afterthought.

Try It

Want a custom Telegram bot? I build them for $200-$1000. DM me or email lymantate2@gmail.com.

Top comments (0)