Categorygithub.com/DomenicoDicosimo/go-blog-aggregator
module
0.0.0-20240925175237-fa30743861a2
Repository: https://github.com/domenicodicosimo/go-blog-aggregator.git
Documentation: pkg.go.dev

# README

Go Blog Aggregator

A robust RSS feed aggregator built with Go, featuring user authentication, feed management, and post collection.

Table of Contents

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 driver
    • github.com/joho/godotenv for environment variable management
    • github.com/julienschmidt/httprouter for HTTP routing
    • golang.org/x/crypto for password hashing
    • github.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

  1. Clone the repository:

    git clone https://github.com/yourusername/go-blog-aggregator.git
    cd go-blog-aggregator
    
    
  2. 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=
    
  3. 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

MethodEndpointDescription
GET/v1/healthzHealthcheck
POST/v1/usersCreate a new user
PUT/v1/users/activatedActivate a user account
POST/v1/tokens/authenticationCreate an authentication token
POST/v1/feedsCreate a new feed
GET/v1/feedsGet all feeds
POST/v1/feed_followsFollow a feed
DELETE/v1/feed_follows/:feedfollowIDUnfollow a feed
GET/v1/feed_followsGet all followed feeds
GET/v1/postsGet posts from followed feeds
GET/debug/varsExpvar 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.

# Packages

No description provided by the author