A high-performance RSS feed aggregator built with Go that fetches and aggregates RSS feeds in real-time using concurrent processing.
- Real-time RSS feed aggregation using goroutines for concurrent processing
- RESTful API with authentication
- PostgreSQL database integration
- Database migrations using Goose
- Type-safe SQL queries using SQLC
- CORS support
- API versioning
- User management and feed subscription system
- Language: Go
- Database: PostgreSQL
- Router: Chi
- SQL Tools:
- SQLC for type-safe query generation
- Goose for database migrations
- Authentication: Custom middleware with API key support
Create a .env
file in the root directory with your port and database connection string:
PORT=6000
DBCONN_STR=postgres://username:password@host:PORT/dbname?sslmode=disable
PORT
: The port number on which the server will listen (default: 6000)DBCONN_STR
: PostgreSQL connection string in the format:postgres://[username]:[password]@[host]:[port]/[database]?sslmode=disable
All endpoints marked with 🔒 require authentication via API key.
POST /v1/user
- Create a new userGET /v1/user
🔒 - Get user details by API keyGET /v1/users
- Get all users
POST /v1/feed
🔒 - Create a new feedGET /v1/feeds
- Get all available feedsGET /v1/posts
🔒 - Get posts for authenticated user
POST /v1/feedfollow
🔒 - Follow a feedGET /v1/feedfollows
🔒 - Get all followed feedsDELETE /v1/feedfollow/{feedID}
🔒 - Unfollow a feed
GET /v1/healthz
- Health check endpointGET /v1/error
- Error handling test endpoint
AllowedOrigins: []string{"http://*", https://*"}
AllowedMethods: []string{"GET", "POST", "PUT", "DELETE", "UPDATE", "OPTIONS"}
AllowCredentials: false
AllowedHeaders: []string{"*"}
ExposedHeaders: []string{"Link"}
MaxAge: 300
- Clone the repository
git clone https://github.com/TinySkillet/RSSAggregator
cd rss-aggregator
- Install dependencies
go mod download
-
Set up PostgreSQL database
-
Create and configure the
.env
file as described in the Environment Configuration section -
Run database migrations
goose up
- Start the server
go run main.go
This project uses Goose for database migrations. To run or rollback migrations, make sure you are in the sql/schema directory first.
To run migrations:
goose postgres <DB_URL> up
To rollback:
goose postgres <DB_URL> down
SQLC is used to generate type-safe Go code from SQL queries. To regenerate queries:
sqlc generate
The aggregator uses Go's goroutines to fetch multiple RSS feeds simultaneously, providing efficient performance and scalability. The concurrent processing ensures that feed updates are fetched and processed in real-time without blocking operations.
The application is designed to scale horizontally, with concurrent feed processing and efficient database operations. The use of goroutines allows for parallel processing of multiple feeds, while connection pooling in PostgreSQL ensures efficient database operations.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request