Gator is a command-line RSS feed aggregator written in Go. It allows users to manage, follow, and browse RSS feeds from the terminal.
- User management (register, login)
- Add and manage RSS feeds
- Follow/unfollow feeds
- Browse posts from followed feeds
- Automatic feed aggregation with concurrent fetching
- PostgreSQL database for persistent storage
- Go 1.16 or higher
- PostgreSQL database
-
Clone the repository:
git clone https://github.com/D3rise/gator.git cd gator -
Install dependencies:
go mod download
-
Set up the database:
- Create a PostgreSQL database
- Run the migration scripts in the
sql/schemadirectory (the project uses goose for migrations)
-
Build the application:
go build -o gator
-
Create a configuration file at
~/.gatorconfig.jsonwith the following content:{ "db_url": "postgresql://username:password@localhost:5432/gator?sslmode=disable" }Alternatively, you can specify a custom config path using the
GATOR_CONFIG_PATHenvironment variable.
# Show help
./gator help
# Register a new user
./gator register <username>
# Login as a user
./gator login <username>
# List all users
./gator users
# Add a new RSS feed
./gator addfeed <feed_name> <feed_url>
# List all available feeds
./gator feeds
# Follow a feed
./gator follow <feed_id>
# List feeds you're following
./gator following
# Unfollow a feed
./gator unfollow <feed_id>
# Browse posts from followed feeds
./gator browse <page_number>
# Aggregate feeds (fetch new posts)
./gator aggThe agg command starts the feed aggregation process, which:
- Fetches RSS feeds in the background
- Updates the database with new posts
- Displays feed content as it's fetched
- Continues running until interrupted with Ctrl+C
Example:
./gator aggThe application uses the following database tables:
-
user - Stores user information
- id (UUID, primary key)
- name (VARCHAR, unique)
- created_at, updated_at (TIMESTAMP)
-
feed - Stores feed information
- id (UUID, primary key)
- user_id (UUID, foreign key to user)
- name (VARCHAR, unique)
- url (VARCHAR)
- created_at, updated_at (TIMESTAMP)
- fetched_at (TIMESTAMP, nullable)
-
feed_follow - Tracks which users follow which feeds
- id (UUID, primary key)
- user_id (UUID, foreign key to user)
- feed_id (UUID, foreign key to feed)
- created_at, updated_at (TIMESTAMP)
- Unique constraint on (user_id, feed_id)
-
post - Stores posts from feeds
- id (UUID, primary key)
- feed_id (UUID, foreign key to feed)
- title (TEXT)
- url (TEXT, unique)
- description (TEXT)
- published_at (TIMESTAMP)
- created_at, updated_at (TIMESTAMP)
main.go- Application entry pointinternal/- Internal packagescli/- CLI implementationcommands/- Command implementationsconfig/- Configuration handlingdatabase/- Database access and modelsmiddleware/- Command middleware (e.g., authentication)rss/- RSS feed fetching and parsingstate/- Application state management
sql/- SQL filesqueries/- SQL queries (used by sqlc)schema/- Database schema migrations