# Service: Royalroad Chapters ## Overview `service-royalroad-chapters` is a FastAPI-based webserver that monitors Royalroad stories for new chapters and sends notifications data to `backend-api-internal`. ## Features - Fetches the latest chapters from Royalroad RSS feeds. - Updates the database when new chapters are released. - Sends push notifications for new chapters. - Prometheus metrics integrated for monitoring request counts. ## Endpoints ### GET `/royalroad` - Checks for new chapters for all active stories in the database. - Updates the `lastChapter` field in the database. - Sends notifications if a new chapter is found. - Response: ```json { "status": "checked" } ``` ## Requirements - Python 3.12+ - MySQL database - Python packages from requirements.txt ## Configuration **Environment variables:** - `LOG_LEVEL` (DEBUG, INFO, WARNING, ERROR, CRITICAL) - Database credentials: `db_host`, `db_username`, `db_password`, `db_database` - `api_key` - `backend_api_url` ## Metrics Metrics are exposed on port `9000` for Prometheus ## Running the Service - Inside the `src` folder `python main.py`