Generate types with Typegen

Typegen reads the FileMaker layouts listed in an app's adk.config.json and generates TypeScript types, runtime schemas, and Data API clients. This keeps your application data layer synchronized with FileMaker fields and portals.

Configure layouts

Each Web Viewer app includes an adk.config.json file. The layouts array specifies which FileMaker layouts Typegen inspects:

Copy
{
  "config": {
    "type": "fmdapi",
    "path": "./src/config/schemas/filemaker",
    "layouts": [
      { "layoutName": "Contacts", "schemaName": "Contacts" },
      { "layoutName": "Orders", "schemaName": "Orders" }
    ]
  }
}

layoutName is the exact FileMaker layout name. schemaName is the TypeScript name used for generated schemas, types, and clients. See adk.config.json for configuration details.

Warning  Data layouts are app dependencies: FileMaker Pro does not indicate when an external configuration references a layout. Renaming or deleting a listed layout breaks the generated client at runtime.

Run Typegen

Run Typegen from the Web Viewer app directory:

Copy
pnpm typegen

Typegen queries layout metadata from FileMaker Pro and writes generated files under the configured path.

Note  Requires Agent Access: Typegen queries layout metadata through Agent Access in FileMaker Pro 26.1.2 or later. The file must be open with Agent Access enabled and ADK components installed. See System requirements.

Options

Flag Description
--config <path> Reads a configuration file at a custom path instead of adk.config.json.
--reset-overrides Re-creates every layout override file, replacing manual changes.

Generated files

For each layout, Typegen creates a schema, an override file, and an optional client under path:

Copy
src/config/schemas/filemaker/
├── Contacts.ts
├── generated/
│   └── Contacts.ts
└── client/
    ├── Contacts.ts
    └── index.ts
File Rewritten on each run Contents
generated/<Schema>.ts Yes Zod schemas, inferred TypeScript types, and value list and portal definitions.
<Schema>.ts No Preserved override file re-exporting generated types. Add custom validation and transformations here.
client/<Schema>.ts Yes A DataApi client configured with the layout, schema, and WebViewerAdapter.
client/index.ts Yes Named exports for generated layout clients.

With the default clientSuffix of "Layout", a schema named Contacts is exported as ContactsLayout.

Set generateClient to false in configuration to omit client files while keeping schemas and overrides.

Generated portals and value lists

Typegen discovers portals from layout metadata, generating schemas and types for each portal plus composite Z<Schema>Portals and T<Schema>Portals maps attached as portalData.

The layout's valueLists setting determines whether fields accept any string or validate against defined value list items. Typegen exports discovered values even when valueLists is set to "ignore". See Validation and transformation.

Regenerate after FileMaker changes

Run Typegen whenever fields, value lists, or portals change on a configured layout. Generated files update automatically, while root override files are preserved. Resolve any resulting type errors in application code rather than editing files in generated/ or client/.

Use the client

Import the generated client from the client directory:

Copy
import { ContactsLayout } from "@/config/schemas/filemaker/client";

const response = await ContactsLayout.find({
  query: { Status: "Active" },
  limit: 25,
});

See Use a typed data client for query methods and data-loading patterns.