Skip to content

Type-safe structured data for Next.js App Router, enforced in CI.

License

Notifications You must be signed in to change notification settings

arindamdawn/schema-sentry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

91 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Schema Sentry Banner

Schema Sentry πŸ›‘οΈ

Type-safe JSON-LD structured data for Next.js App Routerβ€”built for SEO, AI discovery, and CI validation.

Getting Started β€’ Documentation β€’ Examples

Schema Sentry provides a type-safe SDK and CLI for generating, validating, and auditing JSON-LD structured data with deterministic output. Designed for predictable diffs, CI-grade enforcement, and maximum discoverability across both traditional search engines (Google, Bing) and AI-powered systems (ChatGPT, Claude, Perplexity).

Current release: v0.5.0 (new schemasentry scaffold command with pattern-based auto-detection) Next release target: v0.6.0 (VS Code extension and CLI visualization)

✨ Features

  • πŸ”’ Type-safe JSON-LD builders for 15+ schema types (Organization, Article, Product, FAQPage, HowTo, VideoObject, ImageObject, Event, Review, and more)
  • 🎯 Deterministic JSON-LD output for clean, reviewable version control diffs
  • βš›οΈ App Router <Schema /> component for seamless Next.js integration
  • 🧭 Manifest-driven schema coverage ensures every route has proper structured data
  • πŸ” CLI validation with clear, actionable errors for CI/CD pipelines
  • πŸ“Š Schema audit β€” Analyze site health, detect missing/incomplete schema
  • πŸ“₯ Automated data collection β€” collect command scans built apps to auto-generate schema data files
  • πŸ§ͺ CLI commands β€” init, validate, audit, collect, scaffold for complete workflows
  • πŸ—οΈ Schema scaffolding β€” scaffold command auto-generates schema stubs from URL patterns (/blog/* β†’ BlogPosting, /products/* β†’ Product)
  • πŸ“„ HTML Reports β€” Generate shareable reports with --format html --output <path>
  • πŸ—£οΈ PR Annotations β€” GitHub Actions annotations with --annotations github
  • πŸ“΄ Zero network calls in OSS mode (privacy-first, offline-friendly)
  • πŸ€– AI-ready output optimized for LLM consumption, citations, and AI agent recommendations

🧠 Why Structured Data Matters for Both Traditional and AI Search

The Problem

Modern content discovery happens through two channels:

  1. Traditional Search (Google, Bing) - Rich snippets, knowledge panels, improved rankings
  2. AI-Powered Discovery (ChatGPT, Claude, Perplexity, AI agents) - Contextual answers, citations, voice assistants

Teams often add JSON-LD late, inconsistently, or incorrectly. This leads to:

  • ❌ Missing rich snippets in Google search results
  • ❌ AI systems failing to understand and cite your content
  • ❌ Hard-to-debug CI failures after content changes
  • ❌ Inconsistent JSON-LD creating noisy diffs in version control

The Solution

Schema Sentry enforces structured data in CI, ensuring your content is:

  • βœ… Machine-readable for both search engines and AI systems
  • βœ… Deterministically generated for clean, reviewable diffs
  • βœ… Validated automatically before deployment
  • βœ… Complete across all routes via manifest-driven checks

AI is eating the web. ChatGPT, Claude, Perplexity, and AI agents now drive significant traffic. Structured data is how AI understands and recommends your content.

Schema Sentry = Better SEO + AI Discovery

Feature Traditional SEO AI/LLM Discovery
Rich snippets βœ… βœ… Better citations
Knowledge panels βœ… βœ… Contextual answers
Voice search βœ… βœ… Voice assistant results
AI agent recommendations ❌ βœ… Direct inclusion

By using Schema Sentry, you're not just optimizing for Googleβ€”you're making your content discoverable by the next generation of AI-powered search.

πŸ“¦ Packages

Package Version Description
@schemasentry/core npm Typed builders and validation primitives
@schemasentry/next npm App Router <Schema /> component
@schemasentry/cli npm CI validation and report output

πŸš€ Install

# pnpm
pnpm add @schemasentry/next @schemasentry/core
pnpm add -D @schemasentry/cli

# npm
npm install @schemasentry/next @schemasentry/core
npm install -D @schemasentry/cli

# yarn
yarn add @schemasentry/next @schemasentry/core
yarn add -D @schemasentry/cli

🧩 App Router Usage

import { Schema, Article, Organization } from "@schemasentry/next";

const org = Organization({
  name: "Acme Corp",
  url: "https://acme.com"
});

const article = Article({
  headline: "Launch Update",
  authorName: "Jane Doe",
  datePublished: "2026-02-09",
  url: "https://acme.com/blog/launch"
});

export default function Page() {
  return (
    <>
      <Schema data={[org, article]} />
      <main>...</main>
    </>
  );
}

πŸ—ΊοΈ Manifest and Coverage

{
  "routes": {
    "/": ["Organization", "WebSite"],
    "/blog/[slug]": ["Article"]
  }
}

πŸ§ͺ CLI

Quick start

  1. Generate starter files:
pnpm schemasentry init
  1. Optionally scan your app and add WebPage entries for discovered routes:
pnpm schemasentry init --scan
  1. Validate coverage and rules:
pnpm schemasentry validate \
  --manifest ./schema-sentry.manifest.json \
  --data ./schema-sentry.data.json
  1. Audit schema health:
pnpm schemasentry audit --data ./schema-sentry.data.json
pnpm schemasentry audit --data ./schema-sentry.data.json --manifest ./schema-sentry.manifest.json
  1. Scan for missing routes:
pnpm schemasentry audit --data ./schema-sentry.data.json --scan
  1. Generate an HTML report:
pnpm schemasentry audit \
  --data ./schema-sentry.data.json \
  --manifest ./schema-sentry.manifest.json \
  --format html \
  --output ./schema-sentry-report.html

All commands

pnpm schemasentry init

pnpm schemasentry init --scan

pnpm schemasentry audit \
  --data ./schema-sentry.data.json

pnpm schemasentry audit \
  --data ./schema-sentry.data.json \
  --manifest ./schema-sentry.manifest.json

pnpm schemasentry audit \
  --data ./schema-sentry.data.json \
  --scan

pnpm schemasentry validate \
  --manifest ./schema-sentry.manifest.json \
  --data ./schema-sentry.data.json

pnpm schemasentry validate \
  --manifest ./schema-sentry.manifest.json \
  --data ./schema-sentry.data.json \
  --format html \
  --output ./schema-sentry-validate-report.html

pnpm schemasentry audit \
  --data ./schema-sentry.data.json \
  --format html \
  --output ./schema-sentry-audit-report.html

pnpm schemasentry collect \
  --root ./out \
  --output ./schema-sentry.data.json

pnpm schemasentry collect \
  --root ./out \
  --check \
  --data ./schema-sentry.data.json

pnpm schemasentry collect \
  --root ./out \
  --routes / /blog /faq \
  --strict-routes \
  --check \
  --data ./schema-sentry.data.json

pnpm schemasentry scaffold \
  --manifest ./schema-sentry.manifest.json \
  --data ./schema-sentry.data.json

pnpm schemasentry scaffold \
  --manifest ./schema-sentry.manifest.json \
  --data ./schema-sentry.data.json \
  --write

pnpm schemasentry scaffold \
  --manifest ./schema-sentry.manifest.json \
  --data ./schema-sentry.data.json \
  --write \
  --force

The CLI emits JSON output by default and exits with code 1 on errors, making it perfect for CI/CD pipelines. Use --format html --output <path> to generate a shareable report file. Use --annotations github in GitHub Actions to emit PR annotations. Recommended field checks run as warnings by default. Disable them with --no-recommended. See docs/ci.md for complete CI workflow examples.

Optional Config

Create schema-sentry.config.json to control defaults:

{
  "recommended": false
}

CLI flags override config. Use --config ./path/to/config.json to point at a custom file.

Understanding Manifest vs Data

File Purpose How It Works
schema-sentry.manifest.json Defines expected schema types per route You create this manually - tells Schema Sentry what each page should have
schema-sentry.data.json Contains the actual schema data You create this manually - mirrors your actual schema

Why two files? The manifest ensures every route has the right schema type. The data file validates that your actual schema matches expectations.

Use schemasentry init to generate starter files. Add --scan to include all discovered routes as WebPage entries, and use schemasentry audit --scan to detect missing routes later.

βœ… Supported Schema Types (V1)

  • Organization
  • Person
  • Place
  • LocalBusiness
  • WebSite
  • WebPage
  • Article
  • BlogPosting
  • Product
  • VideoObject
  • ImageObject
  • Event
  • Review
  • FAQPage
  • HowTo
  • BreadcrumbList

πŸ§ͺ Example App

A minimal Next.js App Router example lives in examples/next-app and includes a manifest and data file. It targets Next.js 16.1.6 and React 19.1.1.

Run the end-to-end workflow demo (init -> collect -> validate):

pnpm --filter schema-sentry-example-next-app schema:e2e

βœ… Compatibility

  • Next.js App Router (Next.js 13.4+)
  • React 18+
  • Node.js 18+

πŸ›£οΈ Roadmap

See ROADMAP.md for planned milestones and future work.

🀝 Contributing

See CONTRIBUTING.md for workflow, scope guardrails, and expectations.

πŸ“„ License

MIT Β© Arindam Dawn

πŸ’¬ Support


Made with ❀️ for the Next.js community

About

Type-safe structured data for Next.js App Router, enforced in CI.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 2

  •  
  •