Skip to content

Feed core — overview

@ghostwritr/feed is the keyless, framework-free core that the Next, Astro, and React Router adapters are built on. It fetches your published articles from the content feed and gives you typed Article objects. No API key — the siteId is the read capability. See keyless reads.

Reach for the core directly when there isn’t an adapter for your stack, or when you want the fetchers with no framework caching wrapped around them.

  • Any JS/TS runtime with fetch + Web Crypto — Node 20+, Cloudflare Workers, Deno, Bun, and the browser.
  • Zero dependencies. Nothing to audit, nothing to bundle but the core itself.
  • The adapters re-export it. @ghostwritr/next and @ghostwritr/astro re-export its types and wrap its fetchers with framework caching, so the shapes you learn here are the shapes you get everywhere.
  1. Install the core.

    npm install @ghostwritr/feed
  2. Fetch your articles with your site ID. That’s the only key.

    feed.ts
    import { fetchArticles, fetchArticle } from "@ghostwritr/feed";
    // Every published article, newest first.
    const articles = await fetchArticles({ siteId: process.env.GHOSTWRITR_SITE_ID! });
    // One article by slug, or null.
    const post = await fetchArticle({
    siteId: process.env.GHOSTWRITR_SITE_ID!,
    slug: "my-first-post",
    });
  3. Render the Markdown. In React, hand article.markdown to <ArticleContent>; anywhere else, use your own Markdown renderer.

  • The fetchersfetchArticles, fetchArticle, toArticle, and the opts.fetch seam. See Fetchers.
  • Instant updates — verify the signed feed.updated webhook. See Webhook helpers and instant updates.
  • Errors — the GhostwritrError code union and the fail-closed contract. See Error handling.
  • Full surface — every export, typed. See API reference.