A simple RSS feed aggregator that allows users to:
- Add RSS feeds to be collected.
- Follow and un-follow RSS feeds that they have added.
- Fetch the latest posts from the RSS feeds they follow.
GET /v1/ping: health check endpoint.
POST /v1/users: create a new user.- request body:
{ "name": "string" }
- request body:
GET /v1/users(requires authentication): get current user details.DELETE /v1/users(requires authentication): delete current user.GET /v1/users/posts(requires authentication): get posts from the feeds the current user follows.
POST /v1/feeds: add a new feed.- request body:
{ "name": "string", "url": "string" }
- request body:
GET /v1/feeds(requires authentication): get all feeds.DELETE /v1/feeds/{id}(requires authentication): delete a feed by ID.POST /v1/feeds/{id}/follow(requires authentication): follow a feed by ID.
GET /v1/feed-follows(requires authentication): get all followed feeds.DELETE /v1/feed-follows/{id}(requires authentication): unfollow a feed by ID.
- Go 1.22.3 or later
- PostgreSQL 16.0 or later
git clone https://github.com/tariqs26/rss-aggregator.git
cd rss-aggregatorThis project uses the following Go packages:
go get github.com/joho/godotenv@v1.5.1
go get github.com/go-chi/chi/v5@v5.0.12
go get github.com/google/uuid@v1.6.0
go get github.com/lib/pq@v1.10.9
go get github.com/rs/cors@v1.11.0-
sqlc for generating type-safe code from SQL.
go install github.com/sqlc-dev/sqlc/cmd/sqlc@latest
-
goose for database migrations.
go install github.com/pressly/goose/v3/cmd/goose@latest
Create a .env file in the root directory of your project and add the following environment variables:
PORT=8080
DATABASE_URL=postgres://username:password@localhost:5432/yourdbname?sslmode=disableReplace username, password, localhost:5432, and yourdbname with your PostgreSQL credentials and database details.
Navigate to the directory containing the migration files and run goose to apply the migrations:
cd sql/schema
goose -dir . postgres "postgres://username:password@localhost:5432/yourdbname?sslmode=disable" upGenerate the SQLC code for interacting with the database:
sqlc generateCompile the server and run it:
go build -o rss-aggregator
./rss-aggregatorThe server will start on the port specified in the .env file (default is 8080).