Crust logoCrust

What is Crust?

A TypeScript-first, Bun-native CLI framework with composable modules.

Why Crust?

Most CLI tools in the JavaScript ecosystem are either minimal arg parsers that leave you wiring everything together, or heavyweight frameworks that bring more complexity than you need.

Crust sits in the sweet spot: more structured than a bare parser, lighter than a full framework, and designed so you only pull in what you actually use.

  • Chainable builder API — Immutable, type-safe builder pattern with full TypeScript inference
  • TypeScript-first — Args and flags are fully inferred from your definitions. No manual type annotations, just autocomplete that works.
  • Composable, not monolithic — Every capability ships as its own module. Install only what you need — @crustjs/core for the framework, @crustjs/plugins for official plugins, @crustjs/crust for build tooling.
  • Built for Bun — Targets the Bun runtime from the ground up. No Node compatibility layers, no legacy baggage.

Features

  • Compile-time validation catches flag alias collisions and variadic arg mistakes before your code runs
  • Zero runtime dependencies — Core modules have no external dependencies
  • Subcommand routing — Nested command trees with automatic resolution
  • Plugin system — Middleware-based architecture with lifecycle hooks
  • Flag inheritance — Share flags across subcommands with inherit: true

Quick Example

src/cli.ts
import { Crust } from "@crustjs/core";
import { helpPlugin, versionPlugin } from "@crustjs/plugins";

const main = new Crust("greet")
  .meta({ description: "A friendly greeter CLI" })
  .use(versionPlugin("1.0.0"))
  .use(helpPlugin())
  .args([
    {
      name: "name",
      type: "string",
      description: "Who to greet",
      default: "world",
    },
  ])
  .flags({
    shout: { type: "boolean", description: "SHOUT the greeting", short: "s" },
  })
  .run(({ args, flags }) => {
    const message = `Hello, ${args.name}!`;
    console.log(flags.shout ? message.toUpperCase() : message);
  });

await main.execute();
$ bun run src/cli.ts world --shout
HELLO, WORLD!

$ bun run src/cli.ts --help
greet - A friendly greeter CLI

USAGE:
  greet [name] [options]

ARGS:
  [name]            Who to greet

OPTIONS:
  -s, --shout       SHOUT the greeting
  -h, --help        Show help
  -v, --version     Show version number

Roadmap

Curious about what's coming next? Check out the Roadmap to see what we're working on, what's planned, and where you can contribute.

Community

Have questions or want to chat about Crust? Join our Discord community to connect with other developers, get help, and stay up to date.

On this page