⚠️ Under Development - This framework is currently in active development and not yet ready for production use.
A framework for building GitHub Apps in Rust, inspired by Probot. Octofer provides a clean, type-safe way to build GitHub Apps with minimal boilerplate and automatic webhook handling.
What is Octofer?
Octofer simplifies GitHub App development by:
- Handling webhook events - Automatically receives and routes GitHub webhook events
- Managing authentication - Handles GitHub App authentication and installation tokens
- Providing type safety - Full Rust type safety for GitHub API interactions
- Offering simple APIs - Clean, intuitive event handler registration
Available Event Handlers
Currently supported GitHub webhook events:
on_issue_comment()- Issue comment events (created, edited, deleted)on_issue()- Issue events (opened, closed, edited, etc.)on_pull_request()- Pull request events (opened, closed, merged, etc.)on_pull_request_review()- Pull request review eventson_pull_request_review_comment()- Pull request review comment eventson_pull_request_review_thread()- Pull request review thread events
Quick Example
use Arc;
use ;
async
Configuration
Octofer uses a centralized configuration system that loads from environment variables:
# Required for GitHub App authentication
# OR
# Webhook
# Server configuration (optional)
# Default: 127.0.0.1
# Default: 8000
# Logging configuration (optional)
# Default: info (trace, debug, info, warn, error)
# Default: compact (compact, pretty, json)
# Default: false (show target module)
# Default: false (show file and line info)
# Default: false (show thread IDs)
You can also create configuration programmatically:
use Config;
let config = new?;
// Initialize logging with the configuration
config.init_logging;
Development
Build all components:
Run tests:
Code Quality
Format code:
Run linting:
Features
- Centralized Configuration: All configuration managed through a single
Configstruct - Environment Variable Support: Automatic loading from environment variables
- GitHub Client Access: Direct access to authenticated GitHub clients from event handlers
- Modular Architecture: Clean separation of concerns across modules
- Type Safety: Full Rust type safety for GitHub API interactions
- Automatic Token Management: GitHub App installation token caching and refresh
- Middleware Support: HMAC verification and event processing middleware
Event Handler Context
Event handlers receive a Context object that provides access to:
- Event data:
context.payload()- The full GitHub webhook payload - Event:
context.event()- The full GitHub webhook event - Event type:
context.kind()- The type of event (e.g., "issues", "issue_comment") - Installation ID:
context.installation_id()- GitHub App installation ID - GitHub client:
context.github()- Authenticated GitHub API client - Installation client:
context.installation_client()- Installation-specific authenticated client
Examples
The repository includes several examples:
basic.rs- Simple GitHub App with event handlers.github_client.rs- Direct GitHub API client usage
License
MIT