finds.dev

lihaoyi/autowire

Macros for simple/safe RPCs between Scala applications, including ScalaJS/ScalaJVM

View on GitHub

★ 382Scalaupdated Jan 2022

// the take

Autowire is a pair of Scala macros that turn trait method calls into type-safe RPCs between a client and server, serializing arguments and return values automatically. It's aimed at Scala/Scala.js shops that want Ajax or RPC calls to be checked by the compiler instead of hand-rolled over JSON, and it was most relevant in the earlier Play+Scala.js full-stack era (think Scala.js + Play/Akka HTTP apps before gRPC and tapir took over that niche).

The core idea is genuinely good: calls like Client[Api].add(1,2,3).call() are real method calls, so refactoring tools, find-usages and type errors all work across the network boundary instead of failing at runtime. It's transport- and serialization-agnostic by design — you only implement read/write and doCall/route, so it slots into existing HTTP, WebSocket or TCP stacks and works with uPickle, Play-Json or Kryo. Default parameter handling is thoughtful: omitted args aren't pickled at all and are filled in server-side, which keeps payloads small and keeps old clients compatible with new optional params.

Last release was 0.3.3 in early 2022 and the changelog shows no Scala 3 support — this is a Scala 2 macro library, and Dotty macros are a different system entirely, so it's dead weight for anyone on Scala 3, which is most new Scala work now. No method overloading and no type parameters on the shared trait are real constraints, not edge cases — you often have to restructure APIs around this limitation rather than the other way around. It only validates/structures errors on the server side; client-side deserialization failures just throw whatever the underlying serializer throws, so error handling is inconsistent across the two ends. For anything greenfield, ScalaPB/gRPC or tapir give you the same type-safety goal with active maintenance and Scala 3 support, which makes autowire mostly a library to know about for maintaining legacy code rather than to start new projects with.

We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
382
Forks
46
Language
Scala
Last commit
4 Jan 2022

// nearby

If autowire isn't quite it.

All repos →