> For the complete documentation index, see [llms.txt](https://rivet.itg.sh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rivet.itg.sh/contracts/configuration.md).

# Configuration

If you don't want to use the Rivet default configuration, you can move your configuration into a separate file.

## File-based Configuring

### `package.json`

```javascript
{
  "rivet": {
    "contractsRoot": "contracts/"
  }
}
```

### Standalone file

Rivet accepts configuration files with the conventions.

* `.rivetrc`
* `.rivetrc.[js|json]`
* `.rivet.[js|json]`
* `rivetrc`
* `rivetrc.[js|json]`
* `rivet.[js|json]`

```javascript
module.exports = {
  contractsRoot: 'contracts/'
};
```

All configurations found will be merged into a single configuration object. That means if you have both a rivet configuration file, and rivet configuration defined in `package.json`, they will be merged. `package.json` is the last file read, and anything specified will overwrite other configurations.

> NOTE: Rivet configuration files are CommonJS modules. You can use any javascript here, as long as you export a configuration object.

## Configuration options

### `appRoot`

The root app path.

> Default: Root app directory with package.json

### `contractsRoot`

The root path to your contracts folder, relative to `appRoot`.

> Default: `contracts/"`

### `contractsPath`

Glob pattern used to find contract files, relative to `contractsRoot`.

> Default: `"**/*.contract.json"`

### `compiledContractsRoot`

The location where contracts are compiled, relative to `appRoot`.

> Default: `contracts/json`

### `aliases`

| alias:                                    | `require("mypath")`              | `require("mypath/endpoint.contract.js")`     |
| ----------------------------------------- | -------------------------------- | -------------------------------------------- |
| `{}`                                      | `"node_modules/mypath/index.js"` | `"node_modules/mypath/endpoint.contract.js"` |
| `{ mypath: "/absolute/path/to/file.js" }` | `"/absolute/path/to/file.js"`    | `error`                                      |
| `{ mypath: "/absolute/path" }`            | `"/absolute/path/index.js"`      | `"/absolute/path/endpoint.contract.js"`      |


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://rivet.itg.sh/contracts/configuration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
