Skip to content

Backend Stack

Backend is a single TypeScript codebase that powers both the Telegram bot and the Mini App API. It’s built using Bun for fast execution, with a focus on lightweight, maintainable, and highly performant architecture.

Core Framework & Language

  • TypeScript – Full type safety for both API and bot logic.
  • Bun – Node alternative for package management, execution, and fast bundling.
  • Elysia – Minimalist web framework to handle API requests and webhooks.

Telegram & Bot Integration

  • nyx-bot-client – Custom Telegram bot library developed exclusively.
  • Supports both Local Bot API server and official api.telegram.org, with local file (file://) handling for better compatibility.
  • Uses WEBHOOK_SECRET to secure webhooks at /bot-webhook.

Database & Caching

  • PostgreSQL – Database Engine
  • Kysely – Type-safe SQL query builder for PostgreSQL.
  • Redis – Caching Data.

Blockchain

  • @ton/core and @ton/ton – Handle TON Actions.

Security & Validation

  • fast-jwt + fast-sha256 – JWT-based authentication after initial Telegram initData verification.
  • zod – Validates request schemas and ensures data integrity.

Search & Utilities

  • generic-pool – Manages PostgreSQL and Redis connection pools.