[API reference](https://evolu.dev/docs/api-reference) › [@evolu/nodejs](https://evolu.dev/docs/api-reference/nodejs) › NodeJsRelayConfig

Defined in: [nodejs/src/local-first/Relay.ts:32](https://github.com/evoluhq/evolu/blob/e7144e2bbe9069362b62dec1b64a8aa922b8f1b0/packages/nodejs/src/local-first/Relay.ts#L32)

## Extends

- [`RelayConfig`](https://evolu.dev/docs/api-reference/common/local-first/Relay/interfaces/RelayConfig)

## Properties

<a id="isownerallowed"></a>

### isOwnerAllowed?

```ts
readonly optional isOwnerAllowed?: (ownerId: string & Brand<"Id"> & Brand<"OwnerId">) => Awaitable<boolean>;
```

Defined in: common/dist/src/local-first/Relay.d.ts:63

Optional callback to check if an [OwnerId](https://evolu.dev/docs/api-reference/common/local-first/Owner/variables/OwnerId) is allowed to access the
relay. If this callback is not provided, all owners are allowed.

The callback receives the [OwnerId](https://evolu.dev/docs/api-reference/common/local-first/Owner/variables/OwnerId) and returns a [Awaitable](https://evolu.dev/docs/api-reference/common/Types/type-aliases/Awaitable)
boolean: `true` to allow access, or `false` to deny.

The callback can be synchronous (for SQLite or in-memory checks) or
asynchronous (for calling remote APIs).

The callback returns a boolean rather than an error type because error
handling and logging are the responsibility of the callback
implementation.

OwnerId is used rather than short-lived tokens because this only controls
relay access, not write permissions. Since all data is encrypted on the
relay, OwnerId exposure is safe.

Owners specify which relays to connect to via `OwnerTransport`. In
WebSocket-based implementations, this check occurs before accepting the
connection, with the OwnerId typically extracted from the URL Path (e.g.,
`ws://localhost:4000/<ownerId>`). The relay requires the URL to be in the
correct format for OwnerId extraction.

### Example

```ts
// Client
const transport = createOwnerWebSocketTransport({
  url: "wss://relay.evolu.dev",
  ownerId: owner.id,
});

const evolu = createEvolu(deps)(Schema, {
  transports: [transport],
});

// Relay
isOwnerAllowed: (ownerId) =>
  Promise.resolve(ownerId === "6jy_2F4RT5qqeLgJ14_dnQ"),
```

#### Inherited from

[`RelayConfig`](https://evolu.dev/docs/api-reference/common/local-first/Relay/interfaces/RelayConfig).[`isOwnerAllowed`](https://evolu.dev/docs/api-reference/common/local-first/Relay/interfaces/RelayConfig#isownerallowed)

---

<a id="isownerwithinquota"></a>

### isOwnerWithinQuota

```ts
readonly isOwnerWithinQuota: (ownerId: string & Brand<"Id"> & Brand<"OwnerId">, requiredBytes: number & Brand<"Int"> & Brand<"NonNegative"> & Brand<"Positive">) => Awaitable<boolean>;
```

Defined in: common/dist/src/local-first/Storage.d.ts:48

Callback called before an attempt to write, to check if an [OwnerId](https://evolu.dev/docs/api-reference/common/local-first/Owner/variables/OwnerId)
has sufficient quota for the write.

The callback receives the [OwnerId](https://evolu.dev/docs/api-reference/common/local-first/Owner/variables/OwnerId) and the total bytes that would be
stored after the write (current stored bytes plus incoming bytes), and
returns a [Awaitable](https://evolu.dev/docs/api-reference/common/Types/type-aliases/Awaitable) boolean: `true` to allow the write, or `false`
to deny it due to quota limits.

The callback can be synchronous (for SQLite or in-memory checks) or
asynchronous (for calling remote APIs).

The callback returns a boolean rather than an error because error handling
and logging are the responsibility of the callback implementation.

### Example

```ts
// Client
// evolu.subscribeError

// Relay
isOwnerWithinQuota: (ownerId, requiredBytes) => {
  console.log(ownerId, requiredBytes);
  // Check error via evolu.subscribeError
  return true;
};
```

#### Inherited from

[`RelayConfig`](https://evolu.dev/docs/api-reference/common/local-first/Relay/interfaces/RelayConfig).[`isOwnerWithinQuota`](https://evolu.dev/docs/api-reference/common/local-first/Relay/interfaces/RelayConfig#isownerwithinquota)

---

<a id="name"></a>

### name?

```ts
readonly optional name?: string & Brand<"UrlSafeString"> & Brand<"Name">;
```

Defined in: common/dist/src/local-first/Relay.d.ts:19

The relay name.

Implementations can use this for identification purposes (e.g., database
file name, logging).

#### Inherited from

[`RelayConfig`](https://evolu.dev/docs/api-reference/common/local-first/Relay/interfaces/RelayConfig).[`name`](https://evolu.dev/docs/api-reference/common/local-first/Relay/interfaces/RelayConfig#name)

---

<a id="port"></a>

### port?

```ts
readonly optional port?: number;
```

Defined in: [nodejs/src/local-first/Relay.ts:34](https://github.com/evoluhq/evolu/blob/e7144e2bbe9069362b62dec1b64a8aa922b8f1b0/packages/nodejs/src/local-first/Relay.ts#L34)

The port number for the HTTP server.