A command-line RSS feed aggregator built with Go and PostgreSQL.
Before running this program, you'll need to have the following installed on your system:
You need PostgreSQL installed and running on your machine.
Installation:
- macOS:
brew install postgresql - Ubuntu/Debian:
sudo apt-get install postgresql - Windows: Download from postgresql.org
After installation, make sure PostgreSQL is running:
# Check if PostgreSQL is running
psql --versionCreate a database for the application:
createdb gatorYou need Go 1.25 or higher installed.
Installation:
- Download from go.dev/dl
- Or use a package manager:
- macOS:
brew install go - Ubuntu/Debian:
sudo apt-get install golang
- macOS:
Verify installation:
go versionInstall the gator CLI tool using go install:
go install github.com/joaquinbian/blog-aggregator-go/cmd/gator@latestThis will install the gator binary to your $GOPATH/bin directory (typically ~/go/bin).
This will install the gator binary to your $GOPATH/bin directory (typically ~/go/bin).
Make sure your $GOPATH/bin is in your system's PATH:
export PATH=$PATH:$(go env GOPATH)/binBefore running the program, you need to set up a configuration file.
Create a file named .gatorconfig.json in your home directory:
cd ~
touch .gatorconfig.jsonAdd the following content to .gatorconfig.json:
{
"db_url": "postgres://username:password@localhost:5432/gator?sslmode=disable",
"current_user_name": ""
}Replace username and password with your PostgreSQL credentials.
Once installed and configured, you can use the gator CLI with the following commands:
Register a new user:
gator register <your_name>Login:
gator login <your_name>List all users:
gator usersReset database (delete all users):
gator resetAdd a new RSS feed:
gator addfeed <feed_name> <feed_url>Example:
gator addfeed "Golang Blog" https://go.dev/blog/feed.atomList all feeds:
gator feedsFollow a feed:
gator follow <feed_url>See your followed feeds:
gator followingUnfollow a feed:
gator unfollow <feed_url>Start the aggregator (fetches feeds at regular intervals):
gator agg <time_interval>Examples:
gator agg 30s # Fetch every 30 seconds
gator agg 5m # Fetch every 5 minutes
gator agg 1h # Fetch every hourThis command will continuously fetch RSS feeds in the background based on the time interval you specify. It automatically stores all posts from your followed feeds into the database.
View posts from your followed feeds:
gator browse <limit>Examples:
gator browse # View 2 most recent posts (default)
gator browse 10 # View 10 most recent posts
gator browse 50 # View 50 most recent postsThis command displays posts from all the feeds you're following, including the post title, description, feed name, and link.
# 1. Register yourself
gator register alice
# 2. Add some RSS feeds
gator addfeed "Tech Crunch" https://techcrunch.com/feed/
gator addfeed "Hacker News" https://news.ycombinator.com/rss
# 3. Follow a feed
gator follow https://techcrunch.com/feed/
# 4. Check which feeds you're following
gator following
# 5. Start aggregating feeds (fetches every minute)
# Run this in a separate terminal window
gator agg 1m
# 6. Browse the collected posts
gator browse 5The application uses four main tables:
- users: Stores user information
- feeds: Stores RSS feed information
- feed_follows: Tracks which users follow which feeds
- posts: Stores individual posts/articles from RSS feeds
Contributions are welcome! Feel free to open issues or submit pull requests.