Skip to content

A TRANSPILER ENGINE WITH ZERO DEFAULT GRAMMAR

Describe what you want. Capy produces what you need.

Capy takes a tiny declaration — say, "a recipe with these ingredients", "an API with these endpoints", "an Android app with these screens" — and turns it into the real artifact: HTML, Swift, Kotlin, Go + tests, Terraform, libtorch C++, anything textual.

Open the playground What's new See the samples Get started in 5 min For AI agents


Built for AI agents

Instead of asking an LLM to write the artifact (HTML, DOCX, PDF, Terraform, Kubernetes…), have it emit one terse Capy source. A library — not the agent — deterministically renders it into whichever target your environment needs.

5–10× fewer tokens per generation. The agent ships ~50–100 tokens of DSL; the library expands it into 800+ tokens of target code.

One source → many targets. Same meeting.capy source renders to HTML, Markdown, LaTeX, DOCX — pick the right library at run time. No re-prompting the agent for each format.

Sandboxed by construction. The library is the agent's full vocabulary. Out-of-grammar emissions are rejected by the parser before any renderer runs. No shell, no filesystem, no subprocess.run exposed to the model.

Environment-agnostic agents. The agent doesn't need to know about pandoc, pdflatex, python-docx, fonts, or the operator's OS. It just writes DSL; the host handles the rest.

Read the AI agents guide MCP Apps / AI widgets MCP server setup One-page LLM brief


What you'll build

Below are real artifacts produced by short Capy sources, rendered live. Each card embeds the actual generated output.

MOBILE

Habit Tracker — phone-ready app

15 lines declare screens and features. The Android and iOS libraries scaffold native code; this preview is the parallel web build for live interaction.

GAMES

Breakout — interactive HTML5 game

18 lines of declarative DSL declare entities, key bindings, and event handlers. 226 lines of working JS generated.

MCP / AI WIDGETS

Interactive widgets from one DSL line

MCP Apps (Claude Desktop, mcp-ui, mcp-widgets) render sandbox-iframe HTML returned by tool calls. With Capy, the LLM emits weather "Tokyo" temp 17 unit "C" … end (20 tokens); a compiled library renders the complete weather card, chart, or product widget. 5–10× fewer tokens per response, sandboxed by parser-as-grammar.

MATH

Math plots — one DSL line per curve

plot "sin(x)" … end → a self-contained HTML page with five canvas plots, axes, and an inline plotter. Demonstrates the new template … end sugar, ${escapeHtml}, and ${decoded} composing to drive a JS render at runtime.

3D

Three.js scene — interactive 3D

~25 declarative lines (meshes + abstract motions + `click` / `key` / `hover` / `button` bindings) → a runnable HTML page that imports three.js, raycasts clicks, dispatches keyboard shortcuts, and shows an HTML HUD. Click objects, press space / d / r, drag to orbit.

EVERYDAY

Recipe card — printable HTML

A home cook writes 6 keywords (`recipe`, `serves`, `ingredient`, `step`, `tip`); the library produces a polished printable card.

BACKEND

Auto-wired handler + test code

Every handler declaration emits the Go stub and a matching smoke test. The team's directory layout is enforced by the library. go test on the generated code passes.

go test
$ go test ./...
--- PASS: Test_ListUsers_RouteRegistered (0.00s)
--- PASS: Test_GetUser_RouteRegistered (0.00s)
--- PASS: Test_CreateUser_RouteRegistered (0.00s)
--- PASS: Test_DeleteUser_RouteRegistered (0.00s)
PASS
ok    example/handlers   0.448s

For your team

Capy isn't one feature; it's a substrate that absorbs your team's conventions and replays them across every project. Pick the role that matches you:

:material-react: FRONTEND

Design system across React + Vue + Svelte

One component declaration compiles to all three frameworks with **identical Tailwind classes**, identical layout, identical sizing. Add new components in the library once — every framework regenerates.

Pattern docs →

:material-server: BACKEND

Conventions enforced, tests auto-wired

Every `handler` line emits the stub **and** the test. Directory layout, "every handler has a test", router placement — encoded in the library. New contributors can't violate them. Generated `go test` passes.

Pattern docs →

:material-cellphone: MOBILE

Android + iOS from a single declaration

One `script.capy` declares the app's screens and features. Two libraries (`lib_android.capy`, `lib_ios.capy`) emit Kotlin + manifest + gradle, or SwiftUI + Info.plist + Package.swift. Drop into Android Studio / Xcode.

Mobile demo →

:material-robot-outline: AI / AGENTS

One DSL source → HTML, PDF, DOCX, anything

Stop asking the agent to rewrite the same artifact for every target. It emits one Capy source; per-target libraries render the final HTML / Markdown / LaTeX / DOCX / config. Sandboxed by the parser, 5–10× fewer tokens, environment-agnostic.

For AI agents →

:material-cog-outline: DEVOPS

Configs as a library

Dockerfile, Kubernetes, Terraform, GitHub Actions, Prometheus, nginx — all become libraries that absorb your house style. The output is plain target syntax; your runtime doesn't know Capy ran.

Pattern docs →

:material-palette-outline: DESIGN

One UI source, no drift

Encode your tokens (button variants, card padding, sizing scale) in the library; every consumer produces identical visuals. The designer reads the library once and knows every shape the system can ever produce.

Design systems →

:material-account-multiple: MANAGER

Stop the rewrite cycle

Capy is for ideas; libraries are implementations. When Go isn't fast enough and you want Rust — swap the library, not rewrite the system. The contract stays stable while the implementation evolves.

Idea-language thesis →

:material-account-multiple-outline: NON-PROGRAMMER

You don't need code background

The 8 "Everyday" samples (recipe / invitation / meal plan / reading log / trip itinerary / resume / invoice / to-do) use plain-English keywords. Edit a few lines, get a polished printable artifact.

Start here →

:material-package-variant: SHIPPING

One library → native binaries + WASM

`capy build` turns any library into a self-contained CLI. Cross- compile for Linux / Windows / ARM / WebAssembly from one machine. Ship as a release tarball, Homebrew tap, Docker image, or `npm`-installable WASM module.

Compile cookbook →


What enterprises ask for, and what Capy gives them

Enterprise concern How Capy addresses it
"Our design system drifts across stacks" One library encodes the tokens. Frontend, Vue, mobile all consume the same declarations. Drift becomes physically impossible.
"Every new dev rediscovers our conventions" Conventions live in the library, not in tribal knowledge. Scaffolding a new module always lays files in the right places.
"Rewrites kill velocity" Capy is for ideas; libraries are implementations. Swap Go to Rust by adding a Rust library; the source never changes.
"We have an API spec, but it drifts from the code" The Capy source IS the spec. OpenAPI, TypeScript clients, Markdown docs all generated from one source. CI diffs detect drift instantly.
"Our AI tools hallucinate target-language code" Capy gives the agent a finite, library-defined vocabulary. The agent emits short DSL; Capy produces guaranteed-shape output.
"Spec-first is impossible; backend always lags" The DSL parses today → frontend mocks against it today. Backend ships a library against the same source later. The contract is stable from day one.
"Multi-platform is exponentially expensive" One source → Android + iOS + web from three libraries. New platform = new library, not new project.
"Conventions in PR-review comments don't scale" A library is enforced by the tool, not by the reviewer. Whole categories of "you forgot the test / wrong package / missing audit field" disappear.
"Power users want to extend the DSL without forking" define NAME ... end in the source declares new functions inline → see metaprogramming. Library stays untouched.
"High-level tools trap you when you need more control" Libraries can expose progressive abstraction — one-shot, block-style, AND escape hatches in the same library. Drop a level, never switch tools.
"Library docs go stale the moment they're written" capy docs lib.capy regenerates reference Markdown from description annotations in the same library file. Commit it; CI catches drift.
"Same config, twelve environments" Libraries can pull env vars, CLI args, and sibling files at transpile time via (env ...), (arg N), (read_file ...) — see host capabilities. One 5-line source generates per-env Kubernetes/Terraform/.env outputs. Sandboxed by default in the playground.

In one paragraph

Most teams end up writing the same things over and over — config files, API stubs, schema migrations, design-system primitives, docs, manifests, tests. Capy lets you describe what you want in a few plain lines; a library encodes how each target produces it. Same source → many artifacts, byte-identical every time, all typed and validated at the boundary. The grammar is expressive enough to parse matched-pair HTML and XML — one generic <tag>…</tag> function, with mismatched nesting caught as a parse error (see it in the playground). Use it from the CLI, embed it as a Go library, ship it through an MCP server to AI agents, or try it right now in your browser — the compiler runs as WebAssembly.


Install

# CLI
go install github.com/olivierdevelops/capy/cmd/capy@latest

# Embed as a Go library
go get github.com/olivierdevelops/capy

# MCP server for AI agents
go install github.com/olivierdevelops/capy/cmd/capy-mcp@latest

# Or grab a release tarball (no Go needed)
curl -fsSL https://raw.githubusercontent.com/olivierdevelops/capy/main/scripts/install.sh | sh

Run a sample:

git clone https://github.com/olivierdevelops/capy
cd capy
capy run samples/recipe-card/lib.capy samples/recipe-card/script.capy > my-recipe.html
open my-recipe.html

…or just open the playground — no install at all.


Capy v0.10 — engine + library schema stable. CLI ships binaries for linux / darwin / windows × amd64 / arm64. MCP server ships in every release. Browser playground runs the same engine. Full changelog.

Open source under MIT. Contributions at github.com/olivierdevelops/capy.