Skip to content

sideeffffect/dapr4s

Repository files navigation

dapr4s

CI Release
Build Status Release Artifacts

A Scala 3 library that exposes every Dapr building block as a capture-checked capability. Dapr effects — state, pub/sub, service invocation, secrets, configuration, bindings, distributed locks, actors, workflows, cryptography, jobs, and conversation (LLM) — are modelled as scala.caps.Capability values that the compiler tracks. User code compiles under import language.experimental.safe, so the compiler statically guarantees that a Dapr resource can never escape the scope that owns it. The Dapr Java SDK is hidden entirely; users see only Scala types.

Requirements

  • Scala 3.9.0-RC1-…-NIGHTLY (capture checking / safe mode; see project.scala)
  • JVM 25
  • scala-cli
  • Docker (for the integration tests, which spin up a real daprd sidecar + Redis via testcontainers)

Build & test

scala-cli compile .
scala-cli test . --test-only 'dapr4s.test.unit.*'         # unit tests
scala-cli test . --test-only 'dapr4s.test.integration.*'  # needs Docker

Usage

//> using dep "com.github.sideeffffect::dapr4s:<version>"
import dapr4s.*

DaprCapability.state(StateStoreName("statestore")):   // StateCapability^{cap} in scope
  StateCapability.save(key, value)
// Using StateCapability here — outside the block — is a compile error.

See DESIGN.md for the architecture and the two-layer (safe / @assumeSafe shell) model, and dapr4s-examples for runnable examples.

Sponsors

This work has been sponsored by Chili Piper.

License

Apache-2.0

About

Scala 3 library exposing Dapr building blocks as capture-checked capabilities

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors