Skip to content

IP-HOP is a modern, self-hosted Dynamic DNS (DDNS) management system updater with multi-provider support, automatic IP monitoring, and a beautiful web dashboard.

License

Notifications You must be signed in to change notification settings

Taoshan98/ip-hop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

IP-HOP 🌐

Tests Backend Coverage Frontend Coverage Docker License

IP-HOP is a modern, self-hosted Dynamic DNS (DDNS) management system with multi-provider support, automatic IP monitoring, and a beautiful web dashboard.

✨ Features

  • πŸ”„ Automatic IP Updates: Monitors your public IP and updates DNS records automatically
  • 🌍 Multi-Provider Support: Cloudflare, Dynu, DuckDNS, No-IP, and extensible for more
  • ⏰ Flexible Scheduling: Cron-based scheduling for each domain
  • πŸ” Secure: Encrypted credentials, JWT authentication, HttpOnly cookies
  • πŸ“Š History Tracking: Complete audit trail of all IP changes
  • 🎨 Modern UI: Beautiful Next.js dashboard with real-time updates
  • 🐳 Docker Ready: One-command deployment with Docker Compose
  • βœ… Fully Tested: 107 backend + 68 frontend tests with 100% pass rate

πŸ“Έ Screenshots

Details

Dashboard

Dashboard

Providers

Providers

Domains

Domains

History

History

πŸš€ Quick Start with Docker (Recommended)

Prerequisites

  • Docker & Docker Compose
  • Domain(s) to manage
  • API credentials from your DNS provider

1. Clone the Repository

git clone https://github.com/Taoshan98/ip-hop.git
cd ip-hop

2. Configure Environment

cp .env.example .env
# Edit .env with your settings

Required variables:

SECRET_KEY=your-random-secret-key-here
ENCRYPTION_KEY=your-32-byte-base64-encryption-key

Generate keys:

# SECRET_KEY
openssl rand -hex 32

# ENCRYPTION_KEY (must be 32 bytes)
python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"

3. Start the Application

docker-compose up -d

4. Access the Dashboard

Open http://localhost:3000

First-time setup:

  1. Navigate to /setup
  2. Create admin account
  3. Add DNS providers
  4. Configure domains
  5. Set update schedules

πŸ“¦ Architecture

ip-hop/
β”œβ”€β”€ backend/          # FastAPI backend
β”‚   β”œβ”€β”€ app/         # Application code
β”‚   β”‚   β”œβ”€β”€ api/     # REST API endpoints
β”‚   β”‚   β”œβ”€β”€ core/    # Security, config
β”‚   β”‚   β”œβ”€β”€ models/  # SQLAlchemy models
β”‚   β”‚   β”œβ”€β”€ providers/ # DNS provider implementations
β”‚   β”‚   └── services/  # Business logic
β”‚   β”œβ”€β”€ database/    # SQLite database
β”‚   └── tests/       # 107 comprehensive tests
β”‚
β”œβ”€β”€ frontend/        # Next.js frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/     # Next.js 14 app router
β”‚   β”‚   β”œβ”€β”€ components/ # React components
β”‚   β”‚   β”œβ”€β”€ context/ # Auth context
β”‚   β”‚   └── lib/     # Utilities, API client
β”‚   └── __tests__/   # 68 comprehensive tests
β”‚
└── docker-compose.yml  # Deployment config

πŸ› οΈ Technology Stack

Backend

  • Framework: FastAPI (Python 3.12)
  • Database: SQLite with SQLAlchemy ORM
  • Authentication: JWT tokens with HttpOnly cookies
  • Security: Fernet encryption for credentials
  • Scheduling: APScheduler with Cron expressions
  • HTTP Client: httpx (async)
  • Testing: pytest (107 tests, 100% pass rate)

Frontend

  • Framework: Next.js 14 (React 19)
  • Language: TypeScript
  • Styling: Tailwind CSS
  • Components: Radix UI primitives
  • State: React Query for server state
  • HTTP Client: Axios
  • Testing: Jest + React Testing Library (68 tests)

DevOps

  • Containerization: Docker (multi-stage builds)
  • CI/CD: GitHub Actions
  • Security Scanning: Trivy
  • Image Registry: GitHub Container Registry (GHCR)

πŸ“– Documentation

πŸ”Œ Supported DNS Providers

Provider Status Features
Cloudflare βœ… API, Zone ID, proxied/DNS-only
Dynu βœ… API, domain management
DuckDNS βœ… Free, simple token-based auth
No-IP βœ… Free tier, DDNS Key auth
Custom πŸ”§ Extensible provider system

Adding New Providers

See Backend Documentation for implementation guide.

πŸ›‘οΈ Security Features

  • Encrypted Storage: Credentials encrypted at rest with Fernet
  • JWT Authentication: Secure token-based auth
  • HttpOnly Cookies: XSS protection
  • Non-root Docker: Runs as user iphop:1000
  • Security Scanning: Automated Trivy scans in CI/CD
  • No Hardcoded Secrets: Environment-based configuration

πŸ“Š API Overview

Authentication

  • POST /api/v1/auth/setup - Initial admin setup
  • POST /api/v1/auth/token - Login
  • POST /api/v1/auth/logout - Logout
  • GET /api/v1/auth/me - Current user

