# Install

Add docsp and Astro to a repository and run the docsp command.

docsp is the npm package `@fabricators/docsp`. It ships the `docsp` command, the Astro integration, the components and
the JSON Schemas of the configuration files.

## Requirements

- Node.js 22.12 or later.
- Astro 7.4 or later, installed next to docsp (it is a peer dependency).
- git, when you want the "updated" date of pages to come from the history or when you use the symbol index.

## Add the package

Install docsp and Astro as development dependencies in the folder that will hold `site.json`:

:::code-group
```terminal label="npm"
$ npm install -D @fabricators/docsp astro
```

```terminal label="pnpm"
$ pnpm add -D @fabricators/docsp astro
```
:::

In a pnpm workspace that also contains docsp itself, use the workspace version instead:

```json title="package.json"
{
  "dependencies": {
    "@fabricators/docsp": "workspace:*",
    "astro": "^7.4.12"
  }
}
```

This is how the example site and this documentation site depend on docsp in the docsp repository.

## Add the scripts

Add the three commands to `package.json`, so you and your CI run them the same way:

```json title="package.json"
{
  "scripts": {
    "dev": "docsp dev",
    "build": "docsp build",
    "check": "docsp check"
  }
}
```

:::tip[No Astro configuration needed.]
The `docsp` command passes its own configuration to Astro. If you want your own `astro.config.mjs`, add the
integration there and run Astro directly: `import docsp from '@fabricators/docsp'` and
`integrations: [docsp({ catalog: false })]`.
:::

## Editor completion

The JSON Schemas are in the package. Point `$schema` at them in each file and your editor completes and validates
every field:

```json
{ "$schema": "./node_modules/@fabricators/docsp/schema/site.schema.json" }
```

```json
{ "$schema": "../node_modules/@fabricators/docsp/schema/project.schema.json" }
```

The second form is for a `project.json` one folder below `site.json`.

Next: [build a first site](./first-site.md).
