This project is a powerful RSS feed aggregator and summarizer built with NestJS and TypeScript. It fetches articles from various RSS feeds, cleans and extracts their content, and can optionally summarize them using the Google Gemini API. The project also manages publishers and feeds, storing articles in a PostgreSQL database.
| Badge | Description |
|---|---|
| Written in TypeScript | |
| Built with NestJS framework | |
| Uses PostgreSQL for data storage | |
| Integrates with Google Gemini for summarization | |
| Docker support (not explicitly configured but feasible) |
@mozilla/readability and jsdom.class-validator and class-transformer for robust API input validation.@mozilla/readability, jsdom, cheerio@google/generative-ai (Google Gemini)@nestjs/schedulerss-parser, cross-fetch, sanitize-html, slugifyClone the repository:
git clone https://github.com/phambaophuc/RSSCrawler.git
cd RSSCrawler
Install dependencies:
npm install
# or
yarn install
Configure environment variables:
Create a .env file in the root directory and populate it with your database and Gemini API credentials. Example:
# Database Configuration
DB_URL=postgres://<user>:<password>@<host>:<port>/<database>
DB_SYNCHRONIZE=false # Set to true for development if needed, but false is recommended for production
# Gemini API Configuration
GEMINI_KEY=<your_gemini_api_key>
GEMINI_MODEL=<gemini_model_name> # e.g., gemini-pro
# Application Port
APP_PORT=3000
Run database migrations (if applicable) or ensure schema is set up.
Note: The synchronize: false in typeorm.config.ts indicates that schema management should be handled via migrations. If you are in a development environment and prefer automatic schema synchronization, you can set DB_SYNCHRONIZE=true in your .env file, or manually manage migrations.
Build the project:
npm run build
Start the application:
npm run start
For development with watch mode:
npm run start:dev
This project serves as a backend API for aggregating, processing, and summarizing RSS feed content. It can be used to build applications that:
Create a Publisher:
POST /api/publishers
Body: {
"name": "Example Publisher",
"homepage": "https://example.com"
}
Create a Feed for a Publisher:
POST /api/feeds
Body: {
"name": "Example Feed",
"url": "https://example.com/rss"
}
(Note: The publisher ID is implicitly handled by the backend, likely through association in the service layer or by requiring a publisher association during feed creation if the API were more complex.)
Manually Trigger RSS Scraping (for a single feed URL):
This endpoint is primarily for testing or manual initiation.
POST /api/rss
Body: {
"feedUrl": "https://example.com/rss"
}
Extract Content from a URL:
GET /api/extract?url=https://example.com/article-url
Summarize Content from a URL:
This endpoint uses the Gemini API to provide a summary.
GET /api/extract/summarize?url=https://example.com/article-url
Get Paginated Articles (with optional filters):
GET /api/articles?page=1&limit=10&feedId=<feed_id>&publisherId=<publisher_id>
Get all Feeds:
GET /api/feeds
Get all Publishers:
GET /api/publishers
Get Publisher by Slug:
GET /api/publishers/<publisher_slug>
This project uses Swagger for API documentation. After starting the application, you can access the interactive API documentation at:
http://localhost:<APP_PORT>/swagger(Replace <APP_PORT> with your configured application port, default is 3000)
This project is licensed under the MIT License. See the LICENSE file for details.
This project is maintained by phambaophuc.