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@betapnpm add @proofkit/fmodata@betayarn add @proofkit/fmodata@betabun add @proofkit/fmodata@betaCreate a server connection
Create a connection to your FileMaker server using either username/password or API key authentication (requires OttoFMS 4.11+):
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 uipnpm dlx @proofkit/typegen@beta uiyarn dlx @proofkit/typegen@beta uibunx @proofkit/typegen@beta uiLearn more about the @proofkit/typegen tool.
Use field builders to create type-safe table schemas:
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:
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();