Skip to content

azs06/gator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gator

Gator is a command-line RSS feed aggregator built in Go. It allows users to register accounts, subscribe to RSS feeds, and browse aggregated content from multiple sources.

Features

  • User registration and authentication
  • RSS feed subscription management
  • Automatic feed aggregation with configurable intervals
  • Browse posts from followed feeds
  • Multi-user support with individual feed subscriptions

Prerequisites

  • Go 1.23 or higher
  • PostgreSQL server
  • Goose (for database migrations)

Installation

1. Clone the repository

git clone https://github.com/azs06/gator.git
cd gator

2. Set up the database

Create a PostgreSQL database:

createdb gator

Run the migrations:

goose -dir sql/schema postgres "postgresql://username:password@localhost/gator?sslmode=disable" up

3. Configure environment

Create a .env file in the project root:

DB_URL=postgresql://username:password@localhost/gator?sslmode=disable

4. Build the application

go build -o gator .

Usage

User Management

# Register a new user
./gator register <username>

# Log in as an existing user
./gator login <username>

# List all users
./gator users

# Reset (delete all users)
./gator reset

Feed Management

# Add a new RSS feed
./gator addfeed <name> <url>

# List all feeds
./gator feeds

# Follow a feed
./gator follow <feed_url>

# List feeds you're following
./gator following

# Unfollow a feed
./gator unfollow <feed_url>

Feed Aggregation

# Start continuous feed aggregation (default: 1 minute interval)
./gator aggz

# Start aggregation with custom interval
./gator aggz 30s
./gator aggz 5m

Browse Content

# Browse posts from followed feeds (default: 2 posts)
./gator browse

# Browse with custom limit
./gator browse 10

Project Structure

gator/
├── main.go                 # Application entry point and command handlers
├── go.mod                  # Go module definition
├── sqlc.yaml               # sqlc configuration
├── internal/
│   ├── config/
│   │   └── config.go       # Configuration management
│   └── database/
│       ├── models.go       # Generated database models
│       ├── db.go           # Database query interface
│       ├── users.sql.go    # User queries
│       ├── feeds.sql.go    # Feed queries
│       ├── feeds_follow.sql.go
│       └── posts.sql.go    # Post queries
└── sql/
    ├── schema/             # Database migrations
    └── queries/            # SQL query definitions

Configuration

Gator stores user configuration in ~/.gatorconfig.json:

{
  "db_url": "postgresql://username:password@localhost/gator",
  "current_user_name": "your_username"
}

Database Schema

  • users - User accounts
  • feeds - RSS feed definitions
  • feed_follows - User feed subscriptions
  • posts - Aggregated feed content

Tech Stack

  • Go
  • PostgreSQL
  • sqlc - Type-safe SQL code generation
  • lib/pq - PostgreSQL driver
  • google/uuid - UUID generation

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages