HTTP bridge implementation for TON Connect 2.0.
⚠️ This bridge is currently under development. Do not use in production until the first stable release.
git clone https://github.com/ton-connect/bridge3
cd bridge
make build
./bridge
Use make help
to see all available commands and storage options.
Note: For common issues and troubleshooting, see KNOWN_ISSUES.md
- Go 1.23+
- PostgreSQL or Valkey/Redis (optional, depending on storage backend)
- Node.js & npm (for testing)
Configure using environment variables:
PORT=8081 # Server port
STORAGE="valkey"
VALKEY_URI="valkey://host:6379" # Valkey connection string
CORS_ENABLE=true # Enable CORS headers
HEARTBEAT_INTERVAL=10 # Heartbeat interval in seconds
RPS_LIMIT=1000 # Rate limit per second
CONNECTIONS_LIMIT=200 # Maximum concurrent connections
- Valkey: Redis-compatible storage for high performance
- PostgreSQL: Relational database with full persistence
- Memory: In-memory storage (no persistence, fastest for testing)
Storage Selection Logic: Depending on STORAGE env variable.
GET /bridge/events
- Server-Sent Events for real-time message deliveryPOST /bridge/message
- Send messages through the bridge
GET /health
- Health check endpointGET /ready
- Readiness check (includes database connectivity)GET /metrics
- Prometheus metrics
Bridge provides comprehensive monitoring capabilities:
number_of_active_connections
- Active WebSocket connectionsnumber_of_active_subscriptions
- Active client subscriptionsnumber_of_transfered_messages
- Total messages transferrednumber_of_delivered_messages
- Total messages deliverednumber_of_bad_requests
- Bad request countnumber_of_client_ids_per_connection
- Client IDs per connection histogrambridge_token_usage
- Token usage by bypass tokensbridge_health_status
- Health status of the bridge (1 = healthy, 0 = unhealthy)bridge_ready_status
- Ready status of the bridge (1 = ready, 0 = not ready)
Made with ❤️ for the TON ecosystem