Open source · MIT license

xo

The git of code generation.

A universal, declarative, composable generator engine. Scaffold projects, add features, and automate repetitive setup — for any framework, any language.

terminal
$npm install -g xocode
$xo create acme/nextjs-starter
$xo add acme/auth-jwt
YAMLNo code required
GitHubNative registry
Frameworks supported

Why xo?

Everything a generator engine should be

Declarative generators

Define everything as a generator.yaml manifest. No code required — just declare what to copy, render, inject, or merge.

Signal-based introspection

xo scans your project and builds a signal map — file presence, detected framework, package manager, dependencies. Generators adapt automatically.

Composable by design

Generators declare requires and conflicts. xo enforces the dependency graph so you never apply an incompatible generator.

Idempotent & undoable

Every operation is recorded with before-snapshots. Run xo undo to instantly revert any generator application.

GitHub-native registry

Publish a generator by pushing generator.yaml to any GitHub repo. No registry account, no upload step — just a URL.

Works everywhere

CLI, VS Code extension, or embedded as a TypeScript library via @xo/core.

Simple by design

A generator is just a YAML file

Drop a generator.yaml in any GitHub repo and anyone can run it with xo add. No registry account needed.

Declare prompts to collect user input
Handlebars templates for dynamic filenames and content
detects rules so generators only run in compatible projects
requires and conflicts for safe composition
Every operation is reversible with xo undo
generator.yamlyaml
name: acme/react-component
type: feature
requires:
  - acme/react-setup
detects:
  - signal: pkg:react
    exists: true
prompts:
  - name: componentName
    type: input
    message: Component name?
  - name: withTests
    type: confirm
    message: Add a test file?
actions:
  - type: template
    source: templates/component.tsx.hbs
    target: "src/components/{{pascalCase componentName}}/index.tsx"
  - type: template
    source: templates/test.tsx.hbs
    target: "src/components/{{pascalCase componentName}}/index.test.tsx"
    if: withTests

FAQ

Common questions

Ready?

Build your first generator.

Follow the guide and have a working generator running in under 10 minutes.