A caching proxy mirror for pub.dev using nginx.
- Local Package Caching: Implements persistent local storage for Dart packages and API responses using nginx
proxy_storedirective - Format Preservation: Maintains original file integrity by storing packages in their native formats (
.jsonmetadata,.tgzarchives) - Persistent Storage: Cached content survives container restarts and system reboots
- Intelligent URL Rewriting: Automatically redirects package requests to locally cached versions when available
- Secure Upstream Communication: Establishes encrypted SSL/TLS connections to the upstream pub.dev registry
- High Performance: Leverages nginx's proven caching architecture for optimal throughput and low latency
-
Start the nginx server:
docker compose up -d
-
Configure Dart/Flutter to use the mirror:
export PUB_HOSTED_URL=http://localhost:8081 -
Use
flutter pub getand/ordart pub getas usual.
- Port: 8081
- Cache Directory:
./cache - Backend:
https://pub.dev
Tune docker-compose.yaml to suit your needs.