# IMQClient.create() method · @imqueue/rpc

Source: https://imqueue.org/api/rpc/latest/rpc.imqclient.create/
Published: 2026-08-04
Author: @imqueue maintainers (https://github.com/imqueue)
Package: @imqueue/rpc 3.5.3 — generated reference, not hand-written

Generates a client for the service registered under the given queue name and resolves to the generated namespace object — not to a client instance, and not to an [IMQClient](https://imqueue.org/api/rpc/latest/rpc.imqclient/).

**Signature:**

```typescript
static create(name: string, options?: Partial<IMQClientOptions>): Promise<any>;
```

## Parameters


| Parameter | Type | Description |
| --- | --- | --- |
| name | string | name of the queue the target service listens on (its service name, which is the class name by default). Also used as the base name of the generated files. |
| options | Partial<[IMQClientOptions](https://imqueue.org/api/rpc/latest/rpc.imqclientoptions/)> | _(Optional)_ client options, merged over [DEFAULT\_IMQ\_CLIENT\_OPTIONS](https://imqueue.org/api/rpc/latest/rpc.default_imq_client_options/) |


**Returns:**

Promise<any>

the generated namespace object, exposing the generated client class (`<Service>Client`, with a trailing `Service` replaced by `Client`) plus one interface per registered service type. It is produced at runtime, so it is typed `any` — cast it or type the call site yourself. Resolves to `null` instead when [IMQClientOptions.compile](https://imqueue.org/api/rpc/latest/rpc.imqclientoptions.compile/) is false.

## Exceptions

EvalError when the target service does not answer within [IMQClientOptions.timeout](https://imqueue.org/api/rpc/latest/rpc.imqclientoptions.timeout/) milliseconds

## Remarks

Generating a client requires the target service to be running: this sends a live description request over the queue and fails if no answer arrives in time.

It always transpiles the generated source by spawning TypeScript synchronously, so the call blocks the event loop, and it rejects if transpilation emits nothing. When [IMQClientOptions.write](https://imqueue.org/api/rpc/latest/rpc.imqclientoptions.write/) is set — the default — it writes both `<path>/<name>.ts` and `<path>/<name>.js`, silently overwriting any existing files, and creates `path` only one level deep.

The identifiers inside the generated module come from the service's own reported class name, so if that differs from `name` the file name and the namespace/class names differ too.

## Example


```typescript
const ns = await IMQClient.create('UserService');
const client = new ns.UserClient();

await client.start();
```

