Skip to content

useradamlee/Gator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gator

About The Project

Gator is a CLI RSS/blog aggregator that stores feeds and posts in PostgreSQL.

This project was completed as part of the Boot.dev backend curriculum. While the core architecture followed a guided specification, I personally implemented the database migrations and the concurrent scraping logic.

Built With

  • TypeScript
  • Node.js
  • PostgreSQL
  • Drizzle ORM

Getting Started

To get a local copy up and running follow these steps.

Prerequisites

  • npm
    npm install npm@latest -g
  • Postgres
    brew install postgresql@16
    sudo apt update
    sudo apt install postgresql postgresql-contrib
    Confirm installation worked:
    psql --version
    (Linux only) Update postgres password:
    sudo passwd postgres

Installation

  1. Clone the repo
    git clone https://github.com/useradamlee/Gator.git
  2. Install NPM packages
    npm install
  3. Get connection string to postgres database. Format:
    protocol://username:password@host:port/database
    
    Examples:
    • macOS (no password, your username): postgres://adamlee:@localhost:5432/gator
    • Linux (password from last lesson, postgres user): postgres://postgres:postgres@localhost:5432/gator
  4. Enter the psql shell:
  • Mac: psql postgres
  • Linux: sudo -u postgres psql
  1. Create the database:
    CREATE DATABASE gator;
  2. Connect to the database:
    \c gator
  3. Set the user password (Linux only):
    ALTER USER postgres PASSWORD 'postgres';
    postgres was used as the password for simplicity
  4. You can type exit or use \q to leave the psql shell.
  5. Create a config file in your home directory ~/.gatorconfig.json Add an additional sslmode=disable query string:
    {
      "db_url": "protocol://username:password@host:port/database?sslmode=disable"
    }
    

Running Gator

Run the CLI with:

npm run start

Example commands

Register a user:

npm run start register adam

Add a feed:

npm run start addfeed "Boot.dev Blog" https://blog.boot.dev/index.xml

Follow a feed:

npm run start follow https://blog.boot.dev/index.xml

Browse posts:

npm run start browse

Full list of commands

  • login <username> - log in as an existing user
  • users - list all users
  • agg <time_between_reqs> - scrape feeds every given interval
  • following - list all the feeds the user is currently following
  • register <username> - create a new user
  • login <username> - log in as a user
  • addfeed <name> <url> - add a new feed
  • follow <url> - follow a feed
  • unfollow <url> - unfollow a feed
  • browse [limit] - browse recent posts, optionally limiting the number shown

About

CLI RSS/blog aggregator

Resources

Stars

Watchers

Forks

Contributors