https://github.com/theiterators/kebs
Scala library to eliminate boilerplate
https://github.com/theiterators/kebs
akka akka-http boilerplate circe doobie http4s opaque-types pekko-http play-json pureconfig scala scala3 scalacheck slick spray-json tagged-types value-classes
Last synced: 2 months ago
JSON representation
Scala library to eliminate boilerplate
- Host: GitHub
- URL: https://github.com/theiterators/kebs
- Owner: theiterators
- License: mit
- Created: 2017-01-20T14:23:00.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2026-03-29T01:42:44.000Z (2 months ago)
- Last Synced: 2026-03-29T01:43:39.103Z (2 months ago)
- Topics: akka, akka-http, boilerplate, circe, doobie, http4s, opaque-types, pekko-http, play-json, pureconfig, scala, scala3, scalacheck, slick, spray-json, tagged-types, value-classes
- Language: Scala
- Homepage:
- Size: 2.32 MB
- Stars: 159
- Watchers: 7
- Forks: 16
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
## Kebs
##### Scala library to eliminate boilerplate
[](https://central.sonatype.com/artifact/pl.iterators/kebs-core_2.13)
[](https://raw.githubusercontent.com/theiterators/kebs/master/COPYING)
[](https://github.com/theiterators/kebs/actions/workflows/ci.yml?query=branch%3Amaster)

A library maintained by [Iterators](https://www.iteratorshq.com). Supports Scala 2.13 and Scala 3.
### What is Kebs?
Kebs automatically derives typeclass instances (JSON codecs, DB column mappings, HTTP unmarshallers, etc.) for your domain types so you don't have to write them by hand.
```scala
case class UserId(value: String) extends AnyVal
case class Email(value: String) extends AnyVal
// Without Kebs — manual boilerplate for every type × every library:
implicit val userIdCol: BaseColumnType[UserId] = MappedColumnType.base(_.value, UserId.apply)
implicit val userIdEnc: Encoder[UserId] = Encoder[String].contramap(_.value)
// ... repeat dozens of times
// With Kebs — just mix in a trait. Everything is derived at compile time.
```
### Documentation
**[https://theiterators.github.io/kebs/](https://theiterators.github.io/kebs/)**
### Quick start
```scala
// build.sbt — pick the modules you need
libraryDependencies ++= Seq(
"pl.iterators" %% "kebs-slick" % "2.1.6",
"pl.iterators" %% "kebs-circe" % "2.1.6",
"pl.iterators" %% "kebs-pekko-http" % "2.1.6",
"pl.iterators" %% "kebs-instances" % "2.1.6"
)
```
### Available modules
| Module | What you get |
|---|---|
| `kebs-slick` | Automatic Slick column type mappings, Postgres array & hstore support |
| `kebs-doobie` | Doobie `Meta` / `Get` / `Put` instances |
| `kebs-spray-json` | Spray `JsonFormat` derivation (flat, snakified, >22 fields) |
| `kebs-play-json` | Play JSON `Format` instances |
| `kebs-circe` | Circe `Encoder` / `Decoder` derivation (snakified/capitalized) |
| `kebs-akka-http` | Akka HTTP unmarshallers + path matchers (Scala 2 only) |
| `kebs-pekko-http` | Pekko HTTP unmarshallers + path matchers |
| `kebs-http4s` | http4s path/query parameter codecs |
| `kebs-http4s-stir` | http4s-stir directives + path matchers |
| `kebs-scalacheck` | `Arbitrary` instance generation |
| `kebs-pureconfig` | PureConfig `ConfigReader` / `ConfigWriter` |
| `kebs-jsonschema` | JSON Schema generation (Scala 2 only) |
| `kebs-baklava` | Baklava schema + parameter support |
| `kebs-tagged` | Tagged types for Scala 2 |
| `kebs-tagged-meta` | `@tagged` code generation (Scala 2 only) |
| `kebs-opaque` | Opaque type support for Scala 3 |
| `kebs-enum` | Scala 3 native enums + Scala 2 `Enumeration` |
| `kebs-enumeratum` | Enumeratum support (Scala 2 & 3) |
| `kebs-instances` | Pre-built converters for `java.time`, `UUID`, `URI`, etc. |
### Kebs 2.0 migration guide
* Mix in `CaseClass1ToValueClass` if you use value classes.
* Extend value-enums with `ValueEnumLikeEntry[V]`.
* Use `KebsEnumeratum` / `KebsValueEnumeratum` for Enumeratum, `KebsEnum` / `KebsValueEnum` for native enums.
* See the [full documentation](https://theiterators.github.io/kebs/) for details.
### IntelliJ support
[Kebs for IntelliJ](https://plugins.jetbrains.com/plugin/16069-kebs) plugin adds support for `@tagged` generated code.