ProofKit

Quick Start

Here's a minimal example to get you started with @proofkit/fmodata:

AI Agent Integration

Install the ProofKit FMOData skill for better AI agent integration while developing with this package:

npx skills add proofgeist/proofkit --skill "proofkit-fmodata"
pnpm dlx skills add proofgeist/proofkit --skill "proofkit-fmodata"
yarn dlx skills add proofgeist/proofkit --skill "proofkit-fmodata"
bunx skills add proofgeist/proofkit --skill "proofkit-fmodata"

Install the package

npm install @proofkit/fmodata@beta
pnpm add @proofkit/fmodata@beta
yarn add @proofkit/fmodata@beta
bun add @proofkit/fmodata@beta

Create a server connection

Create a connection to your FileMaker server using either username/password or API key authentication (requires OttoFMS 4.11+):

connection.ts
import { FMServerConnection } from "@proofkit/fmodata";

export const connection = new FMServerConnection({
  serverUrl: process.env.FM_SERVER,
  auth: {
    username: process.env.FM_USERNAME,
    password: process.env.FM_PASSWORD,
  },
});

Define your table schema

Run this command in your project to launch a browser-based UI for configuring your schema definitions. You will need environment variables set for your FileMaker server and database.

npx @proofkit/typegen@beta ui
pnpm dlx @proofkit/typegen@beta ui
yarn dlx @proofkit/typegen@beta ui
bunx @proofkit/typegen@beta ui

Learn more about the @proofkit/typegen tool.

Use field builders to create type-safe table schemas:

schema.ts
import {
  fmTableOccurrence,
  textField,
  numberField,
} from "@proofkit/fmodata";
import { z } from "zod/v4";

const users = fmTableOccurrence("users", {
  id: textField().primaryKey(),
  username: textField().notNull(),
  email: textField().notNull(),
  active: numberField()
    .readValidator(z.coerce.boolean())
    .writeValidator(z.boolean().transform((v) => (v ? 1 : 0))),
});

Create a database instance and query data

Connect to your database and start querying:

query.ts
import { eq } from "@proofkit/fmodata";
import { connection } from "./connection";
import { users } from "./schema";

const db = connection.database(process.env.FM_DATABASE);

// Query all users
const { data, error } = await db.from(users).list().execute();

if (error) {
  console.error(error);
  return;
}

if (data) {
  console.log(data); // Array of users, properly typed
}

// Filter active users
const activeUsers = await db
  .from(users)
  .list()
  .where(eq(users.active, true))
  .execute();

On this page