brk
Unified Bitcoin Research Kit crate providing optional feature-gated access to all BRK components.
Overview
This crate serves as a unified entry point to the Bitcoin Research Kit ecosystem, providing feature-gated re-exports of all BRK components. It allows users to selectively include only the functionality they need while maintaining a single dependency declaration, with the brk_cli component always available for command-line interface access.
Key Features:
- Feature-gated modular access to 12 specialized BRK components
- Single dependency entry point with selective compilation
- Always-available CLI component for command-line operations
- Comprehensive documentation aggregation with inline re-exports
fullfeature for complete BRK functionality inclusion- Optimized build configuration with docs.rs integration
Target Use Cases:
- Applications requiring selective BRK functionality to minimize dependencies
- Library development where only specific Bitcoin analysis components are needed
- Prototyping and experimentation with different BRK component combinations
- Educational use cases demonstrating modular blockchain analytics architecture
Installation
[]
# Minimal installation with CLI only
= "0.0.107"
# Full functionality
= { = "0.0.107", = ["full"] }
# Selective features
= { = "0.0.107", = ["indexer", "computer", "server"] }
Quick Start
// CLI is always available
use cli;
// Feature-gated components
use Indexer;
use Computer;
use Server;
// Build complete pipeline with selected features
API Overview
Feature Organization
The crate provides feature-gated access to BRK components organized by functionality:
Core Data Processing:
structs- Bitcoin-aware data structures and type systemerror- Centralized error handling across componentsstore- Transactional key-value storage wrapper
Blockchain Processing:
parser- Multi-threaded Bitcoin block parsingindexer- Blockchain data indexing with columnar storagecomputer- Analytics computation engine
Data Access:
interface- Unified query interface with fuzzy searchfetcher- Multi-source price data aggregation
Service Layer:
server- HTTP API server with caching and compressionmcp- Model Context Protocol bridge for LLM integrationlogger- Enhanced logging with colored output
Web Infrastructure:
bundler- Web asset bundling using Rolldown
Always Available
cli: Command-line interface module (no feature gate required)
Provides access to the complete BRK command-line interface for running full instances.
Examples
Minimal Bitcoin Parser
use Parser;
Analytics Pipeline
use ;
Web Server Setup
use ;
async
MCP Integration
use ;
Feature Combinations
Common Combinations
Data Processing: ["structs", "parser", "indexer"]
Basic blockchain data processing and indexing.
Analytics: ["indexer", "computer", "fetcher", "interface"]
Complete analytics pipeline with price data integration.
API Server: ["interface", "server", "logger"]
HTTP API server with logging capabilities.
Full Stack: ["full"]
All components for complete BRK functionality.
Dependency Optimization
Feature selection allows for significant dependency reduction:
# Minimal parser-only dependency
= { = "0.0.107", = ["parser"] }
# Analytics without web server
= { = "0.0.107", = ["indexer", "computer", "interface"] }
# Web server without parsing
= { = "0.0.107", = ["interface", "server"] }
Architecture
Re-export Pattern
The crate uses #[doc(inline)] re-exports to provide seamless access to component APIs:
pub use brk_component as component;
This pattern ensures:
- Feature-gated compilation for dependency optimization
- Inline documentation for unified API reference
- Namespace preservation for component-specific functionality
Build Configuration
- Documentation:
all-features = truefor complete docs.rs documentation - CLI Integration:
brk_clialways available without feature gates - Optional Dependencies: All components except CLI are optional
Configuration
Feature Flags
| Feature | Component | Description |
|---|---|---|
bundler |
brk_bundler |
Web asset bundling |
computer |
brk_computer |
Analytics computation |
error |
brk_error |
Error handling |
fetcher |
brk_fetcher |
Price data fetching |
indexer |
brk_indexer |
Blockchain indexing |
interface |
brk_interface |
Data query interface |
logger |
brk_logger |
Enhanced logging |
mcp |
brk_mcp |
Model Context Protocol |
parser |
brk_parser |
Block parsing |
server |
brk_server |
HTTP server |
store |
brk_store |
Key-value storage |
structs |
brk_structs |
Data structures |
full |
All components | Complete functionality |
Documentation
Documentation is aggregated from all components with #![doc = include_str!("../README.md")] ensuring comprehensive API reference across all features.
Code Analysis Summary
Main Structure: Feature-gated re-export crate providing unified access to 12 BRK components
Feature System: Cargo features enabling selective compilation and dependency optimization
CLI Integration: Always-available brk_cli access without feature requirements
Documentation: Inline re-exports with comprehensive docs.rs integration
Dependency Management: Optional dependencies for all components except CLI
Build Configuration: Optimized compilation with all-features documentation
Architecture: Modular aggregation crate enabling flexible BRK ecosystem usage
This README was generated by Claude Code