Deployment guide and API reference for NXTN Bot.
Telegram ──▶ grammY Bot (src/bot/)
├── Middleware: session, auth, rate-limit, conversations
├── Command handlers (src/bot/handlers/command.ts)
├── AI Agent (src/agent/) ◀── Claude (Anthropic API)
│ └── Tool executors (src/agent/executors/*.ts)
└── Webhook HTTP server (src/bot/webhook.ts)
├── GET /api/console/* — admin dashboard
└── GET/POST/PUT/DELETE /api/miniapp/* — mini app
Background workers (BullMQ + Redis):
├── tx-confirm.worker — polls chain for transaction confirmations
├── portfolio.worker — refreshes position values
├── arb.worker — executes arbitrage opportunities
└── auto-order.worker — runs DCA / limit / stop-loss orders
Databases:
├── PostgreSQL (Prisma) — users, wallets, positions, transactions, orders
└── Redis — sessions, BullMQ queues, confirmation gates