CLI Reference
frac provides two CLI tools: the main frac CLI for development and production workflows, and create-frac for bootstrapping new projects.
frac CLI
Section titled “frac CLI”The main CLI is available as frac after installing @usefractal/frac in your project.
frac dev
Section titled “frac dev”Start the development server with hot module reloading.
frac dev- Starts a development server at
http://localhost:3000/ - Exposes MCP server at
http://localhost:3000/mcp - Enables file watching with automatic server restart
- Enables Hot Module Reloading (HMR) for views
| Flag | Description |
|---|---|
-p, --port <number> | Port to run the server on. Defaults to 3000, or the next available port if 3000 is in use. |
--open | Open the local app URL in your browser when the server is ready. |
You can also set the port via the PORT environment variable:
PORT=8080 frac devIf you’d rather open the local app URL automatically, export FRAC_OPEN=true at the shell level (e.g. in your ~/.zshrc, ~/.bashrc, or shell profile). It’s equivalent to passing --open on every run:
# one-offFRAC_OPEN=true frac dev
# persistent (add to your shell profile)export FRAC_OPEN=truefrac build
Section titled “frac build”Build your views and MCP server for production deployment.
frac buildWhat it does:
- Building views - Compiles your React views using Vite
- Compiling server - Transpiles TypeScript server code
- Copying static assets - Moves built assets to the
dist/directory
The output is placed in the dist/ directory, ready for production deployment.
frac start
Section titled “frac start”Start the production server.
frac startRequirements:
- Must run
frac buildfirst - Requires
dist/server.jsto exist
What it does:
- Runs the compiled server from
dist/server.js - Sets
NODE_ENV=production - Serves the MCP endpoint at
http://localhost:3000/mcp - Serves pre-built view assets from
/assets
create-frac
Section titled “create-frac”A standalone CLI for bootstrapping new frac projects.
npm create @usefractal/frac@latest [directory]Or with other package managers:
npm create @usefractal/frac@latestpnpm create @usefractal/frac@latestyarn create @usefractal/fracbun create @usefractal/fracArguments
Section titled “Arguments”| Argument | Description |
|---|---|
[directory] | Target directory for the new project. If not specified, you’ll be prompted to enter a project name. Use . to create in the current directory. |
Options
Section titled “Options”| Option | Description |
|---|---|
-h, --help | Show help message |
--overwrite | Remove existing files in target directory without prompting |
--pm <choice> | Package manager to use: bun, deno, npm, pnpm, or yarn |
--skip-skills | Skip installing coding agent skills |
--start | Start the development server after scaffolding |
--yes | Skip prompts and use defaults for unprovided options |
Examples
Section titled “Examples”Create a new project interactively:
npm create @usefractal/frac@latestCreate a project in a specific directory:
npm create @usefractal/frac@latest my-appCreate in current directory, overwrite existing files, and start immediately:
npm create @usefractal/frac@latest . --overwrite --startWhat it creates
Section titled “What it creates”The scaffolder copies a starter template that includes:
src/server.ts- MCP server entry pointsrc/helpers.ts- typed React helper generationpackage.json- Pre-configured with all dependenciestsconfig.json- TypeScript configurationvite.config.ts- Vite configuration for view bundlingDockerfile- production container setup
Package Manager Scripts
Section titled “Package Manager Scripts”When you create a new frac project, the package.json includes these scripts:
| Script | Command | Description |
|---|---|---|
dev | frac dev | Start development server |
build | frac build | Build for production |
start | frac start | Start production server |
Run them with your package manager:
npm run devnpm run buildnpm startpnpm devpnpm buildpnpm startyarn devyarn buildyarn startbun devbun buildbun startdeno task devdeno task builddeno task start