Gator is a simple CLI that aggregates RSS feeds into a Postgres database and lets you browse posts from the terminal.
- Go (1.20+ recommended)
- PostgreSQL (14+ recommended)
Quick checks:
go version
psql --versionDownloads:
- Go: https://go.dev/dl/
- PostgreSQL: https://www.postgresql.org/download/
Make sure PostgreSQL is running and you have a database created for the app.
Install the CLI with go install:
go install github.com/kryptonn36/Blog_aggreator@latestEnsure $GOPATH/bin is in your PATH:
export PATH="$PATH:$(go env GOPATH)/bin"Verify:
gatorGator reads config from a local JSON file that includes the database connection and the current user.
Create a file at:
~/.gatorconfig.json
Example:
{
"db_url": "postgres://postgres:postgres@localhost:5432/gator?sslmode=disable",
"current_user_name": ""
}Do not commit this file; add it to your global gitignore to keep credentials private.
Gator uses Goose for database migrations.
Install Goose:
go install github.com/pressly/goose/v3/cmd/goose@latestVerify:
goose -versionRun migrations:
make migrate-upRollback migrations:
make migrate-downRegister a user:
gator register <username>Login:
gator login <username>Add a feed:
gator addfeed <feed_url>Follow a feed:
gator follow <feed_url>Start the aggregator (fetch feeds on an interval):
gator agg 5sBrowse posts:
gator browseLimit results:
gator browse 5Clone the repo and install dependencies (Go modules are handled automatically):
git clone https://github.com/kryptonn36/Blog_aggreator.git
cd Blog_aggreatorRun the CLI directly from source:
go run . <command>Build a local binary:
go build -o gator
./gator <command>Run tests:
go test ./...