Open with AI
Schema Model
The canonical schema model lives in @atmyapp/structure and is re-exported from @atmyapp/core.
Use schemas to describe what clients can edit, what data your app can read, and what the platform should validate before publishing.
Definitions
Section titled “Definitions”AtMyApp supports two main content definition shapes:
defineCollection()for repeatable content such as posts, authors, products, or case studies.defineDocument()for singletons such as home page copy, navigation, settings, or SEO defaults.
import { defineCollection, defineDocument, defineSchema, s,} from "@atmyapp/structure";
export default defineSchema({ definitions: { posts: defineCollection({ fields: { title: s.string({ min: 3 }), slug: s.slug({ source: "title" }), cover: s.image({ optional: true }), publishedAt: s.date({ optional: true }), }, }), settings: defineDocument({ fields: { theme: s.string({ default: "light" }), supportEmail: s.string({ format: "email" }), }, }), },});Fields
Section titled “Fields”Fields describe validation, editor behavior, and generated platform payloads. Common field types include strings, dates, images, objects, and references.
Compilation
Section titled “Compilation”The CLI finds atmyapp.schema.*, validates it, compiles it with @atmyapp/structure, writes normalized canonical JSON to .ama/definitions.json, and uploads that same contract during atmyapp migrate. The platform stores it as .structure.json; legacy input is converted at the compatibility boundary. Schema changes belong to the website repository and CLI workflow.
Package roles
Section titled “Package roles”@atmyapp/structureowns schema authoring, compilation, validation, and introspection.@atmyapp/coreowns runtime client access and re-exports schema helpers.@atmyapp/cliconnects local schemas to the hosted AtMyApp platform.@atmyapp/astroprovides Astro-specific helpers.
Next steps
Section titled “Next steps”Follow schema design for a full model, field types for every option, and JavaScript setup to render content. A schema defines editable data; your website code defines its presentation.
