A command-line RSS feed aggregator built in Go. Gator allows you to manage RSS feeds, follow your favorite sources, and browse the latest posts all from your terminal.
π Quick Start: Get up and running in minutes with our interactive setup script!
- π User authentication and management
- π° Add and manage RSS feeds
- π₯ Follow/unfollow feeds from other users
- π Browse latest posts from your followed feeds
- π Automatic feed aggregation
- πΎ PostgreSQL database storage
- βοΈ Simple JSON configuration
Before installing Gator, make sure you have the following installed:
- Go 1.20+ - Download Go
- PostgreSQL - Download PostgreSQL
For the easiest setup experience, clone the repository and run the setup script:
git clone https://github.com/karprabha/gator.git
cd gator
./setup.sh
The setup script will:
- β Check if Go and PostgreSQL are installed
- β Help you create and configure the database
- β Install the goose migration tool
- β Run all database migrations automatically
- β Create your configuration file
- β Build and install the gator binary
- β Optionally set up example users and feeds
If you prefer to set up manually:
-
Install Gator:
go install github.com/karprabha/gator@latest
-
Database Setup:
CREATE DATABASE gator;
-
Install migration tool:
go install github.com/pressly/goose/v3/cmd/goose@latest
-
Run migrations:
goose -dir sql/schema postgres "postgres://username:password@localhost/gator?sslmode=disable" up
-
Create configuration file at
~/.gatorconfig.json
:{ "db_url": "postgres://username:password@localhost/gator?sslmode=disable" }
-
Register a user account:
gator register yourusername
-
Add your first RSS feed:
gator addfeed "TechCrunch" "https://techcrunch.com/feed/"
-
Browse the latest posts:
gator browse
gator register <username>
- Create a new user accountgator login <username>
- Switch to a different usergator users
- List all registered users
gator addfeed <name> <url>
- Add a new RSS feedgator feeds
- List all available feedsgator follow <feed_url>
- Follow an existing feedgator unfollow <feed_url>
- Unfollow a feedgator following
- Show feeds you're currently following
gator browse [limit]
- Browse latest posts from followed feedsgator agg <time_between_requests>
- Start feed aggregation (fetches new posts)
gator reset
- Reset the database (β οΈ Warning: This deletes all data)
# Register and login
gator register alice
gator login alice
# Add some feeds
gator addfeed "Hacker News" "https://hnrss.org/newest"
gator addfeed "Go Blog" "https://blog.golang.org/feed.atom"
gator addfeed "GitHub Blog" "https://github.blog/feed/"
# Follow feeds from other users
gator follow "https://techcrunch.com/feed/"
# Check what you're following
gator following
# Browse latest posts (default: 2 posts)
gator browse
# Browse more posts
gator browse 10
# Start aggregation (fetches new posts every 60 seconds)
gator agg 60s
The configuration file (~/.gatorconfig.json
) supports the following options:
{
"db_url": "postgres://user:password@localhost/gator?sslmode=disable",
"current_user_name": "alice"
}
db_url
- PostgreSQL connection stringcurrent_user_name
- Currently logged-in user (set automatically)
git clone https://github.com/karprabha/gator.git
cd gator
go build -o gator
The setup.sh
script provides several options for different use cases:
./setup.sh # Complete setup (default)
./setup.sh setup # Complete setup
./setup.sh db # Database setup only
./setup.sh migrate # Run migrations only
./setup.sh config # Create config file only
./setup.sh install # Install gator binary only
./setup.sh help # Show help message
To run migrations manually:
# Up migrations
goose -dir sql/schema postgres "your_db_url" up
# Down migrations
goose -dir sql/schema postgres "your_db_url" down
# Migration status
goose -dir sql/schema postgres "your_db_url" status
The application uses the following main tables:
users
- User accountsfeeds
- RSS feed definitionsfeed_follows
- User-feed relationshipsposts
- Aggregated RSS posts
gator/
βββ main.go # Application entry point
βββ internal/
β βββ commands/ # CLI command handlers
β βββ config/ # Configuration management
β βββ database/ # Database queries and models
β βββ feed/ # RSS feed parsing
β βββ middleware/ # Authentication middleware
βββ sql/
βββ queries/ # SQL query definitions
βββ schema/ # Database migrations
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
If you're having setup issues, try running the setup script which handles most common problems automatically:
git clone https://github.com/karprabha/gator.git
cd gator
./setup.sh
"Error reading config"
- Make sure
~/.gatorconfig.json
exists and has valid JSON - Check that your database URL is correct
- Try running
./setup.sh config
to recreate the config file
"Error opening database"
- Verify PostgreSQL is running
- Check your database credentials
- Ensure the database exists
- Try running
./setup.sh db
to reconfigure the database
"Unknown command"
- Check command spelling
- Run
gator
without arguments to see usage - Make sure gator is installed:
./setup.sh install
Database connection issues
- Verify your
db_url
in the config file - Test database connectivity with
psql
- Check firewall and network settings
- Try running
./setup.sh migrate
to ensure schema is up to date
Migration issues
- Make sure goose is installed:
go install github.com/pressly/goose/v3/cmd/goose@latest
- Run migrations manually:
./setup.sh migrate
- Check migration status:
goose -dir sql/schema postgres "your_db_url" status
For more help, please open an issue on the GitHub repository.