---
title: stx deploy
description: Deploy your documentation to the Syntext CDN.
icon: rocket
---

# stx deploy

Deploy your documentation to Syntext's global CDN with automatic SSL and instant cache invalidation.

## Usage

```bash
stx deploy [options]
```

## Options

| Flag | Alias | Type | Default | Description |
|------|-------|------|---------|-------------|
| `--preview` | `-p` | boolean | `false` | Create a preview deployment |
| `--branch` | `-b` | string | current branch | Branch name for preview URL |
| `--message` | `-m` | string | git commit message | Deployment message |
| `--skip-build` | | boolean | `false` | Deploy existing `dist/` folder |
| `--wait` | | boolean | `true` | Wait for deployment to complete |

## Examples

### Production Deployment

```bash
stx deploy
```

Deploys to your production URL (e.g., `your-project-docs.syntext.dev`).

### Preview Deployment

```bash
stx deploy --preview
```

Creates a unique preview URL like `preview-abc123-docs.syntext.dev`.

### Branch Preview

```bash
stx deploy --preview --branch feature/new-api
```

Creates a branch-specific preview at `feature-new-api-docs.syntext.dev`.

### Skip Build

If you've already run `stx build`:

```bash
stx deploy --skip-build
```

## Deployment Output

```
stx deploy

Building documentation...
✓ Build complete (2.1s)

Deploying to Syntext...
  ↑ Uploading 47 files (4.2 MB)
  ✓ Uploaded in 1.3s
  ⟳ Invalidating cache...
  ✓ Cache invalidated

Deployment complete!

Production:  https://your-project-docs.syntext.dev
Dashboard:   https://syntext.dev/dashboard/projects/your-project

Deployed by josh at 2024-01-15 12:34:56 UTC
```

## Default Domain

Every project gets a free subdomain:

```
{project-slug}-docs.syntext.dev
```

The slug is derived from your project name. For example, "My API" becomes `my-api-docs.syntext.dev`.

## Custom Domains

Add a custom domain in the [dashboard](https://syntext.dev/dashboard):

1. Go to **Project Settings** → **Domains**
2. Add your domain (e.g., `docs.yourcompany.com`)
3. Configure DNS:
   ```
   CNAME  docs  →  proxy.syntext.dev
   ```
4. SSL certificate is provisioned automatically

<Tip>
Custom domains require the Pro plan. See [pricing](https://syntext.dev/pricing) for details.
</Tip>

## Preview Deployments

Preview deployments are useful for:

- **PR reviews** — Review doc changes before merging
- **Staging** — Test with production-like environment
- **Client feedback** — Share work-in-progress with stakeholders

Preview URLs expire after 30 days of inactivity.

## CI/CD Integration

### GitHub Actions

```yaml
name: Deploy Docs

on:
  push:
    branches: [main]
  pull_request:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      
      - name: Setup Bun
        uses: oven-sh/setup-bun@v1
      
      - name: Install stx
        run: curl -fsSL https://get.syntext.dev | sh
      
      - name: Deploy
        run: |
          if [ "${{ github.event_name }}" = "pull_request" ]; then
            stx deploy --preview --branch ${{ github.head_ref }}
          else
            stx deploy
          fi
        env:
          SYNTEXT_API_KEY: ${{ secrets.SYNTEXT_API_KEY }}
```

### GitLab CI

```yaml
deploy:
  image: oven/bun:latest
  script:
    - curl -fsSL https://get.syntext.dev | sh
    - stx deploy
  only:
    - main
  variables:
    SYNTEXT_API_KEY: $SYNTEXT_API_KEY
```

## Authentication

Deployments require authentication. Set your API key:

```bash
export SYNTEXT_API_KEY=stx_abc12345_...
```

Get your API key from the [dashboard](https://syntext.dev/dashboard/settings/api-keys).

## Rollbacks

If a deployment causes issues, rollback from the dashboard:

1. Go to **Project** → **Deployments**
2. Find the previous working deployment
3. Click **Rollback to this version**

Or via CLI:

```bash
stx rollback --deployment dpl_abc123
```

## CDN Architecture

Syntext uses Cloudflare's global network:

- **300+ edge locations** worldwide
- **< 50ms TTFB** in most regions
- **Automatic compression** (gzip, brotli)
- **HTTP/3 support**
- **DDoS protection** included

Static assets are cached indefinitely with content-based hashes. HTML pages are cached with instant purge on deploy.
