This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
GitPing is a real-time notification service for GitHub repositories built on Cloudflare Workers. It sends instant alerts via Telegram (and other channels in the future) when new releases or commits happen in subscribed repositories.
The system uses a microservices architecture with three Cloudflare Workers:
- API Worker (
src/workers/api.ts): REST API for managing subscriptions and user accounts - Poller Worker (
src/workers/poller.ts): Cron-based GitHub polling service - Notifier Worker (
src/workers/notifier.ts): Queue consumer for sending notifications
- Database: Cloudflare D1 (SQLite) for persistent storage
- State Management: Cloudflare D1 (
repo_poll_states) for polling state (ETags, last-seen IDs) - Message Queue: Cloudflare Queues for decoupling event processing
- External APIs: GitHub REST API, Telegram Bot API
# Install dependencies
npm install
# Local development
npm run dev:api # Start API worker locally
npm run dev:poller # Start poller worker locally
# Deployment
npm run deploy # Deploy both workers
npm run deploy:prod # Deploy to production
# Individual deployments
npm run deploy:api # Deploy API worker
npm run deploy:poller # Deploy poller worker
# Database migrations
npm run db:migrate:local # Local D1 database
npm run db:migrate # Remote D1 database
# Monitoring
npm run logs:api # Tail API worker logs
npm run logs:poller # Tail poller worker logsLocated in src/schema.sql. Key tables:
users: User accounts and Telegram chat IDsrepos: GitHub repository trackingsubscriptions: User subscriptions to repos/eventsevents: GitHub events (releases/commits)notifications: Delivery tracking
wrangler-api.toml: API worker configurationwrangler-poller.toml: Poller worker configuration with cron triggers.env: Environment-specific IDs (not committed to git).env.example: Template for environment setup
src/lib/: Core business logic (GitHub API, Telegram API, Database)src/workers/: Worker entry pointssrc/utils/: Utilities (logging, error handling, filters)
See setup.md for complete setup instructions. You'll need:
- Cloudflare account with D1 enabled
- GitHub personal access token (public_repo scope)
- Telegram bot token from @BotFather
Current deployment uses free plan (no Queues) with inline notification processing.
- Adding new notification channels: Implement in
src/workers/notifier.ts - Adding new filters: Extend
src/utils/filters.ts - API changes: Modify
src/workers/api.tsand update types insrc/lib/types.ts - Polling changes: Modify
src/workers/poller.ts
Use the API endpoints to create test subscriptions. Monitor with wrangler tail <worker-name>.