Wwhy

JVM · Ruby-flavored · file-per-page MVC

Drop a file.
Hit its URL.
It runs.

Why is a small page language for the JVM. A page is a .why file in a folder; the server parses it on request. Controller and view are separate sections, and SQLite data access is built in. No router, no build step, no framework — one jar and a directory.

JDK 21+Maven CentralGradle pluginSQLite built in

src/why/index.whypage
imports:
header
footer

controller:
title = "Latest posts"
posts = db.query("select * from posts")

view:
{{> header}}
<h1>{{title}}</h1>
{{#each posts}}
  <h2>{{it.title}}</h2>
{{/each}}
{{> footer}}
localhost:8080/rendered

Latest posts

Why a new language?

Because writing a page should mean writing a page.

Templates with teeth

Every mustache evaluates a real expression.

Dropping files is the API

Copy a page into the folder and it is live.

Keep it small

The page is the unit.

Three sections, one file, one URL. Everything else is an import away — and imports are just more files.

01

A page is a file

imports:, controller:, view:. The controller and view are separate sections; SQLite access is built in. Drop it in the folder and the URL exists. No route table to update.

02

Ruby's shape

Defs, blocks, unless, truthiness, string interpolation. No classes, no gems, no Rails.

03

Views with teeth

Handlebars-flavored mustaches that evaluate real expressions. Escaped by default, partials included.

04

SQLite in the box

db.query, db.get, db.exec with bound parameters. A first-run schema.sql makes a folder self-contained.

05

Errors you can read

file:line, the offending source line and a caret, the partial or import chain, and did-you-mean hints.

06

Check before you serve

./gradlew whyCheck parses and checks every page, reports imports, partials, duplicate defs, undefined calls and URL collisions, then prints a page map. It runs as part of check.

Status: a proof of concept. The page format, Ruby-flavored controller language, views and partials, SQLite access, forms, redirects, one-shot flash messages, diagnostics, and why check are in place. No package manager, classes, bytecode, sandboxing, or production hardening. The interesting part is how far the page model goes before it needs a framework.

Two lines to a running page.

Apply the plugin, drop a page under src/why, run ./gradlew whyRun. JDK 21 is the only thing to install.