Dmytro Onyshchenko
← All case studies

Telegram Bot and Mini App for Fitness Coaches

A Telegram bot and Mini App where fitness coaches manage trainees, programs and sessions, and trainees follow their plans, with AI-assisted program entry and a freemium subscription model.

JavaQuarkusReactTypeScriptTelegramPostgreSQLpgvectorLangChain4jGoogle GeminiDockerGrafanaSentry

Problem

Fitness coaches usually run their clients through chats, spreadsheets and notes. Plans get lost, schedules drift, and there is no clear view of what each trainee has done. Separate apps add friction because trainees have to install and learn another tool.

The idea is to put the whole workflow where coaches and trainees already are: Telegram. Coaches manage trainees, training blocks, programs and schedules. Trainees see their assigned training, log workouts and get reminders from the bot.

Architecture

The product has two entry points inside Telegram: a bot chat and a Mini App. The Mini App is a React and TypeScript single-page app. It authenticates by sending Telegram init data to the backend, which validates its signature and issues a JWT for all further requests. The Mini App is served as static files, and nginx routes API calls to the backend.

The backend is one Quarkus application built into a single image and run in two modes. The API instance serves HTTP only. The worker instance consumes bot updates over long polling and runs the schedulers for notifications and photo sync. Both use PostgreSQL, and the whole stack runs on a single node with Docker Compose.

Around the core, the backend integrates with a few external services. Google Gemini powers AI parsing of training blocks and programs from free text, plus an onboarding and an in-app assistant that answers from a pgvector knowledge base. Payments go through Telegram Stars. Logs and metrics are shipped to Grafana Cloud, and errors go to Sentry.

My contribution

  • Designed and built the whole product end to end: backend, Mini App, bot and deployment.
  • Built the Quarkus backend with a layered design, JOOQ repositories and Flyway migrations, and JWT authentication based on Telegram init data.
  • Built the Telegram bot flows: commands, callbacks, onboarding, notifications and scheduled jobs.
  • Built the React Mini App with English and Ukrainian localization and Telegram theme integration.
  • Added AI features with LangChain4j and Gemini: parsing training programs from text, an onboarding assistant, and an in-app assistant with retrieval from a pgvector knowledge base, with daily usage limits per user.
  • Designed the freemium model (free, solo and coach plans) with feature entitlements, and integrated payments with Telegram Stars.
  • Set up deployment with Docker Compose on a single node, Kubernetes manifests as an alternative, and monitoring with Grafana Cloud and Sentry.

Outcomes

  • Coaches manage trainees, programs, schedules and sessions inside Telegram, and trainees need no separate app.
  • Training programs can be created from plain text with AI help instead of manual entry.
  • A freemium model with plans that unlock features for coaches and their trainees.
  • A product running in production with monitoring and error tracking, on a small single-node setup.