# createStorewareApp

> One object for webhooks, installs, admin sessions and API clients.

Source: https://storeware.ai/docs/sdk/app

```ts
import { ... } from '@storeware/plugin-sdk';
```

### createStorewareApp

```ts
function createStorewareApp(options: StorewareAppOptions): StorewareApp
```

### NotInstalledError

```ts
new NotInstalledError(storeId: string)
```

### StorewareAppOptions

| Name | Type | Description |
| --- | --- | --- |
| `clientId` | `string` |  |
| `clientSecret` | `string` |  |
| `installations` | `InstallationStore` |  |
| `apiUrl?` | `string` |  |
| `adminUrl?` | `string` |  |
| `fetchImpl?` | `typeof fetch` |  |

### AdminContext

Who is looking at your app's page in the admin. `installation` is the record your store keeps, or for an app Storeware hosts, the `HostedInstallation` the runtime hands over.

| Name | Type | Description |
| --- | --- | --- |
| `claims` | `ExtensionSessionClaims` |  |
| `installation` | `Installation` |  |
| `client` | `StorewareClient` |  |

### StorewareApp

| Name | Type | Description |
| --- | --- | --- |
| `webhooks` | `WebhookRouter` | Mount at your manifest's `[webhooks] url` (and `[privacy] url`). |
| `authenticateAdmin` | `(request: Request) => Promise<AdminContext<Installation>>` | The person looking at your home or panel in the admin, proved by the session token on the request (`?session=` or `Authorization: Bearer`). The first time a shop opens your home, the session is traded for its tokens and secrets, which is the install. |
| `verifyRequest` | `<T = unknown>(request: Request, kind: Exclude<SignedRequestKind, 'webhook'>) => Promise<{ body: T; installation: Installation; }>` | A signed call from Storeware to a tool, knowledge or block endpoint, verified as that kind, with its body parsed. Read the body nowhere else. |
| `clientFor` | `(storeId: string) => Promise<StorewareClient>` | An API client for one shop. Its tokens rotate into the store. |
| `installUrl` | `(options?: { storeId?: string; }) => string` | Where to send a merchant to install your app from Storeware. |
