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

# Development

> Set up the Custody API locally and preview documentation changes

## Custody API local setup

<Steps>
  <Step title="Start dependencies">
    The Custody API requires PostgreSQL 16. Use Docker Compose from the repository root:

    ```bash theme={null}
    cd custody
    docker compose up -d postgres
    ```
  </Step>

  <Step title="Configure environment">
    Copy the example environment file and adjust values:

    ```bash theme={null}
    cp .env.example .env
    ```

    Key variables:

    | Variable       | Default                                             | Description                  |
    | -------------- | --------------------------------------------------- | ---------------------------- |
    | `DATABASE_URL` | `postgres://custody:custody@localhost:5432/custody` | PostgreSQL connection string |
    | `HTTP_ADDR`    | `:8080`                                             | API listen address           |
    | `LOG_LEVEL`    | `info`                                              | Log verbosity                |
    | `HMAC_SECRET`  | —                                                   | Webhook signing secret       |
  </Step>

  <Step title="Run the API">
    ```bash theme={null}
    go run ./cmd/custody-api
    ```

    The API will be available at `http://localhost:8080/v1`.
  </Step>
</Steps>

## Documentation preview

<Info>
  **Prerequisites**:

  * Node.js version 19 or higher
  * The `custody/docs` directory
</Info>

Follow these steps to install and run Mintlify on your operating system.

<Steps>
  <Step title="Install the Mintlify CLI">
    ```bash theme={null}
    npm i -g mint
    ```
  </Step>

  <Step title="Preview locally">
    Navigate to your docs directory where your `docs.json` file is located, and run the following command:

    ```bash theme={null}
    mint dev
    ```

    A local preview of your documentation will be available at `http://localhost:3000`.
  </Step>
</Steps>

## Custom ports

By default, Mintlify uses port 3000. You can customize the port Mintlify runs on by using the `--port` flag. For example, to run Mintlify on port 3333, use this command:

```bash theme={null}
mint dev --port 3333
```

If you attempt to run Mintlify on a port that's already in use, it will use the next available port:

```md theme={null}
Port 3000 is already in use. Trying 3001 instead.
```

## Mintlify versions

Please note that each CLI release is associated with a specific version of Mintlify. If your local preview does not align with the production version, please update the CLI:

```bash theme={null}
npm mint update
```

## Validating links

The CLI can assist with validating links in your documentation. To identify any broken links, use the following command:

```bash theme={null}
mint broken-links
```

## Deployment

If the deployment is successful, you should see the following:

<Frame>
  <img src="https://mintcdn.com/quantumchainpteltd/F-GjU7rr6IwFB5ET/images/checks-passed.png?fit=max&auto=format&n=F-GjU7rr6IwFB5ET&q=85&s=171c9cbe8730f969d60159def3e0cd11" alt="Screenshot of a deployment confirmation message that says All checks have passed." style={{ borderRadius: '0.5rem' }} width="1100" height="346" data-path="images/checks-passed.png" />
</Frame>

## Code formatting

We suggest using extensions on your IDE to recognize and format MDX. If you're a VSCode user, consider the [MDX VSCode extension](https://marketplace.visualstudio.com/items?itemName=unifiedjs.vscode-mdx) for syntax highlighting, and [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) for code formatting.

## Troubleshooting

<AccordionGroup>
  <Accordion title="Error: Could not load the &#x22;sharp&#x22; module using the darwin-arm64 runtime">
    This may be due to an outdated version of node. Try the following:

    1. Remove the currently-installed version of the CLI: `npm remove -g mint`
    2. Upgrade to Node v19 or higher.
    3. Reinstall the CLI: `npm i -g mint`
  </Accordion>

  <Accordion title="Issue: Encountering an unknown error">
    Solution: Go to the root of your device and delete the `~/.mintlify` folder. Then run `mint dev` again.
  </Accordion>
</AccordionGroup>

Curious about what changed in the latest CLI version? Check out the [CLI changelog](https://www.npmjs.com/package/mintlify?activeTab=versions).
