# README
Go Blog Aggregator
A robust RSS feed aggregator built with Go, featuring user authentication, feed management, and post collection.
Table of Contents
- Description
- Features
- Technology Stack
- Getting Started
- Usage
- API Endpoints
- Testing
- Deployment
- Contributing
- License
Description
Bloggo is a powerful RSS feed aggregator service that allows users to manage and follow their favorite blog feeds. It automatically collects and stores posts from followed feeds, providing a centralized platform for users to stay updated with their preferred content.
Features
- โ User registration and authentication
- ๐ Feed management (create, read, follow, unfollow)
- ๐ Automatic post collection from feeds
- ๐ RESTful API for interacting with feeds and posts
- ๐ก๏ธ Rate limiting and CORS support
- ๐ฆ Database migrations using Goose
- ๐ณ Dockerized application for easy deployment
- ๐ Continuous Integration/Continuous Deployment (CI/CD) pipeline
Technology Stack
- ๐ฅ๏ธ Go 1.22
- ๐ PostgreSQL 14
- ๐ณ Docker & Docker Compose
- ๐ง GitHub Actions (CI/CD)
- ๐ Various Go packages including:
github.com/lib/pq
for PostgreSQL drivergithub.com/joho/godotenv
for environment variable managementgithub.com/julienschmidt/httprouter
for HTTP routinggolang.org/x/crypto
for password hashinggithub.com/go-mail/mail/v2
for email sending
Getting Started
Prerequisites
- Go 1.22 or later
- Docker and Docker Compose
- PostgreSQL 14 (if running locally without Docker)
Installation
-
Clone the repository:
git clone https://github.com/yourusername/go-blog-aggregator.git cd go-blog-aggregator
-
Create a .env file in the root directory and add the necessary environment variables:
PORT=8080 DB=postgres://postgres:postgres@db:5432/blogaggregator?sslmode=disable MAILER_HOST=your_smtp_host MAILER_PORT=your_smtp_port MAILER_USERNAME=your_smtp_username MAILER_PASSWORD=your_smtp_password MAILER_SENDER=your_sender_email LIMITER_ENABLED=true LIMITER_RPS=2 LIMITER_BURST=4 TRUSTED_ORIGINS=
-
Build and start the application using Make:
make run
Usage
Once the application is running, you can interact with it through its RESTful API. Use tools like cURL or Postman to send requests to http://localhost:8080.
API Endpoints
Method | Endpoint | Description |
---|---|---|
GET | /v1/healthz | Healthcheck |
POST | /v1/users | Create a new user |
PUT | /v1/users/activated | Activate a user account |
POST | /v1/tokens/authentication | Create an authentication token |
POST | /v1/feeds | Create a new feed |
GET | /v1/feeds | Get all feeds |
POST | /v1/feed_follows | Follow a feed |
DELETE | /v1/feed_follows/:feedfollowID | Unfollow a feed |
GET | /v1/feed_follows | Get all followed feeds |
GET | /v1/posts | Get posts from followed feeds |
GET | /debug/vars | Expvar handler (for debugging) |
Testing
```bash
make test
```
Deployment
The project includes a CI/CD pipeline using GitHub Actions. On push to the main branch, it will:
- ๐งช Run tests
- ๐จ Check code formatting
- ๐๏ธ Build and push a Docker image to GitHub Container Registry
- ๐ Deploy to a Digital Ocean droplet
For manual deployment, you can use:
bash make docker-build make docker-run
Contributing
Contributions are welcome! Please feel free to submit a Pull Request. License This project is open source and available under the MIT License.