npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@magicpages/ghost-typesense-webhook

v1.11.5

Published

Webhook handler for real-time Ghost content synchronization with Typesense

Downloads

169

Readme

@magicpages/ghost-typesense-webhook

A Netlify Function that keeps your Typesense search index in sync with your Ghost content.

Quick Setup

  1. Deploy to Netlify:

Deploy to Netlify

  1. Set environment variables in Netlify:
GHOST_URL=https://your-ghost-blog.com
GHOST_CONTENT_API_KEY=your-content-api-key
TYPESENSE_HOST=your-typesense-host
TYPESENSE_API_KEY=your-admin-api-key
COLLECTION_NAME=ghost
WEBHOOK_SECRET=your-secret-key  # Create a secure random string
  1. Add webhooks in Ghost Admin:
    • Go to Settings → Integrations
    • Create/select a Custom Integration
    • Add the following four webhooks: | Name | Event | Target URL | |------|-------|------------| | Post published | Post published | https://your-site.netlify.app/.netlify/functions/handler?secret=your-secret-key | | Post updated | Post updated | https://your-site.netlify.app/.netlify/functions/handler?secret=your-secret-key | | Post deleted | Post deleted | https://your-site.netlify.app/.netlify/functions/handler?secret=your-secret-key | | Post unpublished | Post unpublished | https://your-site.netlify.app/.netlify/functions/handler?secret=your-secret-key |

Manual Setup

  1. Install the package:
npm install @magicpages/ghost-typesense-webhook
  1. Create the function:
// netlify/functions/handler.ts
import { handler } from '@magicpages/ghost-typesense-webhook';
export { handler };
  1. Configure netlify.toml:
[functions]
  directory = "netlify/functions"
  node_bundler = "esbuild"

Environment Variables

| Variable | Description | |----------|-------------| | GHOST_URL | Your Ghost blog URL | | GHOST_CONTENT_API_KEY | Content API key from Ghost | | TYPESENSE_HOST | Typesense host | | TYPESENSE_API_KEY | Typesense admin API key | | COLLECTION_NAME | Collection name (default: 'ghost') | | WEBHOOK_SECRET | Secret key for webhook security |

How It Works

The webhook handler:

  1. Validates the secret in the URL query parameter
  2. Processes post status changes (publish/unpublish/update)
  3. Updates the Typesense index accordingly
  4. Automatically generates plaintext content from HTML for better search quality
  5. Ensures content is properly formatted for optimal search results

Content Processing

When a post is published or updated, the handler:

  1. Fetches complete data: Gets the full post details from Ghost including tags and authors
  2. Transforms content:
    • Converts timestamps to numeric formats for sorting
    • Extracts tag and author information
    • Generates clean plaintext content from HTML by:
      • Removing script and style tags with their content
      • Replacing HTML tags with spaces to preserve word boundaries
      • Normalizing whitespace
      • Creating a clean, searchable text version
  3. Updates index: Adds or updates the document in Typesense with the transformed content
  4. Optimizes for search: Ensures the content is indexed in a way that enables:
    • Context-aware search result highlighting
    • Relevant excerpts showing search terms in context
    • Accurate full-text search across all content

This automatic transformation ensures that your search index stays in sync with your Ghost content while providing the best possible search experience for your users.

License

MIT © MagicPages