Open with AI
Structure SDK
@atmyapp/structure provides schema authoring and tooling. For examples, read Define your content schema. For every builder option, use the field reference.
Authoring exports
Section titled “Authoring exports”defineSchema, defineCollection, defineDocument, defineFile, defineImage, defineSystemConfig, defineSubmission, defineEvent, and defineBasicEvent construct canonical definitions. s contains the field builders.
A schema contains definitions and optional description, localization, events, args, mdx, and submissions. defineSchema supplies canonical version 1. args is application-specific metadata; it does not create an SDK environment-variable loader.
Compile and validate
Section titled “Compile and validate”import { compileSchema, validateContent, validateSchemaDocument,} from "@atmyapp/structure";import schema from "../atmyapp.schema";
const schemaResult = validateSchemaDocument(schema);if (!schemaResult.valid) { throw new Error(JSON.stringify(schemaResult.issues));}const compiled = compileSchema(schema);const result = validateContent(compiled, "home", { headline: "Hello" });if (!result.valid) { console.error(result.issues); // Each issue has a path and message.}Compilation builds definition/path lookups, flattened field information, references, assets, system fields, and the legacy platform structure. It does not upload your content. The CLI performs compilation as part of migration.
Local validation checks supported schema and value constraints. It is not a substitute for platform checks against existing entries, reference targets, or unique indexes. Read the field reference’s validation limits before using a hint as a hard constraint.
Advanced tooling
Section titled “Advanced tooling”The package also exports inference types, introspection helpers, migration planning, framework presets, and legacy conversion utilities. Use these when building schema tooling; ordinary websites generally need the authoring helpers and Core’s typed reads. Migration plans describe compatibility work rather than automatically completing every content transformation.
