Welcome to the repository for Harper's Bounce House, a simple domain bouncer that redirects visitors to harperrules.com! 🚀
Harper's Bounce House is a unified application that handles both domain redirection and domain submission requests. It enhances user experience by directing valid domains to specific URL parameters and managing invalid requests gracefully, while also providing a secure API for domain submission requests with Airtable integration.
Key features of the project include:
- Domain Redirection: Validates incoming domain requests and redirects users accordingly
- Domain Submission API: Secure endpoint for domain acquisition requests with spam protection
- Airtable Integration: Automatic syncing of submissions to Airtable
- Spam Protection: reCAPTCHA v3, honeypot fields, and rate limiting
- Metrics & Monitoring: Prometheus metrics for both redirect and submission tracking
- Auto-deployment: GitHub Actions workflows for production and PR preview deployments
To set up and run Harper's Bounce House locally, follow these steps:
-
Clone the Repository:
git clone https://github.com/harperreed/bounce-house.git cd bounce-house -
Create Virtual Environment (optional):
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Dependencies: Make sure you have Python 3.13 or later installed. Then, run:
uv sync # or pip install -r requirements.txt -
Set up Environment Variables:
cp .env.example .env # Edit .env file with your API keys and configuration -
Run the Application:
uv run python combined_app.py
-
Access the Application:
- Domain redirects:
http://localhost:8080/ - Submit API:
http://localhost:8080/submit - Health check:
http://localhost:8080/health - Metrics:
http://localhost:8080/metrics - API docs:
http://localhost:8080/docs
- Domain redirects:
The application uses GitHub Actions for automatic deployment:
- Production: Deploys to
bounce-houseapp on pushes tomainbranch - Preview: Creates preview apps for pull requests (
bounce-house-pr-{number}) - Cleanup: Automatically destroys preview apps when PRs are closed
-
Set up Fly.io secrets:
./setup-fly-secrets.sh
-
Deploy manually:
flyctl deploy --remote-only
For detailed deployment instructions, see DEPLOYMENT.md.
- FastAPI: Modern, fast web framework for building APIs with Python
- Uvicorn: Lightning-fast ASGI server for Python applications
- SQLAlchemy: SQL toolkit and ORM for Python
- Pydantic: Data validation and settings management using Python type hints
- Prometheus: Metrics server to monitor application performance
- Validators: Library to validate domain names
- TLD Extract: Extracts the top-level domain from incoming requests
- reCAPTCHA v3: Google's spam protection service
- Airtable: Cloud-based database for storing submissions
combined_app.py: Main application combining domain redirect and submission APIbounce.py: Legacy Flask-based domain bouncing logicsubmit.py: Standalone FastAPI submission endpointmodels.py: Pydantic models for form validationdatabase.py: SQLAlchemy models and database operationsrecaptcha.py: reCAPTCHA v3 integrationairtable.py: Airtable API clientmiddleware.py: Rate limiting and spam protectionmetrics.py: Prometheus metrics definitionsDockerfile: Multi-stage Docker build configurationfly.toml: Fly.io deployment configurationtest_*.py: Comprehensive test suites- Workflow files in
.github/workflows/: CI/CD for testing, linting, and deployment
- GET / - Domain redirect service (original bounce functionality)
- POST /submit - Domain submission API with spam protection
- GET /health - Health check endpoint
- GET /metrics - Prometheus metrics endpoint
- GET /api - API information endpoint
- GET /docs - Interactive API documentation
The application exposes comprehensive Prometheus metrics at the /metrics endpoint:
- Domain redirects: Track visits by domain
- Form submissions: Monitor submission rates and success/failure
- Spam detection: Track honeypot hits and reCAPTCHA failures
- Airtable sync: Monitor API sync success rates
- Rate limiting: Track rate limit violations
If you'd like to contribute to the Bounce House, feel free to open issues or submit pull requests. We welcome all contributions to make this project better! Let's bounce together! 🙌
Built with ❤️ by @harperreed