Octocrab

A modern, extensible GitHub API client for Rust with REST and GraphQL support.

SDK
Cargo
v0.54.1
1,432stars
MIT OR Apache-2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
80/100Excellent
Development Activity68
Maintenance80
Community72
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture82
Code Quality84
Innovation76
Learning Curve74

Octocrab is a third-party Rust client for the GitHub API, letting developers build GitHub integrations, bots, and automation tooling without hand-rolling HTTP requests. It wraps both the REST and GraphQL APIs behind a builder-style, strongly typed interface, covering repos, issues, pull requests, Actions, GitHub Apps, webhooks, and more.

The library supports personal access tokens, GitHub App authentication (including JWT and installation tokens), and OAuth device flow, with a pluggable HTTP client layer and opt-in TLS backends so it fits into existing async Rust stacks.

What You Get

  • Typed builder-style API coverage across repos, issues, pull requests, Actions, orgs, gists, projects, and more
  • Both REST and GraphQL access through a single client
  • Multiple auth modes: personal access tokens, GitHub App JWT/installation tokens, and OAuth device flow
  • Pagination helpers (Page<T>) for iterating large result sets
  • Pluggable HTTP client and TLS backend selection (native-tls, rustls) via feature flags
  • Rate-limit and webhook event handling utilities

Common Use Cases

  • Building a GitHub bot that comments on issues or PRs based on custom rules
  • Writing CI/CD tooling that creates releases, manages secrets, or queries workflow runs
  • Implementing a GitHub App that authenticates per-installation and acts on repos it’s installed into
  • Fetching organization- or repo-wide data (dependabot alerts, code scanning results, SBOMs) for internal dashboards
  • Automating repository administration tasks (branch protection, labels, templates) at scale

Under The Hood

Architecture Octocrab centers on an Octocrab client struct built via a builder pattern (OctocrabBuilder), with per-resource API surfaces organized under src/api/ (repos, issues, pulls, actions, apps, orgs, gists, projects, etc.), each exposing a fluent request builder that ultimately calls shared HTTP-execution and from_response deserialization helpers. src/models.rs holds the typed GitHub response schemas, while src/auth.rs and src/service/ isolate the different authentication flows (PAT, JWT/App, OAuth device flow) from the request-building logic. Tech Stack Built on reqwest for HTTP, with serde/serde_json for (de)serialization and optional native-tls/rustls TLS backends selected via Cargo features; async execution assumes a Tokio-compatible runtime. GraphQL access is layered on top of the same client for endpoints not covered by REST. Code Quality The tests/ directory and examples/ directory (30+ runnable examples covering gists, secrets, GitHub Apps, device flow, GraphQL, SBOM retrieval) double as both regression coverage and documentation; 235 contributors and continuous CI (Rust GitHub Actions workflow) keep the client in sync with GitHub’s API changes. API Design The per-resource builder pattern (octocrab.issues(owner, repo).list().send().await) mirrors GitHub’s own REST resource hierarchy closely, which keeps the learning curve low for anyone already familiar with GitHub’s API docs, while Page<T> normalizes pagination handling across all list endpoints instead of leaving it to each caller.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search