Automated Action 90c1cdef34 Setup News Aggregation Service
- Fix code linting issues
- Update README with detailed documentation
- Configure database paths for the current environment
- Create necessary directory structure

The News Aggregation Service is now ready to use with FastAPI and SQLite.
2025-05-27 18:50:11 +00:00

86 lines
2.0 KiB
Markdown

# News Aggregation Service
A FastAPI application that aggregates news from various sources using the Mediastack API.
## Features
- User authentication and authorization
- News article fetching and storage from Mediastack API
- Filtering news by keywords, sources, categories, countries, and languages
- User preferences for personalized news
- Save articles for later reading
- Background tasks for periodic news updates
## Tech Stack
- **FastAPI**: High-performance web framework
- **SQLite**: Database for storing news articles and user data
- **SQLAlchemy**: ORM for database interactions
- **Alembic**: Database migration tool
- **Pydantic**: Data validation and settings management
- **JWT**: Token-based authentication
## Requirements
- Python 3.8+
- Mediastack API key
## Setup
1. Clone the repository
2. Install dependencies:
```bash
pip install -r requirements.txt
```
3. Set up environment variables:
```
MEDIASTACK_API_KEY=your_api_key_here
SECRET_KEY=your_secret_key_here
```
4. Run database migrations:
```bash
alembic upgrade head
```
5. Start the server:
```bash
uvicorn main:app --reload
```
## API Endpoints
The API is documented with Swagger UI, available at `/docs` when the server is running.
### Main Endpoints
- `/api/v1/users/register`: Register a new user
- `/api/v1/users/token`: Login and get JWT token
- `/api/v1/news`: Get news articles with optional filtering
- `/api/v1/news/personalized`: Get personalized news based on user preferences
- `/api/v1/news/saved`: Save articles for later reading
- `/health`: Health check endpoint
## Project Structure
- `app/api`: API routes and endpoints
- `app/core`: Core functionality (config, security, utils)
- `app/db`: Database connection and session
- `app/models`: SQLAlchemy models
- `app/schemas`: Pydantic schemas for validation
- `app/services`: Business logic services
- `migrations`: Database migrations
## Development
To run linting checks:
```bash
ruff check .
```
To fix linting issues automatically:
```bash
ruff check --fix .
```