feeds
A Go library for generating RSS, Atom, and JSON feeds from a single, format-agnostic Feed model.
Repository Health
Technical Analysis
gorilla/feeds is a lightweight Go library for building syndication feeds. It defines a single generic Feed and Item model that can be rendered into RSS 2.0, Atom 1.0, or JSON Feed 1.1 output without requiring separate data structures for each format. Applications populate one Feed struct with titles, links, authors, and items, then call ToRss, ToAtom, or ToJSON to get a spec-compliant string, or use the Write* variants to stream output directly to an io.Writer.
Beyond the generic model, feeds exposes the underlying AtomFeed, RssFeed, and JSONFeed types so callers needing spec-specific fields — a custom generator tag, a JSON Feed hub, or an RSS text input element — can build the object and then customize it before marshaling. A small uuid helper backs automatic id generation for Atom entries that lack an explicit id or link-derived tag.
What You Get
- Format-agnostic Feed/Item model - one struct populates Title, Link, Author, Description, and Items, then renders to RSS, Atom, or JSON without duplicating data.
- Three renderers built in - ToRss, ToAtom, and ToJSON (plus WriteRss/WriteAtom/WriteJSON for streaming to an io.Writer) cover RSS 2.0, Atom 1.0, and JSON Feed 1.1.
- Escape hatch to spec-specific types - AtomFeed, RssFeed, and JSONFeed structs are exported so you can set fields the generic model doesn’t cover before marshaling.
- Automatic Atom id generation - entries without an explicit Id get one derived from the item’s link and date, or a v4 UUID as a fallback.
Common Use Cases
- Blog and CMS feed endpoints - render /feed.xml, /feed.atom, and /feed.json from the same list of posts.
- Podcast and changelog feeds - publish RSS/Atom feeds for release notes or episodes with custom enclosure and GUID handling.
- Aggregator and API output - services that ingest many sources and need to re-publish a normalized feed in multiple syndication formats.
Under The Hood
Architecture gorilla/feeds centers on a single generic Feed/Item model (feed.go) that format-specific adapters wrap: Atom{*Feed}, Rss{*Feed}, and JSON{*Feed} each embed the base struct and implement a FeedXml()/JSONFeed() method that transforms it into that spec’s own struct tree (AtomFeed, RssFeed, JSONFeed), which is then marshaled by the shared ToXML/WriteXML helpers or, for JSON, its own ToJSON/WriteJSON. A small XmlFeed interface is the only abstraction point; there’s no registry or plugin mechanism, so a fourth output format would mean adding another file that repeats the same wrap-and-transform shape as atom.go/rss.go/json.go. uuid.go is a self-contained UUID v4 generator used only to backfill Atom entry ids when no link/date is available to derive one.
Tech Stack Runtime code is pure standard library — encoding/xml, encoding/json, net/url, time, sort, and crypto/rand — with the only go.mod dependency (github.com/kr/pretty, plus its transitive kr/text/go-internal) used exclusively in tests for struct diffing. There’s no build step beyond go build/go test; the Makefile wraps golangci-lint, gosec, and govulncheck, and GitHub Actions runs the test suite across Go 1.20/1.21 on Linux, macOS, and Windows alongside separate lint and security-scan workflows, uploading coverage to Codecov.
Code Quality feed_test.go and consume_test.go (roughly 1,000 lines combined) round-trip a populated Feed through ToRss/ToAtom/ToJSON and back through XML/JSON unmarshaling to assert field-level fidelity, plus a dedicated UUID-format test. Error handling is idiomatic Go — explicit error returns from the marshal paths, with a single panic only on an unrecoverable crypto/rand failure in NewUUID. Naming follows standard Go convention throughout, and CI enforces golangci-lint, gosec, and govulncheck on every push and PR.
API Design Most minimal Go feed libraries stop at RSS and Atom or make callers populate a format-specific struct directly; feeds keeps one generic model as the primary interface while still exposing the full AtomFeed/RssFeed/JSONFeed types as an escape hatch for spec-specific fields the generic model doesn’t cover. Its JSON Feed 1.1 support is unusually complete for the ecosystem, including the authors array with deprecated single-author back-compat and attachment duration_in_seconds marshaling via custom MarshalJSON/UnmarshalJSON.
Used by 4 apps in this directory
Gitea
Devops · Developer Tools · Project Management
Self-hosted DevOps in a single Go binary — Git hosting, GitHub Actions-compatible CI/CD, and 30+ package registries without any SaaS dependency.
listmonk
Marketing · Blogging
High-performance, self-hosted newsletter and mailing list manager packaged as a single binary with built-in analytics, transactional messaging, and multi-channel delivery.
memos
Note Taking
Open-source, self-hosted note-taking built for quick capture — Markdown-native, lightweight, and fully yours.
Vikunja
Project Management
Self-hosted task management with natural-language quick-add, multiple views, and a fully documented REST API — your tasks, your infrastructure, zero lock-in.