The framework-agnostic content engine for Fastify, Next.js, and React. Seamlessly merge Markdown or Headless WordPress into your existing app with zero routing changes, automated sitemaps, and sub-millisecond caching.
Your existing database models, platform routes, and controllers remain 100% in control. The plugin simply snaps content and sitemaps right into your current architecture.
Two-tier caching (L1 in-memory LRU + persistent Redis) ensures your readers and crawlers get responses in under 0.2ms, with zero load on your CMS or database.
Out-of-the-box OpenGraph cards, Twitter preview tags, Schema.org Article JSON-LD, and zero-bandwidth HTTP 304 ETags that eliminate redundant cloud egress bills.
// QUICKSTART_INTEGRATION
In Fastify, register the plugin once. It decorates fastify.universalContent so your existing /sitemap.xml route can pull pre-cached XML chunks with only 2 lines of code:
import { mergeSitemapUrlsets } from '@crispice/universal-content/seo';
// Your existing sitemap route remains the boss:
fastify.get('/sitemap.xml', async (request, reply) => {
// 1. Get your existing products/items as usual
const products = await fastify.db.product.findMany();
const baseXml = buildSitemapXml(products, 'murageh.co.ke');
// 2. Fetch pre-cached blog XML chunk from plugin (< 0.05ms)
const blogChunk = await fastify.universalContent.getSitemapXmlChunk({
baseUrl: 'https://murageh.co.ke',
});
// 3. High-speed, non-destructive splice right before </urlset>
const finalXml = mergeSitemapUrlsets(baseXml, blogChunk);
return reply.type('application/xml').send(finalXml);
});
In Next.js App Router, use React Server Components and on-demand ISR revalidation tags:
import { getNextDocBySlug } from '@crispice/universal-content/next';
import { notFound } from 'next/navigation';
export default async function BlogPostPage({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params;
// Fetches from local Markdown or Headless WordPress
const post = await getNextDocBySlug({ contentDir: './content' }, 'blog', slug);
if (!post) notFound();
return (
<article className="prose max-w-3xl mx-auto py-12">
<h1>{post.title}</h1>
<div dangerouslySetInnerHTML={{ __html: post.contentHtml }} />
</article>
);
}
In Vite applications, import virtual modules directly in memory with instant sub-10ms HMR:
// Dynamic virtual content generated in RAM by Vite compiler
import posts from 'virtual:content/blog';
export function BlogList() {
return (
<div className="grid gap-4">
{posts.map((post) => (
<a key={post.slug} href={"/blog/" + post.slug} className="card">
<h2>{post.title}</h2>
<p>{post.excerpt}</p>
</a>
))}
</div>
);
}
// INTERACTIVE_LIVE_SANDBOX
This sandbox demonstrates a real Fastify v5 server running live. Watch how host application platform pages and database catalog items merge seamlessly with universal markdown blog posts:
Googlebot crawls this endpoint. Watch response times drop from 25ms down to 0.2ms:
Click "Fetch (Crawler Hit)" to inspect the merged sitemap XML...
Select any database product or blog post to inspect its WhatsApp preview card and Google structured data:
{ "loading": true }