Puffer is a full-stack service for tracking and visualizing the pufETH/ETH conversion rate over time. It fetches on-chain data, caches it, and exposes a simple API and frontend dashboard.
-
Backend API (Go):
- Fetches and caches pufETH/ETH rates and supply from Ethereum.
- Provides REST and SSE endpoints for current and historical rates.
- Uses Redis for fast caching.
-
Frontend (React, with optional Vue):
- Displays live and historical pufETH/ETH rates in a modern dashboard.
- Connects to the backend API for data.
-
Dockerized:
- One-command startup for API, Redis, and frontend using Docker Compose.
.
├── main.go # Go backend entrypoint
├── Dockerfile # Backend Docker build
├── docker-compose.yml # Multi-service orchestration
├── cache/ # Redis cache logic
├── models/ # Data models (e.g., RateUpdate)
├── routes/ # API route handlers
├── utils/ # On-chain logic, formatting, Etherscan helpers
├── etherscanclient/ # Etherscan API client
├── fe_react/ # React frontend (default)
└── fe_vue/ # Vue frontend (optional)
GET /rate— Latest pufETH/ETH rate and supply.GET /rate/history— 24h historical rates (hourly).GET /sse/rate— Live updates via Server-Sent Events (SSE).
Sample Response:
{
"timestamp": 1712345678,
"rate": 1.002345,
"assets": "53.25K",
"total_supply": "53.25K"
}-
Clone the repository:
git clone <repo-url> cd puffer
-
Configure environment variables:
- Edit
docker-compose.ymlto set your ownETH_RPC_URLandETHERSCAN_API_KEYif needed.
- Edit
-
Start all services:
docker-compose up --build
-
Access the dashboard:
- Open http://localhost:3000 for the React frontend.
- Open http://localhost:3010 for the Vue frontend.
- The API is available at http://localhost:8080.
go mod tidygo run main.go- Requires Redis running locally (
docker run -p 6379:6379 redis:7-alpine). - Set
ETH_RPC_URL,REDIS_ADDR, andETHERSCAN_API_KEYas environment variables.
cd fe_react
npm install
npm run dev- Set
VITE_API_URLinfe_react/.envto your API endpoint (default:http://localhost:8080).
cd fe_vue
npm install
npm run dev- Set
VITE_API_URLinfe_vue/.envif using Vue.
- Formatting:
Large ETH values are displayed with K/M/B suffixes (e.g.,53.25Kfor 53,250 ETH). - Switching Frontends:
By default, Docker Compose runs both the React and Vue frontends. To use individually, adjust the compose file accordingly.