Skip to content

API Reference

Rivu provides an intuitive and accessible public API for its users to generate a RSS 2.0-compliant feed in Node.js. The detailed descriptions of the public API is provided below for reference.

The Feed class provides programmatic interface for generating RSS 2.0 compliant XML feeds. It implements the RSS interface and accepts channel-level metadata like title, link, description, etc and serializes it along with optional item entries into a string of valid RSS 2.0 XML feed.

new Feed(channelElements: ChannelElements)

Section titled “new Feed(channelElements: ChannelElements)”

Creates a new RSS feed instance with the provided channel metadata.

NameTypeDescription
channelElementsChannelElementsObject representing the RSS <channel> metadata. Must include title, link and description. Optional fields maybe provided to include additional channel-level information.
import { Feed } from "rivu";
const feed = new Feed({
title: "Lorem Ipsum",
description: "Lorem ipsum",
link: "https://example.com/rss.xml",
});

Generates an RSS 2.0 compliant XML string representation of the feed. The method performs the following tasks:

  1. Creates the <rss> and <channel> root nodes.
  2. Appends required channel fields (title, link, description).
  3. Includes optional metadata only when provided.
  4. Serializes all <item> elements when defined.
  5. Provides pretty-printed XML output.
TypeDescription
stringFully rendered RSS 2.0 XML string
import { Feed } from "rivu";
const feed = new Feed({
title: "Lorem ipsum",
description: "Lorem ipsum",
link: "https://example.com/rss.xml",
});
console.log(feed.generate());

The code above will produce the following output:

<rss version="2.0">
<channel>
<title><![CDATA[Lorem Ipsum]]></title>
<link><![CDATA[https://jarmos.dev/feed.xml]]></link>
<description><![CDATA[Lorem ipsum]]></description>
<item>
<title><![CDATA[lorem ipsum]]></title>
<description><![CDATA[lorem ipsum]]></description>
</item>
</channel>
</rss>

The RSS interface represents the structure and data required for constructing an RSS feed in accordance to the official RSS 2.0 specifications. It stores the <channel> level metadata which also includes information such as the ‘title’, ‘link’, ‘description’ and other optional publishing metadata.

The generate() method returns a stringified representation of the RSS 2.0 XML output. The output can be used in any Node.js runtime environments to produce a valid RSS 2.0 feed.

The ChannelElements interface represents the metadata that defines an RSS <channel> which includes the required core information such as the title, link, description and other optional publishing metadata.

(REQUIRED) Represents the name of the feed which is often the site name or the publication title.

(REQUIRED) Represents the canonical URL corresponding to the feed’s website, e.g. "https://jarmos.dev/rss.xml"

(REQUIRED) A short explanation of the feed’s purpose and its description.

The language of the content specified as an IETF language tag, e.g. "en-US".

The copyright notice for the content, e.g. "Somraj Saha © 2025".

The email address and name of the person responsible for the editorial content, e.g. "Sagar Kapoor <sagar.kapoor@weburz.com>"

The email address and name of the technical contact responsible for the feed’s maintenance, e.g. "Somraj Saha <somraj.saha@weburz.com>".

The publication date of the feed’s content, e.g. "2025-12-07T12:29:17.127Z".

The last time the feed content was modified, e.g. "2025-12-07T12:29:17.127Z".

The category or classification of the feed, e.g. "Technology", "Finance", "World News", "Podcasts" and so on.

The software used to generate the feed, e.g. "Node.js v25".

docs?: "https://www.rssboard.org/rss-specification" | null

Section titled “docs?: "https://www.rssboard.org/rss-specification" | null”

The URL to the official RSS specification which is usually left unchanged and is set to the default string - "https://www.rssboard.org/rss-specification".

The number of minutes a feed can be cached before refreshing it, e.g. 1440 (a single day).

A URL object representing the remote location of an image asset for the channel, e.g. new URL('https://example.com/assets/rss-channel.jpeg') or https://example.com/assets/rss-channel.jpeg.

Represents an embedded text input interface inside RSS-capable clients which can be used to perform search indexing of the feed. Read the “<textInput> sub-element of <channel>” section for more information. See Textinput for implementation details.

The hours of the day during which aggregators should refrain from fetching the feed. It can be useful for managing predictable server load windows or maintenance periods, e.g. 22, 10, 8 and so on. See Hour for more implementation details.

The days of the week during which aggregators should avoid retrieving the feed. It helps publishers avoid unnecessary fetches during predictable no-update days, e.g. "Sunday", "Wednesday" and so on. See Day for more implementation details.

The collection of published entries associated with the channel wherein each entry is represented by an <item> element describing an article, update or any other meaningful piece of content. See Item for more implementation details.

Represents the <textInput> element in a RSS feed which is used to define a form interface that allows users to submit feedback or search queries from RSS readers which support that feature.

The label of the submit button, e.g. "Search" or "Submit" and so on.

A description of the text input’s purpose, e.g. "Search the RSS feed for the queried keywords" and so on.

The name attribute for the input element, e.g. "search".

The URL where the text input form is submitted, e.g. "https://example.com/rss/search".

Represents the hours of the day (0-23) based on a 24-hour clock used in the RSS <skipHours> metadata. If a feed specifies the <skipHours> element, then aggregators may choose not to fetch the feed during the specified hours which is primarily helpful for rate-limiting or predictable downtime periods.

Represents the days of the week used in the RSS <skipDays> metadata element. If a feed specifies the <skipDays> element, then aggregators may choose not to fetch the feed on the listed days of the week.

Represents a single <item> element in a RSS feed wherein each item typically corresponds to a piece of published content such as a blog post, podcast episode or update. All the fields are optional but the logic is implemented such that at least a title of description is provided.

The title of the item which is usually the name of the article or a post, e.g. "Example RSS Feed".

The canonical URL where the full content of the item can be accessed, e.g. "https://jarmos.dev/rss.xml".

A short summary or description of the item, e.g. "This is a sample description of an article in an RSS feed.".

The author of the item, typically formatted as a Name <Email> but the format may vary, e.g. "Somraj Saha <somraj.saha@weburz.com>".

A category or tag describing the topic of the item, e.g. "Python Programming", "UI/UX" and so on.

A link to the comments page or discussion thread related to the item, e.g. "https://jarmos.dev/vim-vs-neovim/comments".

The publication date for the item, e.g. "2025-12-07T12:29:17.127Z".