Skip to content

Typed JSON‑LD for Astro, Svelte, and TypeScript

Ship valid JSON‑LD without maintaining schema objects by hand.

Compose Schema.org entities with TypeScript, validate them with Zod, resolve every reference, and serialize them safely for HTML.

51
Schema.org builders
Zod
runtime validation
Safe
HTML serialization
CLI
compiled HTML audit

Manual JSON‑LD or typed builders

Validate entity structures with Zod, connect them in a @graph, and serialize without HTML script breakouts.

manual-schema.tsWithout unschema-graph
const article = {
  "@type": "Article",
  "headline": "Structured Data",
  "publisher": { "@id": "#publsher" }
};

const jsonLd = JSON.stringify(article);
Unchecked handwritten object prone to silent typos and script breakouts.
  • No schema checks: typos and missing required properties go unnoticed
  • Duplicated @id strings risk silent reference mismatches across entities
  • Raw serialization can prematurely terminate <script> tags on unescaped HTML characters

Choose your environment

Pick the package that fits your stack. The same builders and graph engine run in every environment.

Astro

@unschema-graph/astro
  • Native <Schema /> component and Content Collections helpers
  • Dev Toolbar inspection for generated JSON‑LD
pnpm add @unschema-graph/astroStart with Astro

Svelte

@unschema-graph/svelte
  • Native Svelte 5 runes and <svelte:head> output
  • All 51 builders with no client JavaScript overhead
pnpm add @unschema-graph/svelteStart with Svelte

TypeScript

@unschema-graph/core
  • Universal builders for Node.js, Vite, Next.js, and custom SSR
  • Pure graph, serialization, and audit APIs
pnpm add @unschema-graph/coreStart with TypeScript

From typed entities to audited HTML

A concrete structured data pipeline matching the library implementation.

  1. 01

    Build

    Article({ headline, ... })

    TypeScript builders backed by Zod with Schema.org property autocompletion.

  2. 02

    Link

    publisher: '#publisher'

    Entity linking into a unified @graph using local #id references.

  3. 03

    Validate

    Article.safeParse(data)

    Strict runtime verification returning { success, data } or precise Zod issues.

  4. 04

    Audit

    unschema-graph audit dist

    Static scan of JSON‑LD script tags and graph structure in your compiled HTML files.

Start with the outcome you need

Focused Schema.org recipes for common web patterns.

unschema-graph

Build your first typed graph

Choose your environment, compose an entity, and publish validated JSON‑LD without maintaining raw schema objects.