Providers

  • GET /api/v1/providers - List providers
  • POST /api/v1/providers - Add provider
  • PUT /api/v1/providers/{id} - Update provider
  • DELETE /api/v1/providers/{id} - Remove provider

Domains

  • GET /api/v1/domains - List domains
  • POST /api/v1/domains - Add domain
  • PUT /api/v1/domains/{id} - Update domain
  • POST /api/v1/domains/{id}/update_ip - Force update
  • GET /api/v1/domains/{id}/history - Update history

Full API docs: Backend README

πŸ§ͺ Testing

Run Backend Tests

cd backend
python -m pytest tests/ -v
# 107 tests, 100% pass rate

Run Frontend Tests

cd frontend
npm test
# 68 tests, 100% pass rate

Coverage Reports

# Backend
cd backend && pytest --cov=app tests/

# Frontend  
cd frontend && npm test -- --coverage

🚒 Deployment Options

Option 1: Docker Compose (Recommended)

  1. Set environment variables:
SECRET_KEY="your-secret-key-here" #openssl rand -hex 32
ENCRYPTION_KEY="your-encryption-key-here" #python3 -c 'from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())'
  1. Start the application:
docker-compose up -d

Permissions: You may be asked to change ownership of the newly created directory if you are running docker as root and creating folders via docker compose

sudo chown -R $USER:$USER ip-hop/
  1. Access the application:

Option 2: Docker Run

docker pull ghcr.io/taoshan98/ip-hop:latest

docker run -d \
  --name iphop \
  -p 8001:8001 \
  -p 3000:3000 \
  -e SECRET_KEY="your-secret-key" \
  -e ENCRYPTION_KEY="your-encryption-key" \
  -v iphop-data:/app/backend/database \
  ghcr.io/taoshan98/ip-hop:latest

Option 2: Manual Installation

# Backend
cd backend
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 8001

# Frontend
cd frontend
npm install
npm run build
npm start

🐳 Docker Details

Image Information

  • Base Image: Alpine Linux (minimal size)
  • Size: ~200MB (optimized multi-stage build)
  • Platforms: linux/amd64, linux/arm64
  • User: Non-root (iphop:1000)
  • Health Check: Built-in monitoring

Volumes

  • /app/backend/database - Persistent database storage

Ports

  • 8001 - Backend API (FastAPI/Uvicorn)
  • 3000 - Frontend (Next.js)

Security Features

  • βœ… Non-root user execution
  • βœ… Minimal Alpine base image
  • βœ… Multi-stage build (smaller attack surface)
  • βœ… Security scanning with Trivy
  • βœ… No hardcoded secrets
  • βœ… Health checks enabled

CI/CD Pipeline

The GitHub Actions workflow automatically:

  1. On Pull Request:

    • Runs backend tests (pytest)
    • Builds frontend
    • Validates Docker build
  2. On Main Branch Push:

    • Runs all tests
    • Builds multi-architecture images (amd64, arm64)
    • Pushes to GitHub Container Registry
    • Scans for vulnerabilities (Trivy)
    • Creates semantic version tags (1.0.0, 1.0, 1, latest)

Docker Management

View logs:

docker compose logs -f

Stop the application:

docker-compose down
# or
docker stop iphop

Troubleshooting

Container won't start:

docker compose logs iphop

Health check failing:

docker inspect iphop-app | grep Health -A 10

Database issues:

docker exec -it iphop-app ls -la /app/backend/database

Production Recommendations

  1. Use volume for database persistence
  2. Set strong SECRET_KEY and ENCRYPTION_KEY
  3. Use reverse proxy (nginx/traefik) for SSL
  4. Enable Docker resource limits
  5. Monitor container health
  6. Regular backups of database volume

πŸ”§ Configuration

Environment Variables

Variable Description Required Default
SECRET_KEY JWT signing key βœ… -
ACCESS_TOKEN_EXPIRE_MINUTES JWT access token expiration time in minutes ❌ 10080 (7 days)
ENCRYPTION_KEY Fernet encryption key βœ… -
DATABASE_PATH SQLite database path ❌ backend/database/ip_hop.db
CORS_ORIGINS Allowed CORS origins ❌ ["http://localhost:3000"]

Cron Schedule Examples

*/5 * * * *   # Every 5 minutes
0 */1 * * *   # Every hour
0 0 * * *     # Daily at midnight
0 */6 * * *   # Every 6 hours

πŸ“ˆ Version Management

IP-HOP follows Semantic Versioning:

🀝 Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Write tests for new features
  4. Ensure all tests pass
  5. Submit a pull request

πŸ“ License

MIT License - see LICENSE file

πŸ™ Acknowledgments

  • FastAPI for the excellent backend framework
  • Next.js for the modern React framework
  • Cloudflare and Dynu for DNS services
  • All open-source contributors

πŸ“ž Support


Made with ❀️ for easier DDNS management

About

IP-HOP is a modern, self-hosted Dynamic DNS (DDNS) management system updater with multi-provider support, automatic IP monitoring, and a beautiful web dashboard.

Topics

Resources

License

Stars

Watchers

Forks

Packages