---
title: stx init
description: Initialize a new Syntext documentation project.
icon: plus
---

# stx init

Initialize a new Syntext documentation project with the recommended folder structure and configuration.

## Usage

```bash
stx init [options]
```

## Options

| Flag | Alias | Type | Default | Description |
|------|-------|------|---------|-------------|
| `--name` | `-n` | string | folder name | Project name |
| `--create` | | boolean | `false` | Create project on Syntext and link |
| `--template` | `-t` | string | `default` | Starter template |
| `--layout` | `-l` | string | auto | `standalone` or `embedded` |
| `--skip-git` | | boolean | `false` | Don't initialize git repository |
| `--force` | `-f` | boolean | `false` | Overwrite existing files |

## Examples

### Basic Initialization

```bash
stx init
```

Creates a new docs folder with default configuration in the current directory.

### Named Project with Remote Link

```bash
stx init --name "My API Docs" --create
```

Creates the project locally and registers it on Syntext for deployment.

### Using a Template

```bash
stx init --template api
```

Available templates:
- `default` — Basic documentation site
- `api` — API reference with OpenAPI integration
- `sdk` — SDK documentation with multi-language examples
- `landing` — Marketing-focused landing page

### Embedded Layout (Inside Existing Repo)

```bash
stx init --layout embedded
```

Creates documentation in `.syntext/` folder, keeping your project root clean.

## Generated Structure

### Standalone Layout

```
my-docs/
├── syntext.json
├── docs/
│   ├── index.mdx
│   └── guides/
│       └── getting-started.mdx
├── public/
│   └── favicon.ico
└── .gitignore
```

### Embedded Layout

```
my-project/
├── src/
├── package.json
└── .syntext/
    ├── syntext.json
    ├── docs/
    │   └── index.mdx
    └── public/
```

## Configuration File

The generated `syntext.json`:

```json
{
  "name": "My Docs",
  "description": "Documentation for My Docs",
  "theme": "default",
  "colors": {
    "primary": "#6366F1"
  },
  "navigation": [
    {
      "group": "Getting Started",
      "pages": ["index", "guides/getting-started"]
    }
  ]
}
```

## Interactive Mode

Running `stx init` without flags starts an interactive wizard:

```
? Project name: My API Docs
? Description: Documentation for our REST API
? Primary color: #6366F1
? Template: api
? Create on Syntext? Yes

✓ Created syntext.json
✓ Created docs/index.mdx
✓ Created docs/guides/getting-started.mdx
✓ Linked to Syntext project: my-api-docs

Run `stx dev` to start the development server.
```

## Linking to Syntext

If you skip `--create` during init, link later with:

```bash
stx connect
```

This associates your local project with a Syntext project for deployment.

<Tip>
Use `stx init --create` for new projects. This ensures deployment works immediately with `stx deploy`.
</Tip>
