A Next.js application that displays live cryptocurrency price data using the CoinGecko API.
This application tracks prices for popular cryptocurrencies and displays their current price, symbol, and 24-hour price change percentage. The data is automatically refreshed every 30 seconds to provide up-to-date information.
- Live tracking of cryptocurrency prices (Bitcoin, Ethereum, Solana, Polygon, Dogecoin)
- 24-hour price change percentage with visual indicators (green for positive, red for negative)
- Auto-refresh data every 30 seconds
- Search and add additional cryptocurrencies
- Sort cryptocurrencies by price change (ascending/descending)
- Responsive design
- Framework: Next.js
- Data Fetching: React Query (@tanstack/react-query)
- API: CoinGecko API
- Styling: Tailwind CSS
-
Clone the repository:
git clone https://github.com/yourusername/crypto-tracker.git cd crypto-tracker -
Install dependencies:
npm install
-
Run the development server:
npm run dev
-
Build for production:
npm run build
-
Start the production server:
npm start
- The main page displays a list of cryptocurrencies with their current price and 24-hour change
- Click the sort button to toggle between ascending and descending order based on 24-hour price change
This project uses the CoinGecko API to fetch cryptocurrency price data:
- Endpoint:
https://api.coingecko.com/api/v3/coins/markets - Parameters:
vs_currency=usd- Convert prices to USDids=bitcoin,ethereum,etc- Specify which cryptocurrencies to fetchprice_change_percentage=24h- Include 24-hour price change data