Getting Started

A lightweight, zero-dependency TypeScript library for generating RSS 2.0, Atom 1.0, and JSON Feed 1.1 syndication feeds. Built for projects that prioritize clarity, maintainability, and privacy-conscious tooling. Whether you're building a blog, newsletter, or publishing platform, this library helps you publish well-formed feeds without bloat.

Why Use Syndication

  • - Supports RSS 2.0, Atom 1.0, and JSON Feed 1.1
  • - Fully typed with TypeScript
  • - Framework agnostic (Node.js, browser, static)
  • - Small footprint with zero runtime dependencies
  • - Works with import, require, and browser <script> tags

Examples

Lightweight. Tree-shakable. Zero dependencies.

MetricValue
Bundle size5.5 kB
Minified + Gzipped1.9 kB
Download time~2 ms (Slow 3G)

Installation

Install via your preferred package manager:

$ npm install @undercroft/syndication

Or load it from one of the available CDNs:

CDNLinkCopy
jsDelivrhttps://cdn.jsdelivr.net/npm/@undercroft/timespan/dist/index.umd.js
unpkghttps://unpkg.com/@undercroft/timespan/dist/index.umd.js
Skypackhttps://cdn.skypack.dev/@undercroft/timespan
esm.shhttps://esm.sh/@undercroft/timespan
jspmhttps://jspm.dev/@undercroft/timespan
esm.runhttps://esm.run/@undercroft/timespan

Usage in NodeJS

import { RssFeed } from '@undercroft/syndication';

const metadata = {
  title: 'Undercroft Labs',
  description: 'Tiny tools. Big ideas.',
  url: 'https://undercroftlabs.com',
  id: 'https://undercroftlabs.com/feed',
  author: 'Michael Goodwin',
};

const items = [
  {
    id: 'welcome',
    title: 'Welcome to Undercroft',
    url: 'https://undercroftlabs.com/posts/welcome',
    description: 'The first post.',
    published: '2025-04-20T00:00:00Z',
  },
];

const feed = new RssFeed(metadata, items);
const xml = feed.render();
console.log(xml);

Usage in Browser

<script src="https://cdn.jsdelivr.net/npm/@undercroft/syndication/dist/index.umd.js"></script>
<script>
  const feed = new Syndication.JsonFeed({
    title: 'Undercroft Labs',
    id: 'https://undercroftlabs.com/feed',
    url: 'https://undercroftlabs.com',
    description: 'Tiny tools. Big ideas.',
    author: 'Michael Goodwin',
  }, [{
    id: 'welcome',
    title: 'Welcome to Undercroft',
    url: 'https://undercroftlabs.com/posts/welcome',
    description: 'The first post.',
    published: '2025-04-20T00:00:00Z',
  }]);

  console.log(feed.render());
</script>

Creating Feeds

You can create and render feeds.

const feed = new RssFeed(metadata, items)

feed.render()

You can also dynamically add items:

feed.addItem({
  id: 'post-2',
  title: 'Another Post',
  url: 'https://site.com/posts/2',
  published: '2025-04-21T00:00:00Z',
});
const feed = new RssFeed(metadata, items)

feed.addItem({
  id: 'post-2',
  title: 'Another Post',
  url: 'https://site.com/posts/2',
  published: '2025-04-21T00:00:00Z',
});

feed.render()

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests on the GitHub repository.

License

Timespan is open source under the MIT License.