This project is an RSS News API that fetches RSS feeds from various sources, stores them in a Supabase database, and sends notifications to a Telegram channel.
- Hono
- npm
- Cloudflare Workers
- Supabase account
- Telegram Bot
-
Clone the repository:
git clone https://github.com/yourusername/rss-news-api.git cd rss-news-api
-
Install the dependencies:
npm install
- Configure the
wrangler.toml
file for Cloudflare Workers:name = "rss-news-api" type = "javascript" [env] SUPABASE_URL = "https://your-supabase-url.supabase.co" SUPABASE_KEY = "your-supabase-key" TELEGRAM_BOT_URL = "https://api.telegram.org/bot<your-bot-token>/sendMessage" CHAT_ID = "-100232xxxxxx" [[triggers.crons]] schedule = "*/1 * * * *" # Runs every minute
-
Start the development server:
wrangler dev
-
Deploy to Cloudflare Workers:
wrangler publish
The API provides the following endpoints:
GET /
: Returns a welcome message.GET /news
: Fetches news from the database.GET /health
: Checks the health of the Supabase connection.GET /check-feeds
: Manually triggers the RSS feed check and notification process.
src/index.ts
: Main entry point for the Cloudflare Worker.src/services/rssService.ts
: Contains the logic for fetching RSS feeds and sending notifications.src/db/supabase.ts
: Contains the logic for interacting with the Supabase database.wrangler.toml
: Configuration file for Cloudflare Workers.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Hono - A small, simple, and fast web framework for Cloudflare Workers.
- Supabase - An open-source Firebase alternative.
- Telegram Bot API - The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram.