[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Task](https://evolu.dev/docs/api-reference/common/Task) › createRun

```ts
const createRun: CreateRun<RunDeps>;
```

Defined in: [packages/common/src/Task.ts:1186](https://github.com/evoluhq/evolu/blob/e7144e2bbe9069362b62dec1b64a8aa922b8f1b0/packages/common/src/Task.ts#L1186)

Creates root [Run](https://evolu.dev/docs/api-reference/common/Task/interfaces/Run).

The root Run is also the daemon Run: it stays running until disposed. Child
Runs created by `run(task)` are disposed by their parent once they settle.

Call once per entry point (main thread, worker, etc.) and dispose on
shutdown. All Tasks run as descendants of this root Run.

This common [createRun](https://evolu.dev/docs/api-reference/common/Task/variables/createRun) is platform-agnostic. At application entry
points, prefer the platform adapter when one exists. `@evolu/web` adds
browser `error` and `unhandledrejection` handlers, `@evolu/nodejs` adds
Node.js `uncaughtException`, `unhandledRejection`, and graceful shutdown
handling, and `@evolu/react-native` adds React Native global error handling.

[RunDeps](https://evolu.dev/docs/api-reference/common/Task/type-aliases/RunDeps) provides default dependencies:

- [Time](https://evolu.dev/docs/api-reference/common/Time/interfaces/Time)
- [Console](https://evolu.dev/docs/api-reference/common/Console/interfaces/Console)
- [Random](https://evolu.dev/docs/api-reference/common/Random/interfaces/Random)
- [RandomBytes](https://evolu.dev/docs/api-reference/common/Crypto/interfaces/RandomBytes)

### Example

```ts
// App entry point
await using run = createRun();

const result = await run(fetchData);
```

### Example with custom dependencies

```ts
// Define dependency interfaces
interface Config {
  readonly apiUrl: string;
}

interface ConfigDep {
  readonly config: Config;
}

// Task declares its dependencies via the D type parameter
const fetchUser =
  (id: string): Task<User, FetchError, ConfigDep> =>
  async (run) => {
    const { config } = run.deps;
    const response = await fetch(`${config.apiUrl}/users/${id}`);
    // ...
  };

// Composition root: create a Run with custom deps
type AppDeps = RunDeps & ConfigDep;

const appDeps: AppDeps = {
  ...testCreateDeps(), // or spread individual deps
  config: { apiUrl: "https://api.example.com" },
};

await using run = createRun(appDeps);

// Run type is inferred from the deps argument
const result = await run(fetchUser("123"));

// TypeScript catches missing deps at compile time:
// await using run2 = createRun(); // Run<RunDeps>
// run2(fetchUser("123")); // Error: Property 'config' is missing
```