Skip to content

Cheemx/gator

Repository files navigation

Gator: RSS Feed Aggregator CLI

A RSS feed aggregator CLI tool implemented in Go with PostgreSQL backend. Gator allows you to manage RSS feeds, follow your favourite sources, and browse aggregated posts from the command line.

gator AI generated img

Prerequisites

Before installing and using Gator, ensure you have the following installed:

Installation

Install Gator using Go's built-in package manager:

go install github.com/Cheemx/gator@latest

Configuration

Create a configuration file named .gatorconfig.json in your home directory with the following structure:

{
  "db_url": "postgres://<postgres_user_name>:<postgre_user_passowrd>@localhost:5432/gator?sslmode=disable",
  "current_user_name": ""
}

Note: The current_user_name field will be automatically filled when you run the register command.

Database Setup

Ensure your PostgreSQL database is running and accessible with the connection string provided in your config file. Gator will create the necessary tables automatically.

Development

If you're developing or contributing to Gator, you can run commands directly using:

go run . <command_name> [args]

Commands Reference

User Management

Register/Login

gator register <username>
gator login <username>

Registers a new user or logs in an existing user. Sets the current_user_name in the configuration file.

Users

gator users

Lists all registered usernames from the users table.

Database Management

Reset

gator reset

Resets all four database tables: users, feeds, posts, and feed_follows. Use with caution - this will delete all data.

Feed Management

Add Feed

gator addfeed <name> <url>

Adds a new RSS feed to the feeds table and automatically follows it for the current user.

Example:

gator addfeed "TechCrunch" "https://techcrunch.com/feed/"

List Feeds

gator feeds

Displays all available feeds with their name, URL, and creator information.

Follow Feed

gator follow <url>

Follows an existing feed by adding it to the feed_follows table for the current user.

Example:

gator follow "https://techcrunch.com/feed/"

Following

gator following

Lists the names of all feeds that the current user is following.

Unfollow Feed

gator unfollow <url>

Unfollows a feed for the currently logged-in user.

Example:

gator unfollow "https://techcrunch.com/feed/"

Content Aggregation

Aggregate Feeds

gator agg <duration>

Starts periodic aggregation of feeds at the specified interval. Accepts duration formats like:

  • 1s (1 second)
  • 1m (1 minute)
  • 1h (1 hour)
  • 2h45m (2 hours 45 minutes)

Example:

gator agg 30m

Browse Posts

gator browse [limit]

Displays posts from your followed feeds stored in the database. Posts are sorted in reverse chronological order (most recent first). Optional limit parameter controls the number of posts displayed.

Examples:

gator browse        # Browse all posts
gator browse 10     # Browse latest 10 posts

Workflow Example

Here's a typical workflow for using Gator:

  1. Register as a new user:

    gator register johndoe
  2. Add some RSS feeds:

    gator addfeed "Hacker News" "https://news.ycombinator.com/rss"
    gator addfeed "Reddit Programming" "https://www.reddit.com/r/programming/.rss"
  3. Start aggregating feeds:

    gator agg 1h
  4. Browse your aggregated posts:

    gator browse 20

Database Schema

Gator uses four main tables:

  • users: Stores registered user information
  • feeds: Contains RSS feed URLs, names, and metadata
  • posts: Stores individual posts/articles from feeds
  • feed_follows: Manages user-feed relationships (which users follow which feeds)

Conclusion

If you've read it till this end, consider giving a star!

Built with ❤️ using Go, easier feed updation by Cheems!

About

RSS Feed Aggregator CLI built with Go and PostgreSQL

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages