A RESTful API service built in Go that allows users to manage and follow RSS feeds and automatically collects new posts from those feeds.
- User authentication using API keys
- Create and manage RSS feeds
- Follow/unfollow RSS feeds
- Automatic background scraping of RSS feeds at regular intervals
- Retrieve posts from followed feeds
- Go - Main programming language
- Chi Router - HTTP routing and middleware
- PostgreSQL - Database
- sqlc - SQL query generator for Go
- Goose - Database migration tool
/internal/auth- Authentication utilities/internal/database- Generated database code (via sqlc)/sql/queries- SQL queries for code generation/sql/schema- Database schema migrations
POST /v1/users- Create a new userGET /v1/users- Get authenticated user
POST /v1/feeds- Create a new feedGET /v1/feeds- List all feeds
POST /v1/feed_follows- Follow a feedGET /v1/feed_follows- List followed feedsDELETE /v1/feed_follows/{feedFollowID}- Unfollow a feed
GET /v1/posts- Get posts from followed feeds
GET /v1/healthz- Health check endpointGET /v1/err- Error check endpoint
Create a .env file with:
PORT=8080
DB_URL=postgresql://username:password@localhost:5432/rssagg?sslmode=disable
- Create a database named
rssagg - Run migrations with goose:
goose -dir sql/schema postgres "postgresql://username:password@localhost:5432/rssagg?sslmode=disable" upgo build && ./rssaggThe API uses a simple API key authentication mechanism. When creating a user, an API key is automatically generated.
To authenticate requests, include an Authorization header with:
Authorization: ApiKey YOUR_API_KEY
- Create a user
curl -X POST http://localhost:8080/v1/users -d '{"name":"John Doe"}'- Create a feed (using the API key)
curl -X POST http://localhost:8080/v1/feeds \
-H "Authorization: ApiKey YOUR_API_KEY" \
-d '{"name":"Example Blog","url":"https://example.com/rss"}'- Follow a feed
curl -X POST http://localhost:8080/v1/feed_follows \
-H "Authorization: ApiKey YOUR_API_KEY" \
-d '{"feed_id":"FEED_UUID"}'- Get posts from followed feeds
curl http://localhost:8080/v1/posts \
-H "Authorization: ApiKey YOUR_API_KEY"The application has a background scraper process that periodically:
- Fetches feeds that need updating
- Parses the RSS XML
- Extracts post information
- Stores new posts in the database
When users request posts, they only see posts from feeds they've chosen to follow.