ProofKit

Quick Start

@proofkit/typegen

A utility for generating runtime validators and TypeScript files from your own FileMaker layouts.

Quick Start

Run this command to initialize @proofkit/typegen in your project:

pnpm dlx @proofkit/typegen@latest

Configuring Typegen

The first time you run the command, you'll be prompted to create a config file. This is where you'll specifcy the layouts that you want to generate types for.

To see all the options available, see the Configuration page.

Environment Variables

This tool will connect to your FileMaker solution using the @proofkit/fmdapi package and read the layout metadata for each layout you specify in the config file. By default it will expect the following environment variables to be set:

FM_SERVER=https://your-server.com # must start with https://
FM_DATABASE=MyFile.fmp12 # must end with .fmp12

# If using OttoFMS
OTTO_API_KEY=dk_123...abc

# otherwise (fmrest privilege must be enabled on this account)
FM_USERNAME=fmrest
FM_PASSWORD=your-password

If you need to use different env variable names (i.e. for multiple FileMaker connections), set the envNames option in the config file.

Running Typegen

Once you have a config file setup, you can run the command to generate the types:

pnpm dlx @proofkit/typegen@latest

We suggest adding a script to your package.json to run this command more easily

Example Generated Files

If your typegen config is setup with 2 layouts and the path set to schema, this is what the generated files will look like:

Customers.ts
Invoices.ts

The client folder is where you'll import from in other files of your app to use the layout-specific clients.

The generated folder is where the typegen will put the generated files. These files are auto-generated and should not be edited, since your changes would just be overwritten the next time you run an update to your schema.

The other files in the root of the schema folder are what will be used in the generated clients, and can be safely modifed to allow for customizations.