Skip to content

CLI Reference

frac provides two CLI tools: the main frac CLI for development and production workflows, and create-frac for bootstrapping new projects.

The main CLI is available as frac after installing @usefractal/frac in your project.

Start the development server with hot module reloading.

Terminal window
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
FlagDescription
-p, --port <number>Port to run the server on. Defaults to 3000, or the next available port if 3000 is in use.
--openOpen the local app URL in your browser when the server is ready.

You can also set the port via the PORT environment variable:

Terminal window
PORT=8080 frac dev

If 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:

Terminal window
# one-off
FRAC_OPEN=true frac dev
# persistent (add to your shell profile)
export FRAC_OPEN=true

Build your views and MCP server for production deployment.

Terminal window
frac build

What it does:

  1. Building views - Compiles your React views using Vite
  2. Compiling server - Transpiles TypeScript server code
  3. Copying static assets - Moves built assets to the dist/ directory

The output is placed in the dist/ directory, ready for production deployment.


Start the production server.

Terminal window
frac start

Requirements:

  • Must run frac build first
  • Requires dist/server.js to 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

A standalone CLI for bootstrapping new frac projects.

Terminal window
npm create @usefractal/frac@latest [directory]

Or with other package managers:

Terminal window
npm create @usefractal/frac@latest
Terminal window
pnpm create @usefractal/frac@latest
Terminal window
yarn create @usefractal/frac
Terminal window
bun create @usefractal/frac
ArgumentDescription
[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.
OptionDescription
-h, --helpShow help message
--overwriteRemove existing files in target directory without prompting
--pm <choice>Package manager to use: bun, deno, npm, pnpm, or yarn
--skip-skillsSkip installing coding agent skills
--startStart the development server after scaffolding
--yesSkip prompts and use defaults for unprovided options

Create a new project interactively:

Terminal window
npm create @usefractal/frac@latest

Create a project in a specific directory:

Terminal window
npm create @usefractal/frac@latest my-app

Create in current directory, overwrite existing files, and start immediately:

Terminal window
npm create @usefractal/frac@latest . --overwrite --start

The scaffolder copies a starter template that includes:

  • src/server.ts - MCP server entry point
  • src/helpers.ts - typed React helper generation
  • package.json - Pre-configured with all dependencies
  • tsconfig.json - TypeScript configuration
  • vite.config.ts - Vite configuration for view bundling
  • Dockerfile - production container setup

When you create a new frac project, the package.json includes these scripts:

ScriptCommandDescription
devfrac devStart development server
buildfrac buildBuild for production
startfrac startStart production server

Run them with your package manager:

Terminal window
npm run dev
npm run build
npm start
Terminal window
pnpm dev
pnpm build
pnpm start
Terminal window
yarn dev
yarn build
yarn start
Terminal window
bun dev
bun build
bun start
Terminal window
deno task dev
deno task build
deno task start