> ## Documentation Index
> Fetch the complete documentation index at: https://developers.zite.com/llms.txt
> Use this file to discover all available pages before exploring further.

# App config

> Reference for every field in a Start app's zite.config.json: access mode, sign-in settings, auth hooks, integrations, secrets, and the tab title, favicon and link preview.

Each app is configured by its own `apps/<dir>/zite.config.json`, and the workspace root has a
`zite.config.json` that holds the workspace's integrations. You edit both directly, with the `write_file` and
`edit_file` [build tools](https://developers.zite.com/mcp/build-tools.md). This page documents every field: its type, valid values, and
constraints.

## Fields you don't edit

A few fields are written by the platform or changed in the editor. Keep them as they are whenever you
rewrite the file.

| Field | Who changes it |
| - | - |
| `id` | The platform writes the app's identifier when the app is scaffolded. Never add, change, or remove it. It's baked into the build, and without it every request the app makes to its own API returns 404 and the app never loads |
| `envVars` | People, in **Settings → Secrets**. Never add, edit, or remove keys here: the Secrets store is the source of truth, and hand edits are wiped on the next sync. See [`envVars`](#envvars) |
| `brandKitId`, `brandKitThemeHash` | Zite sets them when a brand kit is applied, along with the theme CSS |
| `pwaSettings` | The **Settings → Mobile** screen, which is where an installable app is turned on. See [Make your app installable](https://developers.zite.com/recipes/pwa.md) |

## accessMode

`"internal" | "external"`, optional. Controls who can reach the app.

| Value | Who can reach it |
| - | - |
| `"internal"` | Organization members only, signed in automatically |
| `"external"` | Anyone with the URL. Sign-in is optional |

New apps are seeded with an explicit `"internal"`. If the key is absent entirely, the app falls back to
`"external"`, so read the app's own `zite.config.json` rather than assuming.

Set this field directly. Writing it publishes nothing: the live app's access changes only when the app is
published, and the publish dialog warns which apps a publish would make public or internal. Change the
value, but never remove the key: an app that loses it falls back to the default instead of keeping the
mode that was chosen. See [Access and sign-in](https://developers.zite.com/framework/access-and-sign-in.md) for what each mode
means for your code.

## authentication

Controls the sign-in methods, who may sign up, and the sender of sign-in emails.

> [!NOTE]
>
> Whether a public app has sign-in is decided by its code, not by this field. An app has sign-in when its
> pages send people to sign in (a `loginHref` guard in `beforeLoad`) and its server functions are
> `signedInFn`. A landing page built from scratch simply never does. To remove built-in sign-in, remove
> those guards and sign-in links and make the functions behind public pages `publicFn`, and keep any custom
> authentication the app implements against its own data or integrations. This field configures how sign-in
> works for an app that uses it, so leave it alone when removing sign-in.

```json theme={"system"}
{
  "authentication": {
    "signup": "open",
    "domains": ["acme.com"],
    "authenticationMethods": {
      "emailSignIn": true,
      "googleSignIn": true,
      "sso": false
    },
    "emailSender": {
      "integrationId": "my-email-sender"
    },
    "emailBrandKitId": "bk_abc123",
    "authPage": {
      "showLogo": true,
      "messages": {
        "signInTitle": "Welcome back",
        "signUpTitle": "Join us",
        "signInSubtitle": "Sign in to continue",
        "signUpSubtitle": "Create your account"
      }
    }
  }
}
```

| Field | Type | Notes |
| - | - | - |
| `signup` | `"disabled" \| "open" \| "domain-restricted"` | `"disabled"` admits existing users only, `"open"` anyone, and `"domain-restricted"` only emails on `domains` |
| `domains` | `string[]` | Email domains, like `["acme.com"]`. Required when `signup` is `"domain-restricted"` |
| `authenticationMethods.emailSignIn` | `boolean` | Sign-in by email: the person enters their email, then a six-digit code sent to it |
| `authenticationMethods.googleSignIn` | `boolean` | Sign in with Google |
| `authenticationMethods.sso` | `boolean` | Single sign-on. Enterprise plan |
| `emailSender.integrationId` | `string` | Sends sign-in emails through an `email` integration. Business plan. See below |
| `emailBrandKitId` | `string` | Brand kit for sign-in emails. Omit to inherit the app's `brandKitId`. Business plan |
| `authPage.showLogo` | `boolean` | Shows the linked brand kit's logo on the sign-in and sign-up screen. Business plan |
| `authPage.messages` | `object` | The screen's copy: `signInTitle`, `signUpTitle`, `signInSubtitle`, `signUpSubtitle`. Business plan |

**Constraints:**

* When `signup` is `"domain-restricted"`, `domains` must be a non-empty array.
* When `authentication` exists, at least one of `emailSignIn`, `googleSignIn` or `sso` must be `true`.

> [!NOTE]
>
> SSO (`authenticationMethods.sso`) needs the Enterprise plan: without it, leave `sso` as `false`. The
> sign-in email fields (`emailSender`, `emailBrandKitId`) and `authPage` need the Business plan: without it,
> leave them unset.

**`emailSender`** routes sign-in emails through an `email` integration whose provider is `"gmail"`,
`"outlookEmail"` or `"smtp"`. That's the `email` type with one of those providers, not a `gmail` or
`outlook` type integration. If there's none, connect one with `setup_integration`. A workspace integration
also needs this app's `integrationSettings.<name>` entry, and `{}` is enough. `"zite_email"` is the default
sender, so leave `emailSender` unset to use it. A sender the app can't use is ignored, and sign-in emails go
out from the default Zite address.

**`authPage`** customizes the sign-in and sign-up screen's logo (the linked brand kit's) and copy. Its
colours, fonts and radius come from the `:root` variables in `src/index.css`, which also style the rest of
the app. The screen uses the `:root` values even when the app is in dark mode, so a sign-in-only colour
change isn't possible.

## Auth hooks

When an app's users live in an external system (an Airtable table, a CRM, an internal API), define auth
lifecycle hooks in `zite.auth.ts` at the app root, next to `zite.config.json`. This is app code, not
config:

```typescript theme={"system"}
// apps/<app>/zite.auth.ts
import { ziteAuth } from 'zitejs/auth/server';

export default ziteAuth({
  hooks: {
    async beforeSignUp(input) {
      // e.g. only admit emails found in an Airtable roster (ilike: stored emails may be mixed-case)
      const match = await Roster.findOne({ filters: { email: { ilike: input.email } } });
      return match ? { allow: true } : { deny: true, reason: 'Not in the team directory.' };
    },
    async afterSignUp({ user }) {
      // e.g. mirror the new user back into the external system
    },
    async verifySession(input) {
      // e.g. revoke access when the external source dropped the user
      return stillActive ? { active: true } : { active: false };
    },
  },
});
```

In this sketch, `Roster` is the app's generated Airtable client for the roster table, and `stillActive` is
your own lookup in the external system.

Every hook is optional and fully typed through the import, so no annotations are needed. The `user` the
hooks receive is `{ id, email, name }`.

| Hook | Called | Returns |
| - | - | - |
| `beforeSignUp({ email, firstName?, lastName? })` | Before someone signs up | `{ allow: true }` admits the email even when `signup` is `"disabled"` or `"domain-restricted"` (for example, it's on an external roster). `{ deny: true, reason }` blocks. Anything else defers to the normal rules |
| `beforeSignIn({ email })` | When an existing member signs in, with every provider: email code, Google, SSO | The same shape as `beforeSignUp`. Deny when the external source dropped them |
| `afterSignUp({ user })` | After someone signs up | Nothing. Side effects only, such as mirroring the user into the external system or a welcome email. Can't block |
| `afterSignIn({ user })` | After someone signs in | Nothing. Side effects only. Can't block |
| `verifySession({ user })` | At sign-in, and periodically while the session is live | `{ active: false }` revokes the session. `{ active: true }` keeps it |

### When a hook fails

* `beforeSignUp` and `beforeSignIn` fail closed: one that throws or times out turns the person away.
* A `verifySession` that fails keeps the session.
* Errors in `afterSignUp` and `afterSignIn` are ignored.

### verifySession

* **Only `active` is read.** `context.user` carries the platform's fields alone, so a server function that
  needs more about the person looks it up in the external source.
* **Results are cached for about 5 minutes.**
* **A revocation signs the person out for real**, in each browser at its next check. Return
  `{ active: false }` only when you're sure the person is gone, not when a lookup merely came back empty.
* **Match identifiers case-insensitively, not with `===`.** Use `ilike` on an Airtable table. A Zite
  Database table has no `ilike`, and a filter using it matches no records: filter with `contains`, and keep
  the record whose value, lowercased, equals the lowercased email.

### Gotchas

* **Neither sign-in gate runs for a user created seconds ago.** A sign-up in flight hasn't reached your
  external system yet (`afterSignUp` runs after it), so gating it would deny the very sign-up you just
  allowed.
* **Write hook functions out literally**, as `async beforeSignUp(input) { ... }`. Which hooks exist is
  detected from the file at build time.
* **Pair external-roster hooks with `signup: "disabled"`**, so the roster and invitations are the only
  ways in.

## integrations and integrationSettings

Two files, two jobs. The workspace root `zite.config.json` holds the connections, under `integrations`,
and every app in the workspace can use them. An app's own `apps/<dir>/zite.config.json` holds only what
differs for that app, under `integrationSettings`, keyed by the workspace integration's name.

```json title="zite.config.json (workspace root)" theme={"system"}
{
  "integrations": {
    "airtable": { "type": "airtable", "connectionId": "svc_abc123" },
    "slack": { "type": "slack", "connectionId": "svc_def456" },
    "notion": { "type": "notion", "connectionId": "svc_ghi789" },
    "openai": { "type": "openai", "connectionId": "svc_jkl012" },
    "email": { "type": "email", "provider": "zite_email" }
  }
}
```

```json title="apps/<dir>/zite.config.json" theme={"system"}
{
  "integrationSettings": {
    "airtable": { "base": "appABC123" },
    "slack": { "channel": "#alerts" },
    "email": { "fromName": "Acme Notifications" },
    "openai": { "model": "gpt-6.1-sol" }
  }
}
```

* **An app uses a workspace integration without declaring anything.** `integrationSettings` is only for the
  fields listed below, and an entry there never carries `type` or `connectionId`.
* **Four types give an app nothing until it has a settings entry:** `airtable`, `googlesheets`, `email` and
  `googleAnalytics`. A workspace Airtable is only an account until an app names its `base`, which is what
  generates the app's Airtable client in `zitejs/integrations`. An app's email client comes from its
  `email` settings (an empty `{}` is enough), and its Google Analytics tracking from its `measurementId`.
  Google Sheets names a `spreadsheet` too, though it generates no client: use the `@googleapis/sheets`
  package.
* **An `integrations` entry in an app's config shadows the workspace's entry of the same name.** Older apps
  may have entries there from before. They keep working and don't need moving.

### Per-app settings

In an app's `integrationSettings.<name>`:

| Type | Settings |
| - | - |
| `airtable` | `base`: the Airtable base ID, such as `"appABC123"` |
| `slack` | `channel`: a display name like `"#general"` |
| `googlesheets` | `spreadsheet`: the spreadsheet ID |
| `email` | Optional `fromName`, `fromEmail`, `replyTo`. `fromName` controls the display name recipients see. It's set here, not on the SMTP server. `replyTo` is the address replies go to when an email doesn't pass its own. Without either, replies to Zite's sender go nowhere |
| `googleAnalytics` | `measurementId`, such as `"G-XXXXXXX"`. One property tracks one site, so each app names its own |
| `googleCalendar` | `calendarId`. Defaults to `"primary"` |
| `openai` | `model`, `imageModel` |
| `notion` | `databaseIds`: an array of UUIDs |

### Fields that stay with the connection

On the workspace's `integrations` entry:

| Type | Fields |
| - | - |
| `email` | `type`, `provider`: `"gmail"`, `"outlookEmail"`, `"smtp"` or `"zite_email"` |
| `fillout` | `type`, `formIds`: an array of form IDs |
| Every other type | `type` and `connectionId` only |

### Add, use, and remove integrations

* **Add one** with the `setup_integration` build tool. Connecting needs a person to approve the OAuth
  sign-in. The workspace entry is saved when they connect, and you write only the app's
  `integrationSettings` for it.
* **Use one** in server code with `await integrations.get('<name>')` from `zitejs/integrations`, where the
  name is the entry's key in this file. A name never changes when a second account of the type is
  connected, while the `process.env.ZITE_*` names do. See
  [Secrets and integrations](https://developers.zite.com/framework/secrets-and-integrations.md).
* **Remove one** by deleting its entry from this config. That's the whole change: `zite.lock` is generated,
  regenerates itself, and can't be edited.

> [!WARNING]
>
> The workspace database is not an integration. Never add a `databases` entry to `integrations`: the
> database is always connected automatically, and an entry there overrides that with a broken one, so the
> app loads but no data ever comes back. Import `zitejs/db` and use it. There's nothing to configure.

## envVars

A read-only mirror of the Secrets tab's metadata: keys only, never values. Keys are
`ZITE_UPPER_SNAKE_CASE`.

```json theme={"system"}
{
  "envVars": {
    "ZITE_API_KEY": { "description": "API key for the external service" },
    "ZITE_WEBHOOK_SECRET": { "description": "Webhook signing secret" }
  }
}
```

Don't edit this field. To add or update a secret, add it in **Settings → Secrets**: the platform writes
both the encrypted secret and this mirror. Hand-editing `envVars`, or restoring wiped keys with
`write_file` or `edit_file`, doesn't create a real secret and is overwritten on the next sync. See
[Secrets](https://developers.zite.com/framework/secrets-and-integrations.md#secrets).

## seoSettings

The app's browser tab title, favicon, and link preview (the card shown when someone shares the app's URL in
Slack, iMessage, or social media):

```json theme={"system"}
{
  "seoSettings": {
    "title": "Acme Helpdesk",
    "description": "Submit and track support requests for Acme customers.",
    "thumbnailUrl": "https://example.com/acme-preview.png",
    "faviconUrl": "https://example.com/acme-favicon.png"
  }
}
```

| Field | Sets | When unset |
| - | - | - |
| `title` | The browser tab title and the link preview title | The app's name followed by `\| Zite` |
| `description` | The meta description and the link preview description | A generic Zite description |
| `thumbnailUrl` | The link preview image | A screenshot of the app for an external app. An internal app gets no preview image |
| `faviconUrl` | The browser tab icon, and the Apple touch icon unless PWA settings set one | The linked brand kit's icon, then the Zite favicon |

These are the app-wide defaults. A route's `head()` can set its own title, description and share tags for
its page. The favicon comes only from here.

## pwaSettings

Settings for installing the app on a home screen. Managed by the **Settings → Mobile** screen, which is
where an installable app is turned on. See [Make your app installable](https://developers.zite.com/recipes/pwa.md).

## brandKitId and brandKitThemeHash

Set by Zite when a brand kit is applied.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.