SSR / foldkit-ssr

The application in these examples

The App used across the sections above defines a post page (Model, Message, AppRoute), Data (Remote.make), PostActions/Menu/Like Surfaces (PostActionsAt, PostPageAt), and LoadPreferences:

ts
const AppRoute = defineRouteUnion({ Home: {}, Post: { id: Schema.String }, NotFound: {} })

const Model = Schema.Struct({
  route: AppRoute,
  post: Schema.Struct({
    id: Schema.String,
    title: Schema.String,
    body: Schema.String,
    excerpt: Schema.String,
    publishedAt: Schema.String,
    liked: Schema.Boolean,
  }),
  draft: Schema.String,
  menuOpen: Schema.Boolean,
  remote: Remote.Model,
})

const Modifiers = Schema.Struct({
  shiftKey: Schema.Boolean,
  ctrlKey: Schema.Boolean,
  altKey: Schema.Boolean,
  metaKey: Schema.Boolean,
})

const Message = defineMessageUnion({
  ...Remote.messages,
  Liked: { id: Schema.String },
  ChangedDraft: { value: Schema.String },
  Renamed: { id: Schema.String, title: Schema.String },
  Pressed: { key: Schema.String, modifiers: Modifiers },
})

Next