Demo monorepo for Telegram Mini App + Web frontend + Backend API + Telegram bot.
This project was fully designed and implemented using AI-assisted development workflows, with human steering for product decisions, prioritization, and acceptance criteria.
- Monorepo: Turborepo
- Package manager: Yarn 4 (
yarn@4.9.4) - Frontend: Next.js (
apps/frontend) - Backend: NestJS + Prisma + Postgres (
apps/backend) - Bot: grammY (
apps/bot) - Lint/format: Biome
apps/frontend: web and mini app frontendapps/backend: API and auth coreapps/bot: Telegram bot runtimepackages/typescript-config: shared TS configsdocker-compose.yml: local infra/app services via profiles (infra,app)docs/: canonical project documentation
- Node.js 20+
- Corepack enabled (
corepack enable) - Docker Desktop (optional, for local infra/app containers)
- Telegram account for bot setup
- Install dependencies:
cd code
corepack yarn install- Create env files:
cp .env.example .env
cp apps/backend/.env.example apps/backend/.env
cp apps/frontend/.env.example apps/frontend/.env
cp apps/bot/.env.example apps/bot/.env- Fill required env values:
- root
.envPOSTGRES_*REDIS_PORT,REDIS_PASSWORDBACKEND_PORT(must matchapps/backend/.env:PORT)BOT_WEBHOOK_PORT(must matchapps/bot/.env:TELEGRAM_WEBHOOK_PORT)
apps/backend/.envDATABASE_URL,JWT_ACCESS_SECRET,JWT_REFRESH_SECRETPORTTELEGRAM_BOT_TOKEN,TELEGRAM_BOT_LINK_SECRETGOOGLE_CLIENT_ID(must match frontendNEXT_PUBLIC_GOOGLE_CLIENT_ID)
apps/frontend/.envNEXT_PUBLIC_API_MODEBACKEND_API_BASE_URL(for proxy mode)
apps/bot/.envTELEGRAM_BOT_TOKEN,TELEGRAM_MINIAPP_URLBACKEND_HOST,BACKEND_PORTTELEGRAM_BOT_LINK_SECRET
- Start infrastructure:
docker compose --profile infra up -d postgres redis- Run database migrations:
corepack yarn workspace backend prisma:migrate:deployUse three terminals from code/:
corepack yarn workspace backend dev
corepack yarn workspace frontend dev
corepack yarn workspace bot devDefault URLs:
- backend:
http://localhost:3000/api/v1 - frontend:
http://localhost:3100
From code/:
corepack yarn workspace frontend devThen open http://localhost:3100.
For full end-to-end Mini App flow, run backend, frontend, and bot together (see Run Locally above).
docker compose --profile app up -d --build backend bot
docker compose logs -f backend botFor Docker run:
apps/backend/.env:DATABASE_URLshould use docker hostpostgres.- If Redis rate limiting is used,
apps/backend/.env:REDIS_URLshould use docker hostredis. - Keep root
.env:BACKEND_PORTandapps/backend/.env:PORTin sync.
Frontend is not started via docker compose in this repo by default.
The production frontend is deployed separately (Vercel).
Detailed guides are in docs/: