Tech News
← Back to articles

Brut: A New Web Framework for Ruby

read original related products more articles

Brut aims to be a simple, yet fully-featured web framework for Ruby. It's different than other Ruby web frameworks. Brut has no controllers, verbs, or resources. You build pages, forms, and single-action handlers. You write HTML, which is generated on the server. You can write all the JavaScript and CSS you want.

Here’s a web page that tells you what time it is:

class TimePage < AppPage def initialize ( clock :) @clock = clock end def page_template header do h1 { "Welcome to the Time Page!" } TimeTag ( timestamp: @clock . now ) end end end

Brut is built around low-abstraction and low-ceremony, but is not low-level like Sinatra. It’s a web framework. Your Brut apps have builtin OpenTelemetry-based instrumentation, a Sequel-powered data access layer, and developer automation based on OptionParser -powered command-line apps.

Brut can be installed right now, and you can build and run an app in minutes. You don’t even have to install Ruby.

> docker run \ -v "$PWD":"$PWD" \ -w "$PWD" \ -it \ thirdtank/mkbrut \ mkbrut my-new-app > cd my-new-app > dx/build && dx/start > dx/exec bin/setup > dx/exec bin/dev # => localhost:6502 is waiting

There’s a full-fledged example app called ADRs.cloud you can run right now and see how it works.

What You Get

Brut has extensive documentation, however these are some highlights:

Brut’s core design is around classes that are instantiated into objects, upon which methods are called.

... continue reading