sparsetech / trail   0.3.1


Routing library for the Scala platform

Scala versions: 2.13 2.12 2.11
Scala.js versions: 1.x 0.6
Scala Native versions: 0.4 0.3

Build Status Join the chat at Maven Central

Trail is a routing library for Scala. It is available for the JVM, Scala.js and Scala Native.


  • Define type-safe routes
  • Parse and generate URLs
  • DSL to extract path elements, arguments and fragments
  • Express routing tables via pattern matching
  • Define custom codecs
  • IDE support
  • Cross-platform support (JVM, Scala.js, Scala Native)
  • Zero dependencies


import trail._

val details  = Root / "details" / Arg[Int]
val userInfo = Root / "user" / Arg[String] & Param[Boolean]("show")

val result = "/user/hello?show=false" match {
  case details (a)      => s"details: $a"
  case userInfo((u, s)) => s"user: $u, show: $s"



Trail is licensed under the terms of the Apache v2.0 licence.


  • Tim Nieradzik
  • Darren Gibson
  • Anatolii Kmetiuk