Sharaf Β· Scala 3 web framework

Start simple.
Deploy anywhere. πŸ”—

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

hello.scA web app in a few lines.
//> 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")

Run it with Scala CLIscala hello.sc

Start small. Grow as needed.

Why Sharaf? πŸ”—

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 Sharaf

Typed where it matters

Parse JSON, forms, and query parameters into case classes. Add validation and return useful errors.

Explore typed inputs

Build the whole app

JSON APIs, HTML pages, forms, cookies, and sessionsβ€”with libraries that fit together.

Explore the tutorials

Choose your deployment

Run on the JVM or compile a native executable. Use your own server, containers, or AWS Lambda.

Servers and platforms

Your app. Your infrastructure.

From a single VM to serverless. πŸ”—

Start with the setup that fits your app. These starters show two ways to put Sharaf to work.

Your own server

A small stack you control.

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

Let the platform handle capacity.

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

Find your next step. πŸ”—