@fayz-ai/plugin-blog
v0.12.10
Published
[experimental] Fayz SDK — blog / articles plugin (website surface)
Readme
@fayz-ai/plugin-blog
A headless blog surface — post list + article page — you drop into any Fayz website.
Status: beta — pre-1.0. Ships a public website surface (blog list + post detail) running on bundled mock/seed data, with a Supabase-backed provider seam included and evolving. No admin UI in M1 (the host owns website navigation). APIs may change before 1.0.
Marketing sites need a blog, and every one ends up rebuilt from scratch. plugin-blog is the reusable version: a headless, SEO-ready blog you compose into a Fayz website as a bundle of { manifest, Provider }. It ships the public read surface — a /blog list and a /blog/:slug article page — plus the data seam behind them, so the host site owns layout and navigation while the plugin owns posts.
It follows the "website plugin" (Model A) pattern: instead of a defineSaas plugin, createBlogPlugin returns a manifest (with public routes), an app-root Provider, and the resolved data provider. Drop the routes into your router, wrap your app in the Provider, and you have a blog.
What's inside
- Public routes —
GET /blog(list) and/blog/:slug(detail), bothguard: "public", mounted under a configurablebasePath. Their components load lazily, so a host that never mounts them (a storefront on the SDK's router adapter, a TanStack Start host) never downloads them — or the react-router they are written against - Components —
BlogList,PostDetail,PostCard,AuthorAvatar, on their own door:import { BlogList } from '@fayz-ai/plugin-blog/components'(they are bound to react-router-dom; the main entry is router-free) - Hooks —
useBlogPosts,usePost, anduseBlogContext - Data seam —
createSafeDataProviderpickscreateSupabaseBlogProviderwhen configured, elsecreateMockBlogProviderseeded from yourseedposts - SEO — per-page
useSeowithog:site_name, plus organization + breadcrumb JSON-LD - Byline + i18n defaults — configurable
defaultAuthor,siteName, and pt-BR list/back labels
Install
npm install @fayz-ai/plugin-blogPeer deps: react, react-dom, react-router-dom. Runtime dep: @fayz-ai/core.
Usage
import { createBlogPlugin } from '@fayz-ai/plugin-blog'
const blog = createBlogPlugin({
basePath: '/blog',
siteName: 'Acme',
defaultAuthor: { name: 'Equipe Acme' },
seed: { posts: [/* ... */] },
})
// blog.manifest.routes -> spread into your website router
// wrap your app tree in <blog.Provider> so the routes resolve their dataPart of the Fayz SDK
A website surface plugin. Pairs with @fayz-ai/plugin-sites and the storefront/website scaffolds; complements @fayz-ai/plugin-payments in composing bespoke marketing sites from curated plugins.
