> For the complete documentation index, see [llms.txt](https://docs.chord.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chord.co/chord-oms/shopify/developer-tools/next-js/developing.md).

# Developing

Here are some common scripts that you'll use to work with [Chord's Next.js starter kit](https://github.com/chordcommerce/nextjs-starter-performance). As with any Next.js site, you can customize the `scripts` in [`package.json`](https://github.com/chordcommerce/nextjs-starter-performance/blob/main/package.json#L5-L15) , but we'll describe the defaults here.

### Starting a development server

{% tabs %}
{% tab title="yarn" %}

```shell
yarn dev
```

{% endtab %}

{% tab title="npm" %}

```shell
npm run dev
```

{% endtab %}
{% endtabs %}

Starts a Next.js server in development mode on <http://localhost:3000>. Hot reload is automatically enabled.

### Running unit tests

{% tabs %}
{% tab title="yarn" %}

```shell
yarn test            # runs all tests
yarn test:watch      # runs all tests in watch mode
```

{% endtab %}

{% tab title="npm" %}

```shell
npm test             # runs all tests
npm run test:watch   # runs all tests in watch mode
```

{% endtab %}
{% endtabs %}

This starter uses [Jest](https://jestjs.io/), and [react-testing-library](https://github.com/testing-library/react-testing-library) to test React components. Running the tests in `watch` mode will re-run the tests any time a code change is detected.

### Building a production site

{% tabs %}
{% tab title="yarn" %}

```shell
yarn build
```

{% endtab %}

{% tab title="npm" %}

```shell
npm run build
```

{% endtab %}
{% endtabs %}

Builds the site for production.

### Starting a production server

{% tabs %}
{% tab title="yarn" %}

```shell
yarn start
```

{% endtab %}

{% tab title="npm" %}

```shell
npm start
```

{% endtab %}
{% endtabs %}

Starts a production Next.js server on <http://localhost:3000>.

### Optimizing a production site

The starter kit comes with [`@next/bundle-analyzer`](https://www.npmjs.com/package/@next/bundle-analyzer) , which generates a visualization of the site's Javascript bundles. This can be helpful for understanding and optimizing bundle size.

{% tabs %}
{% tab title="yarn" %}

```shell
yarn analyze
```

{% endtab %}

{% tab title="npm" %}

```shell
npm run analyze
```

{% endtab %}
{% endtabs %}

Runs `next build` and also opens a browser window with an interactive visualization of bundles.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chord.co/chord-oms/shopify/developer-tools/next-js/developing.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
