Gator
A self-hosted RSS aggregator made through Boot.dev.
Installation
Install through Go:
go install github.com/Andrew5057/gator@latest
Setup
Gator runs off a PostgreSQL database, with migrations defined in the sql/schema
directory. You'll need an installation; instructions for your installation are
available on the official website. You
can use the built-in psql CLI to set up your database. For a quick setup:
$ psql postgres
postgres=# CREATE DATABASE gator;
postgres=# \c gator;
postgres=# exit
Setting up authentication is recommended but not required.
You can use goose to manage
migrations.
goose <connection-string> up -dir <path/to/sql/schema>
If the database was set up as above:
goose postgres "postgres://localhost:5432/gator" up -dir <path/to/sql/schema>
Once the database is set up, you'll need a .gatorconfig.json file in your
home directory. Set it up to contain the following:
{
"db_url": <replace-with-connection-string>
}
If your PostgreSQL database is local, add ?sslmode=disable to the end.
Usage
The gator CLI supports the following commands:
register <username>: adds a new user and logs in.
login <username>: sets the current user to an existing one.
users: lists the users and marks the currently logged-in one.
reset: clears (but does not drop) the database.
addfeed <name> <URL>: registers and follows to a new RSS feed.
follow <URL>: follows a feed already registered by another user.
unfollow <URL>: unfollows a currently-followed feed.
following <URL>: lists feeds followed by the current user.
browse [n=2]: lists information for the n most recently-created posts
from feeds followed by the current user.
agg <delay>: fetches data from the least-recently-updated feed forever.
delay must be a Go duration string
and represents how long to wait between requests. Intended to be run as a
background process; ensures browse remains up-to-date.