Insightcn

Introduction

Introduction to Insightcn.

Insightcn is an analytics SDK for shadcn registries. It provides event tracking, RSS feed generation, type detection, and IP anonymization so you can track component usage and view analytics across all your registries.

Features

  • Event Tracking — Track installations, views, and downloads with automatic validation
  • RSS Feeds — Generate RSS 2.0 compliant feeds from your registry
  • Type Detection — Automatically detect component types from file paths
  • IP Anonymization — Built-in privacy protection for user data
  • Framework Support — Works with React, Next.js, Vue, Nuxt, Svelte, and SvelteKit

How It Works

  1. Registry Owner signs up at insightcn.dev and creates a registry
  2. Registry Owner installs the SDK: npm install insightcn
  3. Registry Owner integrates the SDK into their registry app
  4. End User visits the registry and installs components via CLI
  5. SDK automatically tracks installation events and sends them to the backend
  6. Registry Owner logs into insightcn.dev dashboard to view analytics per item

Quick Example

import { captureRegistryEvent, generateRegistryRssFeed } from "@insightcn/sdk";

// Track an installation event
const request = new Request("https://your-registry.com/r/ui/button.json", {
  method: "GET",
  headers: { "user-agent": "node-fetch" },
});

await captureRegistryEvent(request, "your-api-key", "installed");

// Generate RSS feed
const rss = await generateRegistryRssFeed({
  baseUrl: "https://your-registry.com",
  rss: {
    title: "My Shadcn Registry",
    description: "Custom components for shadcn/ui",
  },
});

console.log(rss);

On this page