Stefano abb467749b
All checks were successful
AWS Deploy on Push / build (push) Successful in 2m17s
Implemented bulk upload by passing a json structure. Added delete all channels, groups and priorities
2025-06-12 18:49:20 -05:00
2025-05-13 18:13:40 -05:00
2025-05-29 18:46:40 -05:00

IPTV Manager Service

A FastAPI-based service for managing IPTV playlists and channel priorities. The application provides secure endpoints for user authentication, channel management, and playlist generation.

Features

  • JWT Authentication: Secure login using AWS Cognito
  • Channel Management: CRUD operations for IPTV channels
  • Playlist Generation: Create M3U playlists with channel priorities
  • Stream Monitoring: Background checks for channel availability
  • Priority Management: Set channel priorities for playlist ordering

🛠️ Technology Stack

  • Backend: Python 3.11, FastAPI
  • Database: PostgreSQL (SQLAlchemy ORM)
  • Authentication: AWS Cognito
  • Infrastructure: AWS CDK (API Gateway, Lambda, RDS)
  • Testing: Pytest with 85%+ coverage
  • CI/CD: Pre-commit hooks, Alembic migrations

🚀 Getting Started

Prerequisites

  • Python 3.11+
  • Docker
  • AWS CLI (for deployment)

Installation

# Clone repository
git clone https://github.com/your-repo/iptv-manager-service.git
cd iptv-manager-service

# Setup environment
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env  # Update with your values

# Run installation script
./scripts/install.sh

Running Locally

# Start development environment
./scripts/start_local_dev.sh

# Stop development environment
./scripts/stop_local_dev.sh

☁️ AWS Deployment

The infrastructure is defined in CDK. Use the provided scripts:

# Deploy AWS infrastructure
./scripts/deploy.sh

# Destroy AWS infrastructure
./scripts/destroy.sh

# Create Cognito test user
./scripts/create_cognito_user.sh

# Delete Cognito user
./scripts/delete_cognito_user.sh

Key AWS components:

  • API Gateway
  • Lambda functions
  • RDS PostgreSQL
  • Cognito User Pool

🤖 Continuous Integration/Deployment

This project includes a Gitea Actions workflow (.gitea/workflows/deploy.yml) for automated deployment to AWS. The workflow is fully compatible with GitHub Actions and can be easily adapted by:

  1. Placing the workflow file in the .github/workflows/ directory
  2. Setting up the required secrets in your CI/CD environment:
    • AWS_ACCESS_KEY_ID
    • AWS_SECRET_ACCESS_KEY
    • AWS_DEFAULT_REGION

The workflow automatically deploys the infrastructure and application when changes are pushed to the main branch.

📚 API Documentation

Access interactive docs at:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

Key Endpoints

Endpoint Method Description
/auth/login POST User authentication
/channels GET List all channels
/playlist GET Generate M3U playlist
/priorities POST Set channel priority

🧪 Testing

Run the full test suite:

pytest

Test coverage includes:

  • Authentication workflows
  • Channel CRUD operations
  • Playlist generation logic
  • Stream monitoring
  • Database operations

📂 Project Structure

iptv-manager-service/
├── app/                 # Core application
│   ├── auth/            # Cognito authentication
│   ├── iptv/            # Playlist logic
│   ├── models/          # Database models
│   ├── routers/         # API endpoints
│   ├── utils/           # Helper functions
│   └── main.py          # App entry point
├── infrastructure/      # AWS CDK stack
├── docker/              # Docker configs
├── scripts/             # Deployment scripts
├── tests/               # Comprehensive tests
├── alembic/             # Database migrations
├── .gitea/              # Gitea CI/CD workflows
│   └── workflows/
└── ...                  # Config files

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

Description
No description provided
Readme 488 KiB
Languages
Python 95.9%
Shell 3.5%
Mako 0.3%
Dockerfile 0.3%