CLI
Earthling UI provides a command-line interface (CLI) to help you create new projects, eject components, and manage your UI development workflow. The CLI is built to be simple and intuitive, making it easy to get started with Earthling UI.
Installation
The CLI is included when you install the Earthling UI package:
bun add earthling-ui
You can also run it directly without installing:
# with bun
bunx earthling-ui <command>
# with node / npm
npx earthling-ui <command>
The CLI runs under both Bun and Node.js.
Commands
create
Create a new project with Earthling UI pre-configured.
bunx earthling-ui create [template] [destination]
Arguments:
- template: The template to use (optional, defaults to monorepo)
- destination: The name of the project (and directory) to create
Examples:
# Create a Next.js project
bunx earthling-ui create next my-app
# Create a Vite SPA project
bunx earthling-ui create spa my-spa
# Create a monorepo
bunx earthling-ui create monorepo my-workspace
init
Initialize an earthling-ui.config.json for your project. The config tells the eject command where to place components and shared utilities. Projects created from Earthling UI templates come with this file preconfigured.
bunx earthling-ui init
The wizard asks for:
- Component directory — where ejected components are placed (default src/components)
- Utils directory — where shared utilities like cn.ts are placed (default src/utils)
eject
Eject a component from Earthling UI into your project. The component's source is copied into your project so you can customize it freely — similar to shadcn/ui, but each component lives in its own folder.
bunx earthling-ui eject <component>
Arguments:
- component: The name of the component to eject (e.g. button, dialog, select)
Example:
bunx earthling-ui eject button
The eject command:
- Finds your earthling-ui.config.json (run init first if you don't have one — you can run eject from any subdirectory of your project)
- Copies the component folder into your component directory
- Copies the cn utility into your utils directory if it isn't already there
- Rewrites internal imports to relative paths
- Detects the component's dependencies and installs them with your package manager (bun, pnpm, yarn, or npm — detected from your lockfile)
Best Practices
- Use the create command for new projects to ensure proper setup with Earthling UI
- Choose the right template based on your project needs (Next.js for SSR, Vite for SPAs, etc.)
- Consider using a monorepo for larger projects with multiple apps or packages
- Eject components only when necessary — importing directly is preferred for most use cases, and ejected components don't receive library updates