rgxr

A workbench for the theory of computation: draw automata on an infinite canvas or write them as text, run words through them with step-by-step traces, work the algebra, and drill everything in the dojo. A lightbulb in any section’s top bar has the sensei walk you through it, live. Anonymous by default (no login required), self-hostable by anyone, with optional sign-in through any OpenID Connect provider if you want accounts.

What it does

Screens

Editor + run trace Render (graphviz SVG)
Editor canvas running (a|b)*abb with the epsilon-closed trace Render preview of the Thompson NFA
OPS algebra (minimized DFA) TM tape with playback
Table-filling minimization result on OPS Turing machine tape with head and playback
Grammars (parse tree) Dojo (training menu)
Grammar membership with parse tree and derivation Dojo menu with the sensei

Documentation

The documentation index links every page:

Quick start

nix develop                    # tern, pandoc, bun, graphviz, latex, jq/yq, openbao

docker run -d --name rgxr-pg -p 5432:5432 \
  -e POSTGRES_USER=rgxr -e POSTGRES_PASSWORD=rgxr -e POSTGRES_DB=rgxr \
  postgres:17-alpine

DATABASE_URL=postgres://rgxr:rgxr@localhost:5432/rgxr \
RGXR_DEV_MODE=true cargo run -p rgxr-api
# api: http://localhost:8080/healthz · Swagger: http://localhost:8080/api-docs

cd web && bun install && bun run dev
# web: http://localhost:5173 (proxies /api → :8080)

RGXR_DEV_MODE=true serves requests without a token as anonymous; migrations apply automatically at API startup.

Architecture

The application is three pieces:

flowchart TB
    B["Browser — SvelteKit SPA"] --> W["rgxr-web — SvelteKit (adapter-node)"]
    W -->|"/api"| A["rgxr-api — axum, stateless"]
    A --> P[("Postgres — jsonb documents, per-user scoping")]
    IDP["OIDC provider — optional sign-in"] -.->|"access token (PKCE)"| B
    B -.->|"Authorization: Bearer, else anonymous"| A

Signing in is optional: the browser gets an access token from any OpenID Connect provider and the API verifies it; without one, every request is the anonymous user. The sensei talks to any OpenAI-compatible endpoint and needs an API key (yours, entered in the browser); rendering shells out to graphviz, optionally with a LaTeX toolchain for TikZ export.

Repository layout

crates/rgxr-core     Pure automata engine (no IO): run, ops, regex, grammars, PDA/TM, grading
crates/rgxr-render   DOT generation + render pipeline (graphviz / LaTeX)
crates/rgxr-api      axum + sqlx HTTP API
web/                 SvelteKit frontend
openapi.yaml         THE API contract — every consumer/producer derives from it
migrations/          sqlx migrations, applied at API startup
docs/ + docs-html/   Documentation source and the tern-compiled HTML
resources/images/    Captures used by this README and the docs

Docs build

The documentation (this README and docs/) compiles to docs-html/ with:

nix develop -c tern --update   # once, or after changing .tern/config.toml
nix develop -c tern

License

MIT