Build a Real-Time Crypto Tracker with TimescaleDB
- Go 1.18+
- Node.js 18+ and npm/yarn
- Docker and Docker Compose
docker compose up -dThis starts TimescaleDB which is required for both the backend and frontend.
To stop the database:
docker compose down -vBoth the backend and frontend use .env files. Configure them before running:
Backend (.env in root):
TIMESCALE_SERVICE_URL=postgres://postgres:password@127.0.0.1:5432/timescale_db
PGPASSWORD=password
PGUSER=postgres
PGDATABASE=timescale_db
PGHOST=127.0.0.1
PGPORT=5432
PGSSLMODE=disable
COIN_GECKO_API_KEY=<your-coingecko-api-key>Frontend (.env in tiger-tracker-frontend/):
TIMESCALE_SERVICE_URL=postgres://postgres:password@127.0.0.1:5432/timescale_db?sslmode=disable
PGPASSWORD=password
PGUSER=postgres
PGDATABASE=timescale_db
PGHOST=127.0.0.1
PGPORT=5432
PGSSLMODE=disable
COIN_GECKO_API_KEY=<your-coingecko-api-key>The Go backend ingests crypto prices from the CoinGecko API and stores them in TimescaleDB every 30 seconds.
go run main.goYou should see output like:
Calling Coin Gecko API...
API Response as struct {...}
The backend will continue running in the foreground, periodically fetching and storing price data.
In a new terminal, navigate to the frontend directory and start the development server:
cd tiger-tracker-frontend
npm install # if you haven't already
npm run devThe frontend will be available at http://localhost:3000
- Backend (Go): Runs a continuous price ingestion process that fetches BTC, ETH, and SOL prices from CoinGecko and stores them in TimescaleDB
- Frontend (Next.js): Web UI that displays crypto price data stored in the database
- Database (TimescaleDB): Time-series database for storing historical price data