Simple by design
Routes are Scala pattern matches. Application logic is ordinary Scala code. Start small and keep your app easy to follow.
The ideas behind SharafSharaf Β· Scala 3 web framework
Build web apps and APIs with readable routes, typed inputs, and ordinary Scala. From your first route to a single VPS or AWS Lambda.
JVM & native executables Β· Open source
//> using scala 3.9.0
//> using dep ba.sake::sharaf-undertow:0.21.0
import ba.sake.sharaf.*
import ba.sake.sharaf.undertow.UndertowSharafServer
val routes = Routes:
case GET -> Path("hello", name) =>
Response.withBody(s"Hello $name")
case GET -> _ =>
Response.withBody("Go to http://localhost:8181/hello/your-name")
UndertowSharafServer("localhost", 8181, routes).start()
println(s"Server started at http://localhost:8181")
scala hello.sc
Start small. Grow as needed.
Routes are Scala pattern matches. Application logic is ordinary Scala code. Start small and keep your app easy to follow.
The ideas behind Sharaf βParse JSON, forms, and query parameters into case classes. Add validation and return useful errors.
Explore typed inputs βJSON APIs, HTML pages, forms, cookies, and sessionsβwith libraries that fit together.
Explore the tutorials βRun on the JVM or compile a native executable. Use your own server, containers, or AWS Lambda.
Servers and platforms βYour app. Your infrastructure.
Start with the setup that fits your app. These starters show two ways to put Sharaf to work.
Your own server
A Scala Native Sharaf app behind Caddy HTTPS and VoidAuth authentication. Keep the app private behind your proxy and manage the stack with Docker Compose.
Explore the VPS starter βAWS Lambda
Run your Sharaf app as a native executable on AWS Lambda. Write ordinary Scala routes and let AWS manage server capacity.
Explore the Lambda starter βConsidering native? See measured startup, memory, and executable sizes.
Keep building