---
title: stx dev
description: Deploy a preview build for development.
icon: play
---

# stx dev

Deploy a preview build of your documentation to Syntext. Creates a `dev--` prefixed preview URL that updates as you save files.

## Usage

```bash
stx dev [options]
```

## Options

| Flag | Alias | Type | Default | Description |
|------|-------|------|---------|-------------|
| `--open` | `-o` | boolean | `false` | Open browser on start |
| `--no-watch` | | boolean | `false` | Disable file watching |
| `--verbose` | | boolean | `false` | Show detailed build output |

## Examples

### Start Preview

```bash
stx dev
```

Deploys to your preview URL (e.g., `https://dev--my-docs.syntext.dev`).

### Open Browser Automatically

```bash
stx dev --open
```

Opens the preview URL in your default browser after deployment.

## Features

### File Watching

The CLI watches for file changes and redeploys automatically:

- **MDX content** — Preview updates with new content
- **Configuration** — Navigation and theme update live
- **Static assets** — Images and files refresh automatically
- **Syntax errors** — Displayed in terminal with line numbers

### Error Reporting

When there's a syntax or build error, the terminal shows:

- Error message
- File path and line number
- Code snippet with the error highlighted
- Suggestions for fixing common issues

### Draft Pages

Pages with `draft: true` in frontmatter are visible in dev mode but hidden in production:

```mdx
---
title: Work in Progress
draft: true
---
```

## Output

```
  ╭─────────────────────────────────────────────────╮
  │                                                 │
  │   Syntext Dev                                   │
  │                                                 │
  │   Preview: https://dev--my-docs.syntext.dev    │
  │                                                 │
  │   Watching for changes...                       │
  │                                                 │
  ╰─────────────────────────────────────────────────╯

12:34:56 [syntext] docs/index.mdx changed
12:34:57 [syntext] ✓ Deployed in 1.2s
```

## Performance

Preview deployments are optimized for speed:

- **Initial deploy**: ~2-3 seconds for typical projects
- **Incremental update**: ~1-2 seconds per file change

<Note>
For large projects (1000+ pages), the first deploy may take a few seconds longer. Subsequent changes are fast due to incremental builds.
</Note>

## Troubleshooting

### Not Authenticated

```bash
Error: Not authenticated. Run `stx login` first.
```

Run `stx login` to authenticate with your Syntext account.

### Project Not Found

```bash
Error: Project not found. Run `stx init --create` first.
```

Ensure your `syntext.json` is linked to a Syntext project.

### File Changes Not Detected

If file watching stops working:

1. Check your file system supports inotify/FSEvents
2. Restart `stx dev`
3. On Linux, you may need to increase the watch limit:
   ```bash
   echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
   ```
