A Telegram Mini App for reviewing Bitbucket Server pull requests with AI-powered code analysis. Built with React, Hono, and Cloudflare Workers.
- PR Browser — View and search pull requests from your Bitbucket Server instance
- Diff Viewer — Inspect file-level diffs with syntax-highlighted hunks
- AI Code Review — Analyze diffs using Google Gemini (default), Anthropic Claude, or OpenAI GPT
- Telegram Integration — Runs as a Telegram Mini App with native auth validation
- Edge Deployment — Runs on Cloudflare Workers for low-latency, globally distributed access
| Layer | Technology |
|---|---|
| Frontend | React 19, Vite, Telegram Mini App SDK |
| Backend | Hono on Cloudflare Workers |
| AI | Google Gemini, Anthropic Claude, OpenAI GPT (raw fetch, no SDKs) |
| Validation | Zod for runtime schema validation of AI responses |
- Node.js 18+
- A Cloudflare account
- A Bitbucket Server instance
- (Optional) A Telegram Bot for Mini App auth
npm installCreate a .dev.vars file in the project root for local development:
BITBUCKET_BASE_URL=https://bitbucket.yourcompany.com
BITBUCKET_TOKEN=your-bitbucket-pat
# At least one AI provider key
GOOGLE_API_KEY=your-google-api-key
# ANTHROPIC_API_KEY=your-anthropic-api-key
# OPENAI_API_KEY=your-openai-api-key
# Telegram bot token (for auth validation)
# TELEGRAM_BOT_TOKEN=your-bot-tokennpm run devThe app will be available at http://localhost:5173.
Build and deploy to Cloudflare Workers:
npm run build
npm run deploySet secrets for production (each command prompts for the value):
npx wrangler secret put BITBUCKET_BASE_URL
npx wrangler secret put BITBUCKET_TOKEN
npx wrangler secret put GOOGLE_API_KEYMonitor your worker:
npx wrangler tailThe app ships with a multi-provider AI code review service. Google Gemini is the default.
| Provider | Default Model | Secret |
|---|---|---|
| gemini-2.0-flash | GOOGLE_API_KEY |
|
| Anthropic | claude-sonnet-4-5 | ANTHROPIC_API_KEY |
| OpenAI | gpt-4o | OPENAI_API_KEY |
To change the default provider, set the DEFAULT_AI_PROVIDER var in wrangler.json:
You can also override per-request via query params:
POST /api/analyze?provider=anthropic&model=claude-sonnet-4-5
For the full setup guide, see docs/AI_SETUP.md.
src/
react-app/ # React frontend
components/ # UI components (PRRow, DiffViewer, AIAnalyzer, etc.)
lib/ # API client helpers (bitbucket, analyze, telegram)
worker/ # Cloudflare Worker backend
index.ts # Hono app entrypoint
routes/ # API route handlers (bitbucket, analyze)
middlewares/ # Telegram auth middleware
code-review/ # AI code review module
providers/ # Anthropic, Google, OpenAI provider implementations
code-review.service.ts
prompts.ts
types.ts
docs/
AI_SETUP.md # Detailed AI setup guide