Nyth 🪺

Pronounced neeth, like the Welsh word for nest.

Nyth is a tiny Rack renderer for file-backed ERB pages and partials. No structure, just build it: put files in app, put Ruby in lib, refresh the page.

Usage

run Nyth.app(root: __dir__, reload: :changed, reload_check_interval: 5.0)

Requests map directly to files in app:

  • / renders app/index.erb.
  • /about.erb renders app/about.erb.
  • /assets/style.css serves app/assets/style.css.

ERB files can render partials from app:

<%= render "_nav.erb" %>
<%= render "_page_title.erb", heading: "About" %>

Files beginning with _ are render-only partials and return 404 when requested directly.

Ruby constants under lib are loaded with Zeitwerk. By default, reload: :changed checks Ruby file mtimes under lib at most once every 5 seconds and reloads constants only after a file changes. The nest stays warm without rebuilding it on every request.

Reload modes:

  • :changed reloads lib only when Ruby files change.
  • :always reloads lib on every request.
  • false loads lib once at boot.

Set reload_check_interval: to control how often :changed scans lib.

Tests

bundle exec rake