# References

Author-scoped record resolution.

[Read the record references guide](/docs/references/). Signatures below come from the published SDK declarations. Access SDK services through `db`; use their constructors only when integrating at a lower level.

## RecordReference


```ts
interface RecordReference<K extends string = string> {
  table: K;
  id: string;
  author: string;
}
```

## reference


```ts
declare function reference<K extends string>(
  table: K,
  id: string,
  author: string,
): RecordReference<K>;
```

## NostrbaseRelations


```ts
/** References are resolved in the client. They do not enforce foreign keys. */
declare class NostrbaseRelations<DB extends SchemaShape<DB>> {}
```

### constructor


```ts
constructor(host: RelationsHost<DB>);
```

### resolve


```ts
resolve<K extends keyof DB & string>(
  target: RecordReference<K>,
): Promise<Result<Row<DB[K]>>>;
```

### resolveMany


```ts
resolveMany<K extends keyof DB & string>(
  targets: readonly RecordReference<K>[],
): Promise<Result<(Row<DB[K]> | null)[]>>;
```


## Supporting declarations

These types appear in public signatures but are not package exports.

### RelationsHost


```ts
interface RelationsHost<DB extends SchemaShape<DB>> {
  from<K extends keyof DB & string>(table: K): QueryBuilder<DB[K]>;
}
```
