RSS Feeds
Generate RSS feeds from your registry.
Insightcn can generate RSS 2.0 compliant feeds from your registry. This allows users to subscribe to updates and stay informed about new components.
How It Works
- You call
generateRegistryRssFeedwith your registry configuration - SDK fetches your registry data
- SDK generates XML feed with component information
- Feed includes pub dates from GitHub commits (if configured)
Basic Usage
import { generateRegistryRssFeed } from "@insightcn/sdk";
const rss = await generateRegistryRssFeed({
baseUrl: "https://your-registry.com",
rss: {
title: "My Shadcn Registry",
description: "Custom components for shadcn/ui",
},
});
console.log(rss); // XML stringConfiguration Options
| Option | Type | Description |
|---|---|---|
baseUrl | string | Your registry base URL |
rss.title | string | Feed title |
rss.description | string | Feed description |
rss.endpoint | string | RSS endpoint path (default: /rss) |
rss.limit | number | Maximum number of items in feed |
github.owner | string | GitHub repository owner |
github.repo | string | GitHub repository name |
github.token | string | GitHub API token for commit dates |
GitHub Integration
For accurate pub dates, configure GitHub integration:
const rss = await generateRegistryRssFeed({
baseUrl: "https://your-registry.com",
rss: {
title: "My Shadcn Registry",
description: "Custom components for shadcn/ui",
},
github: {
owner: "your-org",
repo: "your-registry",
token: process.env.GITHUB_TOKEN,
},
});Next.js Example
Here's a complete Next.js API route for serving RSS feeds:
import { NextResponse } from "next/server";
import { generateRegistryRssFeed } from "@insightcn/sdk";
export async function GET() {
const rssFeed = await generateRegistryRssFeed({
baseUrl: "https://your-registry.com",
rss: {
title: "My Shadcn Registry",
description: "Custom components for shadcn/ui",
endpoint: "/api/rss",
},
github: {
owner: "your-org",
repo: "your-registry",
token: process.env.GITHUB_TOKEN,
},
});
if (!rssFeed) {
return new NextResponse("No items found", { status: 404 });
}
return new NextResponse(rssFeed, {
headers: {
"Content-Type": "application/rss+xml",
"Cache-Control": "public, max-age=3600",
},
});
}