# skydoves/sandwich

🥪  Sandwich is an adaptable and lightweight sealed API library designed for handling API responses and exceptions in Kotlin for Retrofit, Ktor, and Kotlin Multiplatform.

Repository: https://github.com/skydoves/sandwich
Canonical: https://ross.abutalabs.com/products/sandwich
Homepage: https://skydoves.github.io/sandwich/
Language: Kotlin
License: Apache-2.0
License Family: permissive
Topics: android, retrofit, api, network, apiresponse, datasource, kotlin, skydoves
Last push: 2026-08-25T17:45:47+00:00

## Health v2 (maintenance only)
Score: 94/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 83, longevity 100
- inputs: {"age_days": 2311, "days_push": 8, "days_rel": 38, "gap_med": 67, "n_releases_24m": 12}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1770, forks 113 (observed 2026-08-28T04:05:33.875041+00:00)

## What it is
Sandwich is a lightweight Kotlin library that provides sealed ApiResponse types for modeling and handling API responses and exceptions from Retrofit, Ktor, and Ktorfit. It offers functional operators, mappers, and global response handling so developers can avoid writing custom Resource/Result wrapper classes.

## Use cases
- handle retrofit api responses and errors in kotlin
- avoid writing resource wrapper classes for network calls
- handle network exceptions elegantly in android apps
- standardize api response handling across kotlin multiplatform projects
- apply global operators to all network responses
- map api error responses to custom models
- test network response handling with fake factories

## When to choose
- you use Retrofit, Ktor, or Ktorfit in Kotlin and want consistent response/error handling
- you're tired of writing boilerplate Resource or Result wrapper classes
- you want functional operators and mappers for network responses
- you need shared network response handling in Kotlin Multiplatform
- you want global response handling across your app

## When to avoid
- you don't use Retrofit, Ktor, or Ktorfit for networking
- your project already has an established response-handling pattern
- you need a full networking client rather than a response-handling layer
- you're not using Kotlin

## Facets
- artifact type: library
- maturity: stable
- function: http-client, error-handling, serialization
- domain: android-tools, web-development, developer-tools
- platform: jvm, cross-platform
- tags: retrofit, ktor, kotlin-multiplatform, api-response-handling, sealed-classes, coroutines, android

## Member repositories
- skydoves/sandwich (main) score 94

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:33.875041+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:26:04.386048+00:00, confidence not recorded.
  - readme: https://github.com/skydoves/sandwich (fetched 2026-08-28T04:05:33.875041+00:00, sha b7224077dd2a)
  - homepage: https://skydoves.github.io/sandwich/ (fetched 2026-08-29T11:04:22.311126+00:00, sha dac3f41321b5)
- Data as of 2026-08-30T08:39:29.467469+00:00.
