API reference › @evolu/common › local‑first/Evolu › createEvoluApp

function createEvoluApp<
  S extends Readonly<
    Record<string, Readonly<Record<string, AnyStandardSchemaV1>>>
  >,
  D extends Readonly<
    Record<string, Readonly<Record<string, AnyStandardSchemaV1>>>
  > = EmptyEvoluSchema,
>(
  schema: ValidateSchema<S> extends never ? S : ValidateSchema<S>,
  config: EvoluAppConfig<D>,
): Task<
  EvoluApp<S, D>,
  UnknownError,
  CreateDbWorkerDep &
    CreateBroadcastChannelDep &
    CreateMessageChannelDep &
    DevicePersistenceDep &
    LockManagerDep &
    ReloadAppDep &
    Partial<ConsoleDep> &
    Partial<CreateMemoryInstanceWorkerDep> &
    Partial<FlushSyncDep> &
    Partial<RequestPersistentStorageDep> &
    StoredWorkerDep
>;

Defined in: packages/common/src/local-first/Evolu.ts:2411

Creates an EvoluApp: Evolu creates and keeps the app's AppOwners in a device database that EvoluAppConfig.auth unlocks, and opens an instance of each AppOwner a tab opens. An app that brings its own AppOwners, such as one deriving them from a hardware wallet, calls createEvolu instead. It fails with UnknownError when SQLite fails to read the AppOwners or the device database is refused, as EvoluErrorDep.evoluError reports too.

It stays pending while another build of the app keeps it waiting, and when the shared worker fails to load on the web, which EvoluErrorDep.evoluError reports.

The Run that creates the app must outlive it, as a module-scope Run does: after that Run ends, such as after a panic, the app's methods throw.

See docs/adr/evolu-creates-and-stores-app-owners.md.