$ show ChuckerTeam/chucker
Chucker is a production-grade Android library for inspecting HTTP(S) traffic in-app. It acts as an OkHttp interceptor, capturing full request/response details (headers, bodies, timing, errors) and persisting them to a local Room database. The library provides a built-in Material Design UI for browsing, searching, filtering, and exporting transactions (HAR 1.2, plain text, curl commands). It is designed as a debug-only tool via a no-op variant for release builds. The architecture follows a clean separation: public API (ChuckerInterceptor, ChuckerCollector, BodyDecoder), internal data layer (Room entities, DAO, repository), support utilities (okio stream manipulation, JSON formatting, background services), and a full set of UI fragments/adapters. The codebase is well-tested (unit tests for interceptors, DAO, repository, utilities, ViewModels) and follows modern Android development practices (Kotlin, Coroutines, LiveData/Flow, ViewBinding, Compose sample). It handles edge cases like compressed bodies, large payloads, binary formats (protobuf), GraphQL, and SSL/TLS information. The project also includes CI/CD pipelines, automated dependency updates via Renovate, and migration guides for previous versions. While primarily an application library, it has a strong data storage component (Room database) and export functionality (HAR generation), making it useful for debugging network issues in any Android app.
The LLM identified 5 files worth highlighting for reuse:
A simple interface for custom response body decoding (e.g., Protobuf, Thrift). Users implement decode() to return a human-readable string. This is a clean, reusable abstraction that decouples the library from specific binary formats, making it easy to integrate without modifying core code.
An okio Source that duplicates all bytes read to a Sink, enabling both storage and forwarding without buffering the entire stream. This is a textbook implementation of the Tee pattern for streaming data, reusable in any project needing to tap into an input stream without consuming it.
An interface defining share() and toShareableFormat() methods for exporting transaction data. Implementations cover plain text, curl commands, and HAR format. This abstraction allows adding new export formats without modifying the UI or core logic, and is a clean example of the Strategy pattern.
A utility class with static methods for formatting JSON, XML, and URL-encoded bodies, and converting byte counts to human-readable strings. The JSON/XML formatting is robust and handles edge cases (e.g., malformed input). This is a reusable set of formatting helpers that could be extracted into any Android project.
A DiffUtil.ItemCallback for HttpTransactionTuple, enabling efficient RecyclerView updates. It uses transaction ID for identity and content equality check. This is a standard pattern but implemented cleanly, demonstrating how to use DiffUtil with Room entities. Reusable in any Android app with a list backed by a database.