Auto SEO (JSON-LD)
Headless, framework-agnostic core to generate Schema.org structured data as JSON-LD (Article, Product, Organization, BreadcrumbList, WebSite, LocalBusiness, FAQPage). No classes, no framework dependency. Scope (MVP, v1) is JSON-LD only — OpenGraph and social card previews are out of scope.
Variables de entorno
Este componente no requiere variables de entorno.
Instalación manual
Descarga el tarball y copia cada archivo listado abajo a su ruta destino:
curl -L -o auto-seo.tar.gz https://TU_HOST/registry/auto-seo.tar.gz
tar -xzf auto-seo.tar.gz | Origen | Destino en tu proyecto |
|---|---|
core/index.ts | src/modularcore/auto-seo/core/index.ts |
core/create-schema.ts | src/modularcore/auto-seo/core/create-schema.ts |
core/create-graph.ts | src/modularcore/auto-seo/core/create-graph.ts |
core/stringify.ts | src/modularcore/auto-seo/core/stringify.ts |
core/validate.ts | src/modularcore/auto-seo/core/validate.ts |
core/schema-types.ts | src/modularcore/auto-seo/core/schema-types.ts |
Instalación con CLI
modularcore add auto-seoDocumentación
# @modularcore/auto-seo
Headless, framework-agnostic core to generate Schema.org
structured data as JSON-LD.
Scope (MVP, v1): JSON-LD only. OpenGraph tags, keyword extraction and
social card previews are explicitly out of scope for this package and are
left for a future iteration.
## Install
Copy-code component (like Media Picker / AI Chat): copy
project via the ModularCore CLI, or import directly from this workspace
package during development.
## API
All functions are pure — no classes, no builder chaining, no framework
dependency.
###
Builds a JSON-LD object (
7 supported Schema.org types:
from Google's
editor autocomplete (types-only devDependency, no runtime cost).
###
Combines 2+ schemas into a single
###
Serializes a schema/graph to a string safe to embed inside a
- Security (hard requirement):
default, so a field value containing
close the containing
disabled.
-
values are left untouched.
###
Validates a schema (or graph) against a Zod schema for its declared
required fields (e.g.
## Design notes
- No classes, no chained builders: keeps the API trivially portable to any
framework or server-rendering context.
-
installing this package via the CLI's
extra production dependency.
-
(
Headless, framework-agnostic core to generate Schema.org
structured data as JSON-LD.
Scope (MVP, v1): JSON-LD only. OpenGraph tags, keyword extraction and
social card previews are explicitly out of scope for this package and are
left for a future iteration.
## Install
Copy-code component (like Media Picker / AI Chat): copy
core/ into yourproject via the ModularCore CLI, or import directly from this workspace
package during development.
pnpm add zod
pnpm add -D schema-dts # types only, not a runtime dependency
## API
All functions are pure — no classes, no builder chaining, no framework
dependency.
import { createSchema, createGraph, stringify, validate } from '@modularcore/auto-seo';
const article = createSchema('Article', {
headline: 'Modular components for the modern web',
datePublished: '2026-08-25',
author: { '@type': 'Person', name: 'Jane Doe' },
});
const { valid, errors } = validate(article);
// { valid: true, errors: [] }
const graph = createGraph(article, /* ...more schemas */);
const jsonLd = stringify(graph, { absolute: 'https://example.com' });
// safe to embed: <script type="application/ld+json">{jsonLd}</script>
###
createSchema(type, props)Builds a JSON-LD object (
{ '@context', '@type', ...props }) for one of the7 supported Schema.org types:
Article, Product, Organization,BreadcrumbList, WebSite, LocalBusiness, FAQPage. props is typedfrom Google's
schema-dts foreditor autocomplete (types-only devDependency, no runtime cost).
###
createGraph(...schemas)Combines 2+ schemas into a single
{ '@context', '@graph': [...] } object.###
stringify(schema, { absolute? })Serializes a schema/graph to a string safe to embed inside a
<script type="application/ld+json"> tag.- Security (hard requirement):
JSON.stringify() does not escape < bydefault, so a field value containing
</script><script>...</script> couldclose the containing
<script> tag. stringify() always replaces every< in its output with < before returning it — this cannot bedisabled.
-
absolute: optional base URL. When set, any string field starting with/ is resolved to an absolute URL against that base; already-absolutevalues are left untouched.
###
validate(jsonld)Validates a schema (or graph) against a Zod schema for its declared
@type, returning { valid: boolean, errors: string[] }. Detects missingrequired fields (e.g.
Article.headline, Product.offers,Organization.logo) — it is not a full Schema.org structural validator.## Design notes
- No classes, no chained builders: keeps the API trivially portable to any
framework or server-rendering context.
-
schema-dts is a devDependency only (types, no runtime code) so thatinstalling this package via the CLI's
add command never pulls in anextra production dependency.
-
zod is a regular dependency, matching the rest of the monorepo(
packages/cli, packages/ai-chat, packages/registry-client).