A production-grade blockchain snapshot hosting service providing reliable, bandwidth-managed access to blockchain snapshots with tiered user system. Built with Next.js, MinIO, and deployed on Kubernetes.
The Blockchain Snapshots Service provides high-speed access to blockchain node snapshots for the Cosmos ecosystem. It features:
- Tiered Access: Free tier (50MB/s shared) and Premium tier (250MB/s shared)
- Resume Support: Interrupted downloads can be resumed
- Real-time Monitoring: Prometheus metrics and Grafana dashboards
- High Availability: Redundant deployments with automatic failover
- Security: JWT authentication, pre-signed URLs, and IP restrictions
- Key Features
- Tech Stack
- Architecture
- Getting Started
- Development
- API Reference
- Testing
- Deployment
- Monitoring
- Contributing
- License
- Multiple Chain Support: Host snapshots for 30+ Cosmos chains
- Bandwidth Management: Dynamic per-connection bandwidth allocation
- Download Resume: Support for interrupted download resumption
- Real-time Updates: Daily snapshot updates with automated sync
- Compression Options: LZ4 compressed snapshots for faster downloads
- Instant Access: No registration required for free tier
- Premium Tier: 5x faster downloads for authenticated users
- Search & Filter: Find snapshots by chain name or network
- Download Progress: Real-time download statistics
- Mobile Responsive: Optimized for all device sizes
- Pre-signed URLs: Secure, time-limited download links
- Rate Limiting: Prevent abuse with configurable limits
- Health Checks: Automated monitoring and alerting
- Metrics Export: Prometheus-compatible metrics
- GitOps Ready: Kubernetes manifests for easy deployment
- Next.js 15: React framework with App Router
- TypeScript 5: Type-safe development
- Tailwind CSS 4: Utility-first styling
- React 19: Latest React features
- Inter Font: Professional typography
- Next.js API Routes: Full-stack capabilities
- MinIO: S3-compatible object storage
- JWT: Secure authentication
- Prometheus: Metrics collection
- Node.js 20: Runtime environment
- Kubernetes: Container orchestration
- TopoLVM: Dynamic volume provisioning
- HAProxy: Load balancing
- Grafana: Metrics visualization
- GitHub Actions: CI/CD pipeline
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β Browser ββββββΆβ Next.js ββββββΆβ MinIO β
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β β
βΌ βΌ
βββββββββββββββ βββββββββββββββ
β Prometheus β β TopoLVM β
βββββββββββββββ βββββββββββββββ
- User browses available snapshots via Next.js frontend
- Authentication checked for tier determination
- Pre-signed URL generated with bandwidth metadata
- Direct download from MinIO with rate limiting
- Metrics collected for monitoring
- Node.js 20.x or higher
- npm or yarn
- Docker (for MinIO development)
- Kubernetes cluster (for production)
-
Clone the repository
git clone https://github.com/bryanlabs/snapshots.git cd snapshots
-
Create mock data
./scripts/setup-mock-data.sh
-
Start all services
docker-compose up -d
-
Access the application
- Application: http://localhost:3000
- MinIO Console: http://localhost:9001 (admin/minioadmin)
-
Test premium login
- Username:
premium_user
- Password:
premium123
- Username:
-
Clone the repository
git clone https://github.com/bryanlabs/snapshots.git cd snapshots
-
Install dependencies
npm install
-
Set up environment variables
cp .env.example .env.local # Edit .env.local with your configuration
-
Start MinIO (Docker)
docker run -p 9000:9000 -p 9001:9001 \ -e MINIO_ROOT_USER=minioadmin \ -e MINIO_ROOT_PASSWORD=minioadmin \ minio/minio server /data --console-address ":9001"
-
Run development server
npm run dev
-
Open browser Navigate to http://localhost:3000
snapshots/
βββ app/ # Next.js app directory
β βββ api/ # API routes
β βββ chains/ # Chain pages
β βββ login/ # Auth pages
β βββ page.tsx # Homepage
βββ components/ # React components
βββ lib/ # Utilities and helpers
βββ hooks/ # Custom React hooks
βββ __tests__/ # Test files
βββ docs/ # Documentation
βββ public/ # Static assets
# MinIO Configuration
MINIO_ENDPOINT=http://localhost:9000
MINIO_ACCESS_KEY=minioadmin
MINIO_SECRET_KEY=minioadmin
# Authentication
JWT_SECRET=your-secret-key
PREMIUM_USERNAME=premium_user
PREMIUM_PASSWORD_HASH=$2a$10$...
# Bandwidth Limits (MB/s)
BANDWIDTH_FREE_TOTAL=50
BANDWIDTH_PREMIUM_TOTAL=250
# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:3000
# Start development server
npm run dev
# Run tests
npm test
# Run tests in watch mode
npm run test:watch
# Run e2e tests
npm run test:e2e
# Build for production
npm run build
# Start production server
npm start
# Run linting
npm run lint
# Format code
npm run format
See API Routes Documentation for detailed endpoint information.
GET /api/health
- Health checkGET /api/v1/chains
- List all chainsGET /api/v1/chains/[chainId]/snapshots
- List snapshotsPOST /api/v1/chains/[chainId]/download
- Generate download URLPOST /api/v1/auth/login
- User authenticationGET /api/v1/auth/me
- Current user info
__tests__/
βββ api/ # API route tests
βββ components/ # Component tests
βββ integration/ # Integration tests
βββ e2e/ # End-to-end tests
# Unit tests
npm test
# Integration tests
npm run test:integration
# E2E tests (requires running app)
npm run test:e2e
# Test coverage
npm run test:coverage
// Example API test
describe('Download API', () => {
it('should generate URL for free tier', async () => {
const response = await request(app)
.post('/api/v1/chains/cosmos-hub/download')
.send({ filename: 'latest.tar.lz4' })
expect(response.status).toBe(200)
expect(response.body.tier).toBe('free')
})
})
-
Build the image
docker build -t snapshots-app .
-
Run with Docker Compose
docker-compose up -d
-
View logs
docker-compose logs -f app
-
Stop services
docker-compose down
The CI/CD pipeline automatically builds and pushes images to GitHub Container Registry:
# Pull the latest image
docker pull ghcr.io/bryanlabs/snapshots:latest
# Run the container
docker run -p 3000:3000 \
--env-file .env.local \
ghcr.io/bryanlabs/snapshots:latest
-
Create namespace
kubectl create namespace apps
-
Apply configurations
kubectl apply -f k8s/configmap.yaml kubectl apply -f k8s/secrets.yaml kubectl apply -f k8s/deployment.yaml kubectl apply -f k8s/service.yaml
-
Verify deployment
kubectl get pods -n apps kubectl get svc -n apps
The project uses GitHub Actions for automated deployment:
- Tests run on every push
- Docker images built and pushed to registry
- Kubernetes manifests updated automatically
- Rollback capability for failed deployments
The service exports Prometheus metrics:
- Request counts and latencies
- Download statistics by tier
- Bandwidth usage metrics
- Error rates and types
Pre-built dashboards available in docs/grafana/
:
- Service Overview
- Bandwidth Usage
- User Analytics
- Error Tracking
Configured alerts for:
- High error rates
- Bandwidth limit exceeded
- Storage capacity low
- Service unavailability
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
- Follow TypeScript best practices
- Use ESLint and Prettier
- Write meaningful commit messages
- Add JSDoc comments for public APIs
This project is licensed under the MIT License - see the LICENSE file for details.
- BryanLabs team for infrastructure support
- Polkachu for snapshot data integration
- Cosmos ecosystem for blockchain technology
- Open source contributors
- Documentation: docs/
- Issues: GitHub Issues
- Discord: BryanLabs Discord
- Email: support@bryanlabs.net