> ## Documentation Index
> Fetch the complete documentation index at: https://docs.skybridge.tech/llms.txt
> Use this file to discover all available pages before exploring further.

# CLI

> Test, build, and run your app from the terminal

Skybridge ships one CLI, available as both `skybridge` and `sb` once it's installed in your project.

It's a project dependency, not a global install, so run it through your package manager, or the [package scripts](#package-scripts) a scaffold sets up.

## `create`

Scaffold a new project. Run it before the package is installed with `npx`:

```bash theme={null}
npx skybridge create
```

See [Quickstart](https://docs.skybridge.tech/get-started/quickstart.md) to scaffold and run a project.

## `dev`

Start the development server with hot module reloading and DevTools.

```bash npm theme={null}
npx skybridge dev
```

```bash pnpm theme={null}
pnpm skybridge dev
```

```bash yarn theme={null}
yarn skybridge dev
```

```bash bun theme={null}
bun skybridge dev
```

```bash deno theme={null}
deno run -A npm:skybridge/skybridge dev
```

* Serves the MCP endpoint at `http://localhost:3000/mcp`
* Opens DevTools for local testing at `http://localhost:3000/`
* Watches files and restarts the server, with HMR for views

| Flag | Description |
| - | - |
| `-p, --port <number>` | Port to run on. Defaults to `3000`, or the next free port if it's taken. |
| `--tunnel` | Open an Alpic tunnel for remote testing and Playground access. |
| `--no-open` | Don't open DevTools when the server is ready. |
| `-v, --verbose` | Show tunnel logs. |
| `--plain` | Disable the interactive UI and stream the server's stdout verbatim, so you can pipe it through a formatter (e.g. `skybridge dev --plain \| bunyan`). |

The [scaffolded](https://docs.skybridge.tech/get-started/quickstart.md#scaffold-your-project) `package.json` adds a `dev:tunnel` script, shorthand for `skybridge dev --tunnel`.

The port also reads from the `PORT` environment variable. Set `SKYBRIDGE_OPEN=false` in your shell profile to skip opening DevTools on every run, the equivalent of always passing `--no-open`.

### Formatting structured logs

If your server uses a structured JSON logger like [bunyan](https://github.com/trentm/node-bunyan) or [pino](https://github.com/pinojs/pino), pass `--plain` and pipe through the logger's formatter:

```bash theme={null}
skybridge dev --plain | bunyan
skybridge dev --plain | pino-pretty
```

## `build`

Compile your views and MCP server for production.

```bash npm theme={null}
npx skybridge build
```

```bash pnpm theme={null}
pnpm skybridge build
```

```bash yarn theme={null}
yarn skybridge build
```

```bash bun theme={null}
bun skybridge build
```

```bash deno theme={null}
deno run -A npm:skybridge/skybridge build
```

The output lands in `dist/`, ready for the `deploy` script or `skybridge start`.

### Excluding packages from the server bundle

The build's last step bundles your server into a single deployable function with esbuild. Bundling means every reachable dependency has to be resolved, including ones your code never runs.

Some packages break that step. A common case is a logger with an optional native dependency, like [bunyan](https://github.com/trentm/node-bunyan), which does `require('dtrace-provider')` inside a `try/catch`. You never use DTrace, but esbuild still tries to resolve it and fails on the native binding.

List those packages in the Vite plugin's `serverExternal` to leave them out of the bundle:

```ts vite.config.ts theme={null}
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { skybridge } from "@skybridge/vite-plugin";

export default defineConfig({
  plugins: [react(), skybridge({ serverExternal: ["dtrace-provider"] })],
});
```

An external package stays a plain `import` in the output, resolved from `node_modules` at runtime. Only list packages your server doesn't need at runtime, or that your deployment target installs itself.

## `start`

Run the production server from the build output. Run `skybridge build` first.

```bash npm theme={null}
npx skybridge start
```

```bash pnpm theme={null}
pnpm skybridge start
```

```bash yarn theme={null}
yarn skybridge start
```

```bash bun theme={null}
bun skybridge start
```

```bash deno theme={null}
deno run -A npm:skybridge/skybridge start
```

* Serves the MCP endpoint at `http://localhost:3000/mcp`
* Runs the compiled server and pre-built view assets from `dist/`

| Flag | Description |
| - | - |
| `-p, --port <number>` | Port to run on. Defaults to `3000`, or the next free port if it's taken. Also reads `PORT`. |

## `telemetry`

The CLI reports anonymous usage, on by default. Toggle it with `skybridge telemetry disable`, `enable`, or `status`. See [Telemetry](https://docs.skybridge.tech/resources/telemetry.md) for what's collected and every way to opt out.

## Package scripts

A scaffolded project wires the commands into `package.json`:

| Script | Command | Description |
| - | - | - |
| `dev` | `skybridge dev` | Start the development server. |
| `dev:tunnel` | `skybridge dev --tunnel` | Start the dev server behind an Alpic tunnel. |
| `build` | `skybridge build` | Build for production. |
| `start` | `skybridge start` | Serve the production build. |
| `deploy` | `alpic deploy` | Deploy through the Alpic CLI. See [Deploy](https://docs.skybridge.tech/ship/deploy.md) for per-platform setup. |

Run them with your package manager:

```bash npm theme={null}
npm run dev
npm run build
npm start
```

```bash pnpm theme={null}
pnpm dev
pnpm build
pnpm start
```

```bash yarn theme={null}
yarn dev
yarn build
yarn start
```

```bash bun theme={null}
bun dev
bun build
bun start
```

```bash deno theme={null}
deno task dev
deno task build
deno task start
```

> [card] [Quickstart](https://docs.skybridge.tech/get-started/quickstart.md)
>
> Scaffold and run your first app

> [card] [Ship](https://docs.skybridge.tech/ship)
>
> Deploy to your platform of choice

> [card] [McpServer](https://docs.skybridge.tech/api-reference/mcp-server.md)
>
> The server the CLI builds and runs


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.