# 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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
