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.
Before installing and using Gator, ensure you have the following installed:
- Go (version 1.19 or later) - Download Go
- PostgreSQL (version 12 or later) - Download PostgreSQL
Install Gator using Go's built-in package manager:
go install github.com/Cheemx/gator@latestCreate 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.
Ensure your PostgreSQL database is running and accessible with the connection string provided in your config file. Gator will create the necessary tables automatically.
If you're developing or contributing to Gator, you can run commands directly using:
go run . <command_name> [args]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.
gator usersLists all registered usernames from the users table.
gator resetResets all four database tables: users, feeds, posts, and feed_follows. Use with caution - this will delete all data.
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/"gator feedsDisplays all available feeds with their name, URL, and creator information.
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/"gator followingLists the names of all feeds that the current user is following.
gator unfollow <url>Unfollows a feed for the currently logged-in user.
Example:
gator unfollow "https://techcrunch.com/feed/"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 30mgator 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 postsHere's a typical workflow for using Gator:
-
Register as a new user:
gator register johndoe
-
Add some RSS feeds:
gator addfeed "Hacker News" "https://news.ycombinator.com/rss" gator addfeed "Reddit Programming" "https://www.reddit.com/r/programming/.rss"
-
Start aggregating feeds:
gator agg 1h
-
Browse your aggregated posts:
gator browse 20
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)
If you've read it till this end, consider giving a star!
Built with ❤️ using Go, easier feed updation by Cheems!
