This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
RequestBin is a Python Flask web application that allows developers to inspect HTTP requests for debugging webhooks and APIs. It creates temporary "bins" that collect and display HTTP requests sent to them.
The application follows a layered Flask architecture:
web.py: Application entry point that starts the Flask serverrequestbin/__init__.py: Flask app initialization, middleware setup, and URL routingrequestbin/views.py: Main web interface handlersrequestbin/api.py: REST API endpoints for programmatic accessrequestbin/models.py: Data models for bins and requestsrequestbin/storage/: Storage backend implementations (Redis for production, memory for local)requestbin/config.py: Environment-specific configuration
The app uses a pluggable storage system - memory storage for local development and Redis for production. Configuration switches based on the REALM environment variable.
# Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Install dependencies and run locally
uv run python web.py
# The app will be available at http://localhost:4000# Build and run with Docker Compose
docker-compose up -d
# View logs
docker-compose logs -f app
# Stop containers
docker-compose down- Managed with
pyproject.tomland uv - Use
uv add <package>to add new dependencies - Use
uv syncto install from lockfile
Key environment variables:
REALM: Set to "prod" for production configuration (enables Redis storage, disables debug)ROOT_URL: Base URL for the application (default varies by environment)REDIS_URL: Redis connection URL (default: redis://redis:6379)BIN_TTL: Bin expiration time in seconds (default 48 hours)MAX_REQUESTS_STORED: Maximum requests per bin (default 50)
- Bin Management: Temporary URLs that collect HTTP requests
- Request Storage: Configurable backend (memory/Redis) with TTL expiration
- CORS Support: Configurable cross-origin request handling
- Raw Body Middleware: Custom WSGI middleware to preserve request body data
- Gunicorn WSGI Server: Production server with gevent workers