This is an open source project that provides a fast, reliable, and cost-effective proxy solution for Hyperliquid API calls using AWS infrastructure. We believe in community-driven development and welcome contributions from developers worldwide.
We understand the pain of building products in the Hyperliquid ecosystem:
- Rate limiting restricts HTTP calls to the Hyperliquid API, limiting innovation
- Public proxies (Brightdata, Oxylabs) can be slow and frustrating for users
- High costs of running dedicated infrastructure
This repository provisions AWS edge infrastructure for a lightweight Go reverse proxy that:
- Forwards selected requests to
https://api.hyperliquid.xyz
- Provides simple health monitoring
- Uses Terraform for complete infrastructure as code
- Combines on-demand and spot instances for cost optimization
💡 Why Open Source?
- Transparency: Full visibility into the proxy implementation
- Community-driven: Benefit from collective improvements and bug fixes
- Cost-effective: No vendor lock-in, deploy on your own AWS account
- Customizable: Adapt the solution to your specific needs
- Educational: Learn modern infrastructure patterns and practices
Check https://instances.vantage.sh for the cheapest spot instances to optimize your costs further.
- Infrastructure: Terraform for AWS resource provisioning
- Compute: AWS EC2 (on-demand + spot instances)
- Load Balancing: Application Load Balancer (ALB)
- CDN: CloudFront distribution
- Container Registry: Amazon ECR
- Runtime: Go 1.24+
- Containerization: Docker (multi-stage builds)
- Networking: VPC with public subnets, Internet Gateway
- Security: IAM roles, Security Groups
- Scaling: Auto Scaling Groups
- VPC with two public subnets, Internet Gateway, and routing.
- Security groups for ALB (80/443) and EC2 (8080 from ALB, 22 for SSH).
- Application Load Balancer in front of two Auto Scaling Groups (on‑demand and spot) using launch templates.
- CloudFront distribution in front of the ALB (HTTP origin; redirect to HTTPS at the edge).
- ECR repository for the container image (with lifecycle policy).
- EC2 user data installs Docker and runs the latest image from ECR.
- Go service listens on
:8080
, proxies/info
and/exchange
, and serves/health
.
main.tf
: Terraform infrastructure (AWS provider, networking, ALB, ASGs, CloudFront, outputs).ecr.tf
: ECR repository and lifecycle policy configuration.user_data.sh
: EC2 bootstrap to install Docker, login to ECR, and run the container.main.go
: Minimal reverse proxy with retry on 429 and/health
endpoint.Dockerfile
: Multi‑stage build for a small static Go binary image.build.sh
: Helper to build, tag, and push the image to your account's ECR.go.mod
: Go module settings.
- AWS account with permissions for VPC, EC2, ELBv2, CloudFront, IAM, ECR, and Auto Scaling.
terraform >= 1.0
,awscli
,docker
.- AWS credentials configured (e.g.,
aws configure
or environment variables).
- Verify AWS CLI is properly configured
- Run:
aws sts get-caller-identity
- Ensure your AWS credentials are configured (e.g.,
aws configure
or environment variables) - Verify your default region is set:
aws configure get region
- Create the ECR repository first
- Run:
terraform init
(if not done already) - Apply ECR configuration:
terraform apply ecr.tf
- Note the ECR repository URL from the output
- Build and push the container image to your ECR
- Ensure Docker is installed and running
- Ensure your AWS CLI default region is set (used by
build.sh
) - Run:
./build.sh
- Note the resulting image URI printed at the end
- Review and adjust configuration
- Region: Terraform defaults to
ap-northeast-1
but can be customized using theaws_region
variable. - Instance type: Defaults to
t3a.nano
but can be customized using theinstance_type
variable. - ECR in user data:
user_data.sh
currently references a hard‑coded ECR URL415177010443.dkr.ecr.eu-central-1.amazonaws.com/hyperliquid-proxy
for pulling the image. Update this to your account and region, or align your push to that repo. - ASG sizes and CloudFront price class can be tuned in
main.tf
.
- Provision the infrastructure
terraform init
terraform apply
(use-var="aws_region=us-west-2"
and-var="instance_type=t3.micro"
to override defaults)- Outputs include the ALB DNS name and the CloudFront domain.
- Verify
- Health:
curl https://<cloudfront_domain>/health
(302 → HTTPS; then 200 JSON). - Proxy:
curl https://<cloudfront_domain>/info
and/exchange
should forward to the Hyperliquid API.
/health
: JSON health check from the Go service./info
,/exchange
: Proxied toapi.hyperliquid.xyz
with basic 429 retry backoff.
alb_dns_name
: Public DNS of the ALB.alb_zone_id
: Hosted zone ID for the ALB (useful for Route53 records).cloudfront_domain_name
: Public domain for the CloudFront distribution.ecr_repository_url
: ECR repo URI for pushing images.
- Region: Use the
aws_region
variable to change the deployment region (default:ap-northeast-1
). - Instance type: Use the
instance_type
variable to change the EC2 instance type (default:t3a.nano
). - Image source: Replace the hard‑coded image reference in
user_data.sh
with your ECR URL (or template it via Terraform if desired). - TLS: CloudFront uses the default certificate for
*.cloudfront.net
. For custom domains, create an ACM cert in us‑east‑1 and attach it to CloudFront. - Capacity: Adjust ASG
min_size
,desired_capacity
, andmax_size
inmain.tf
.
terraform destroy
tears down all provisioned AWS resources.- Manually delete any remaining ECR images if the repo is retained by policy.
- Image pull failures: Ensure
user_data.sh
references your correct ECR URL and that the instance role has ECR permissions (configured inmain.tf
). - 5xx from ALB/CF: Check EC2 instance logs (
docker logs hyperliquid-proxy
) and security groups for port 8080. - Region mismatch: Keep
build.sh
,main.tf
, anduser_data.sh
aligned on AWS region and account ID.
We welcome contributions from the community! This open source project thrives on collaboration and diverse perspectives.
- 🐛 Bug Reports: Found an issue? Open an issue with detailed reproduction steps
- 💡 Feature Requests: Have ideas for improvements? Share them in the issues
- 🔧 Code Contributions: Submit pull requests for bug fixes or new features
- 📚 Documentation: Help improve guides, examples, and API documentation
- 🧪 Testing: Test the proxy in different AWS regions and configurations
- 💬 Community Support: Help other users in discussions and issues
- Fork the repository and clone your fork
- Set up your development environment following the Prerequisites section
- Make your changes on a feature branch
- Test thoroughly in your AWS environment
- Submit a pull request with clear description of changes
- Follow existing code style and patterns
- Test infrastructure changes in isolated AWS accounts
- Update documentation for any new features or configuration options
- Keep commits focused and write clear commit messages
- Ensure Terraform plans are clean and follow AWS best practices
This project follows standard open source community guidelines:
- Be respectful and inclusive
- Provide constructive feedback
- Focus on technical merits of contributions
- Help create a welcoming environment for all contributors
Help us prioritize! Vote on features or add new ideas by opening issues.
- ALB-based Autoscaling: Implement CloudWatch metrics-based autoscaling using ALB request count, target response time, and active connection count to automatically scale ASGs up/down based on traffic patterns.
- Customizable Caching Layer: Add configurable caching to cache API results and reduce load on Hyperliquid API endpoints.
- WebSocket Support: Implement WebSocket proxying for real-time data streaming from Hyperliquid.
- EVM Support: Extend proxy functionality to support RPC endpoints.
- RPS Tracking and Throttling: Implement requests per second tracking and throttling to manage traffic flow.
- Multi-Region Deployment: Template for deploying across multiple AWS regions
- Monitoring & Observability: CloudWatch dashboards and alerting setup
- Cost Optimization Tools: Scripts and recommendations for further cost reduction
Want to see something not listed? Your input shapes the roadmap! Open an issue to suggest new features or improvements.
This project is open source and available under the MIT License.
If this project helps you, consider:
- ⭐ Starring the repository to show your support
- 🔀 Sharing with others who might benefit
- 🤝 Contributing improvements back to the community
- 🐛 Reporting bugs to help improve stability
- 💡 Suggesting features to help the project evolve