L-chaCon/gator

Boot.dev course

★ 0Forks 0GoGitHub ↗Compare

README

Gator - RSS Feed Aggregator

Note

This project was built as part of the Boot.dev curriculum. All credit for the project design, requirements, and learning objectives goes to Boot.dev. This is a guided project from their Go course focusing on building real-world applications with Go and PostgreSQL.

A powerful CLI tool for aggregating and managing RSS feeds. Gator allows you to collect RSS feeds from across the internet, store posts in a PostgreSQL database, and browse aggregated content directly from your terminal.

Features

  • Feed Management: Add and manage RSS feeds from any website
  • User System: Register users and manage authentication
  • Follow System: Follow and unfollow feeds added by other users
  • Post Aggregation: Automatically fetch and store new posts from followed feeds
  • Browse Posts: View summaries of aggregated posts with links to full articles
  • PostgreSQL Storage: Persistent storage of feeds, users, and posts

Prerequisites

Before installing Gator, make sure you have the following installed:

Installation

Install the Gator CLI using Go's built-in package manager:

go install github.com/L-chaCon/gator@latest

After installation, the gator binary will be available in your $GOPATH/bin directory (make sure this is in your PATH).

Setup

1. Database Setup

First, create a PostgreSQL database for Gator:

CREATE DATABASE gator;

2. Configuration File

Create a configuration file at ~/.gatorconfig.json (or in your preferred config location):

{
  "db_url": "postgres://username:password@localhost/gator?sslmode=disable",
  "current_user_name": ""
}

Replace username and password with your PostgreSQL credentials.

3. Database Migration

Run any necessary database migrations to set up the required tables (this step may vary depending on your migration setup).

Usage

User Management

Register a new user:

gator register <username>

Login as an existing user:

gator login <username>

View all registered users:

gator users

Reset the database:

gator reset

Feed Management

Add a new RSS feed:

gator addfeed <feed_name> <feed_url>

View all available feeds:

gator feeds

Follow a feed:

gator follow <feed_url>

View feeds you're following:

gator following

Unfollow a feed:

gator unfollow <feed_url>

Content Browsing

Browse aggregated posts:

gator browse [limit]

View summaries of posts from feeds you follow, with optional limit on number of posts displayed.

Start feed aggregation service:

gator agg <time_between_requests>

Starts a background service that periodically fetches new posts from all feeds.

Example Workflow

  1. Register and login:

    gator register john_doe
    gator login john_doe
  2. Add some feeds:

    gator addfeed "Go Blog" https://blog.golang.org/feed.atom
    gator addfeed "Hacker News" https://hnrss.org/frontpage
  3. Follow the feeds:

    gator follow https://blog.golang.org/feed.atom
    gator follow https://hnrss.org/frontpage
  4. Start aggregation:

    gator agg 60s
  5. Browse posts:

    gator browse 10

Development

Running from Source

For development, you can run the application directly:

git clone https://github.com/L-chaCon/gator.git
cd gator
go run . <command> [args...]

Building

To build a production binary:

go build -o gator .

The resulting binary can be run without the Go toolchain installed.

Architecture

Gator is built with:

  • Go: Core application logic and CLI interface
  • PostgreSQL: Data persistence for users, feeds, and posts
  • SQLC: Type-safe SQL query generation
  • Goose: Database migrations
  • RSS Parsing: Automatic fetching and parsing of RSS/Atom feeds

Support

If you encounter any issues or have questions, please open an issue on the GitHub repository.

Contributors

L-chaConoctavio-tails

Issues