Hepek is a pure Scala toolkit for declaring HTML templates and generating static sites, with a component library that compiles to both JVM and Scala.js and official integrations for Play, Http4s, and ZIO. It is published under the ba.sake organization on Maven Central from the sake92 GitHub account. The project's core idea is typesafe but flexible HTML, backed by essays on why template engines are dead and modern type-safe template engines.
What is Hepek?
Hepek is a Scala library that replaces string-based HTML templating with typesafe Scala expressions. It takes Scala source code as input and produces HTML markup as output, either rendered server-side on the JVM or client-side with Scala.js. Hepek consists of two parts: Hepek Components, a reusable set of HTML pieces such as grids, forms, code highlighting, and Markdown rendering, and Hepek SSG, which turns Scala-defined page objects into a static website. Both parts are published on Maven Central as hepek-components and hepek respectively.
Key Features
- Typesafe HTML components — Compose templates, grids, forms, code blocks, and Markdown in Scala; the compiler checks every tag and attribute so malformed markup is caught at compile time.
- JVM and Scala.js support — Hepek Components runs on the JVM for server-side rendering and on Scala.js for client-side output, so the same templates can be shared across a full-stack application.
- HTMX and Alpine.js attribute support — Components include typed custom attributes from htmx.org and Alpine.js directives, giving interactive behavior without untyped string attributes.
- Static site generator — Hepek SSG provides site components and pairs with hepek-cli (scala-cli), mill-hepek (Mill), or sbt-hepek (sbt) to build the site from Scala page definitions.
- Framework integrations — Official modules exist for Play Framework, Http4s, ZIO, and Sharaf, each with an example repository; a fullstack example and a petclinic implementation are linked from the project page.
- Code highlighting and math rendering — The published source of blog.sake.ba uses the toolkit to show code examples and math snippets via KaTeX, demonstrating that Hepek supports technical content.
Who should use Hepek?
- Scala developers who want compile-time safety in HTML — Use Hepek Components to author views where every tag and attribute is checked by the compiler instead of relying on string interpolation.
- Full-stack Scala teams on Play, Http4s, or ZIO — Render HTML from Scala code using the official integration modules, keeping templates in the same language as the rest of the server.
- Technical bloggers and documentation writers — Generate a static site with Hepek SSG, using the starter template (with Mill) and the minimal example (with scala-cli) as starting points.
What can you do with Hepek?
- Generate static documentation sites: Define pages as Scala objects and compile them to a full HTML site with hepek-cli, mill-hepek, or sbt-hepek.
- Build server-rendered web applications: Integrate Hepek views into Play, Http4s, ZIO, or Sharaf applications with the provided examples.
- Add interactive components: Attach HTMX or Alpine.js attributes to Hepek components to create dynamic pages without writing script tags by hand.
- Publish blogs with code and math: Follow the sake-ba-blog source to post content with highlighted code and KaTeX math snippets.
FAQ
Is Hepek free?
Yes, Hepek is an open-source library hosted on GitHub and published on Maven Central, so it can be used without license fees in JVM and Scala.js projects.
Does Hepek support Scala.js?
Hepek Components explicitly supports both JVM and Scala.js, meaning the same HTML templates can run on the server side and the client side.
Which build tools work with Hepek SSG?
Hepek SSG can be used with scala-cli through hepek-cli, with Mill through mill-hepek, and with sbt through sbt-hepek. A starter template shows the Mill setup.
Which web frameworks integrate with Hepek?
Official integration modules are available for Play Framework, Http4s, ZIO, and Sharaf. Each has a dedicated example repository, plus a fullstack example and a petclinic implementation.
What is the difference between Hepek Components and Hepek SSG?
Hepek Components provides the reusable HTML building blocks (templates, grids, forms, code highlighting, Markdown) and runs on JVM and Scala.js. Hepek SSG adds site-generation components and tooling for producing static websites.





