A modern, real-time cryptocurrency tracking application built with React. Monitor cryptocurrency prices, view detailed coin information, and analyze price trends with beautiful charts and a responsive design.
- π Real-time Crypto Data - Track top 100 cryptocurrencies with live price updates
- π Interactive Charts - 7-day price history charts powered by Recharts
- π Search & Filter - Search cryptocurrencies by name or symbol
- π± Responsive Design - Beautiful UI that works on all devices
- π Light/Dark Mode - Toggle between light and dark themes with persistent preferences
- π¨ Modern UI - Glassmorphism design with smooth animations
- π Detailed Coin Pages - View comprehensive information for each cryptocurrency
- π Sorting Options - Sort by rank, name, price, market cap, or 24h change
- π Grid/List Views - Switch between grid and list view modes
- React 19.2.0 - UI library
- React Router 7.9.6 - Client-side routing
- Recharts 3.5.0 - Charting library for data visualization
- Vite 7.2.4 - Build tool and dev server
- CoinGecko API - Cryptocurrency data source
Before you begin, ensure you have the following installed:
- Node.js (v18 or higher recommended)
- npm, yarn, or pnpm (package manager)
-
Clone the repository
git clone <repository-url> cd Crypto-Watch
-
Install dependencies
Using npm:
npm install
Using yarn:
yarn install
Using pnpm:
pnpm install
The application uses the CoinGecko API (free tier) which doesn't require an API key. The API endpoints are configured in src/api/coinGecko.js:
- Base URL:
https://api.coingecko.com/api/v3 - Markets Endpoint:
/coins/markets- Fetches top 100 cryptocurrencies - Coin Detail Endpoint:
/coins/{id}- Fetches detailed information for a specific coin - Chart Data Endpoint:
/coins/{id}/market_chart- Fetches 7-day price history
Theme preferences are automatically saved to localStorage and persist across sessions. The theme can be toggled using the theme switcher button in the header.
Start the development server:
npm run devOr with yarn:
yarn devOr with pnpm:
pnpm devThe application will be available at http://localhost:5173 (or the next available port).
Build the project for production:
npm run buildThe optimized build will be created in the dist directory.
Preview the production build locally:
npm run previewRun ESLint to check for code issues:
npm run lintCrypto-Watch/
βββ public/ # Static assets
βββ src/
β βββ api/ # API integration
β β βββ coinGecko.js # CoinGecko API functions
β βββ components/ # Reusable components
β β βββ CryptoCard.jsx # Crypto card component
β βββ contexts/ # React contexts
β β βββ ThemeContext.jsx # Theme management
β βββ pages/ # Page components
β β βββ Home.jsx # Home page (crypto list)
β β βββ CoinDetail.jsx # Coin detail page
β βββ utils/ # Utility functions
β β βββ formatter.js # Number formatting utilities
β βββ App.jsx # Main app component
β βββ main.jsx # Application entry point
β βββ index.css # Global styles and theme variables
βββ index.html # HTML template
βββ package.json # Dependencies and scripts
βββ vite.config.js # Vite configuration
βββ README.md # This file
- Displays top 100 cryptocurrencies in a grid or list view
- Search functionality to filter coins
- Sort by rank, name, price, market cap, or 24h change
- Click on any card to view detailed information
- Comprehensive coin information
- Current price with 24h change indicator
- 7-day price history chart
- Market statistics (market cap, volume, supply)
- 24h high/low prices
- Light and dark mode support
- Smooth transitions between themes
- Theme preference saved in localStorage
- All components are theme-aware
This project uses the CoinGecko Free API which:
- Doesn't require authentication
- Has rate limits (50 calls/minute for free tier)
- Provides comprehensive cryptocurrency data
- Updates data every 30 seconds
For production use, consider:
- Implementing API rate limiting
- Adding error handling for API failures
- Using CoinGecko Pro API for higher rate limits
Endpoint: GET /coins/markets
Query Parameters:
vs_currency: Currency for price comparison (default:usd)order: Sort order (default:market_cap_desc)per_page: Number of results per page (default:100)page: Page number (default:1)sparkline: Include sparkline data (default:false)
Response: Array of market data objects
[
{
"id": "bitcoin",
"symbol": "btc",
"name": "Bitcoin",
"image": "https://assets.coingecko.com/coins/images/1/large/bitcoin.png",
"current_price": 43250.50,
"market_cap": 850123456789,
"market_cap_rank": 1,
"fully_diluted_valuation": 908765432109,
"total_volume": 12345678901,
"high_24h": 44500.00,
"low_24h": 42000.00,
"price_change_24h": 1250.50,
"price_change_percentage_24h": 2.98,
"market_cap_change_24h": 25000000000,
"market_cap_change_percentage_24h": 3.03,
"circulating_supply": 19650000,
"total_supply": 19650000,
"max_supply": 21000000,
"ath": 69045,
"ath_change_percentage": -37.35,
"ath_date": "2021-11-10T14:24:11.849Z",
"atl": 67.81,
"atl_change_percentage": 63657.89,
"atl_date": "2013-07-06T00:00:00.000Z",
"last_updated": "2024-01-15T10:30:00.000Z"
}
]Key Fields Used:
id: Unique identifier (used for navigation)name: Full name of the cryptocurrencysymbol: Ticker symbol (e.g., BTC, ETH)image: URL to coin logocurrent_price: Current price in USDmarket_cap: Market capitalizationmarket_cap_rank: Ranking by market capprice_change_percentage_24h: 24-hour price change percentagetotal_volume: 24-hour trading volume
Endpoint: GET /coins/{id}
Path Parameters:
id: Coin ID (e.g.,bitcoin,ethereum)
Query Parameters:
localization: Include localized names (default:false)tickers: Include ticker data (default:false)market_data: Include market data (default:true)community_data: Include community data (default:false)developer_data: Include developer data (default:false)sparkline: Include sparkline data (default:false)
Response: Detailed coin object
{
"id": "bitcoin",
"symbol": "btc",
"name": "Bitcoin",
"image": {
"thumb": "https://assets.coingecko.com/coins/images/1/thumb/bitcoin.png",
"small": "https://assets.coingecko.com/coins/images/1/small/bitcoin.png",
"large": "https://assets.coingecko.com/coins/images/1/large/bitcoin.png"
},
"market_data": {
"current_price": {
"usd": 43250.50
},
"market_cap": {
"usd": 850123456789
},
"market_cap_rank": 1,
"total_volume": {
"usd": 12345678901
},
"high_24h": {
"usd": 44500.00
},
"low_24h": {
"usd": 42000.00
},
"price_change_24h": 1250.50,
"price_change_percentage_24h": 2.98,
"price_change_percentage_7d": 5.23,
"price_change_percentage_30d": -2.15,
"market_cap_change_24h": 25000000000,
"market_cap_change_percentage_24h": 3.03,
"circulating_supply": 19650000,
"total_supply": 19650000,
"max_supply": 21000000
},
"last_updated": "2024-01-15T10:30:00.000Z"
}Key Fields Used:
id: Coin identifiername: Full namesymbol: Ticker symbolimage.large: Large logo URLmarket_data.current_price.usd: Current USD pricemarket_data.market_cap_rank: Market cap rankingmarket_data.price_change_percentage_24h: 24h price changemarket_data.high_24h.usd: 24h high pricemarket_data.low_24h.usd: 24h low pricemarket_data.market_cap.usd: Market capitalizationmarket_data.total_volume.usd: 24h trading volumemarket_data.circulating_supply: Circulating supplymarket_data.total_supply: Total supply
Endpoint: GET /coins/{id}/market_chart
Path Parameters:
id: Coin ID (e.g.,bitcoin,ethereum)
Query Parameters:
vs_currency: Currency for price comparison (default:usd)days: Number of days of historical data (default:7)
Response: Price history data
{
"prices": [
[1705324800000, 43000.50],
[1705411200000, 43250.75],
[1705497600000, 43500.25]
],
"market_caps": [
[1705324800000, 845000000000],
[1705411200000, 850000000000],
[1705497600000, 855000000000]
],
"total_volumes": [
[1705324800000, 12000000000],
[1705411200000, 12300000000],
[1705497600000, 12500000000]
]
}Response Structure:
prices: Array of[timestamp, price]pairstimestamp: Unix timestamp in millisecondsprice: Price in the specified currency
market_caps: Array of[timestamp, market_cap]pairstotal_volumes: Array of[timestamp, volume]pairs
Data Processing:
The application transforms the prices array into chart-friendly format:
{
time: "Jan 15", // Formatted date
price: "43250.50" // Formatted price string
}All API endpoints may return errors:
- 429 Too Many Requests: Rate limit exceeded
- 404 Not Found: Coin ID doesn't exist
- 500 Internal Server Error: CoinGecko API error
The application handles these errors gracefully and displays appropriate messages to users.
- View Cryptocurrencies: Browse the top 100 cryptocurrencies on the home page
- Search: Use the search bar to find specific cryptocurrencies
- Sort: Use the dropdown to sort by different criteria
- View Details: Click on any cryptocurrency card to see detailed information
- Toggle Theme: Click the sun/moon icon in the header to switch themes
- Switch Views: Toggle between grid and list views using the view buttons
If port 5173 is already in use, Vite will automatically use the next available port.
If you encounter API errors:
- Check your internet connection
- Verify CoinGecko API is accessible
- Check browser console for detailed error messages
If the build fails:
- Clear
node_modulesand reinstall dependencies - Ensure Node.js version is compatible
- Check for any linting errors
Contributions, issues, and feature requests are welcome! Feel free to check the issues page.
Note: This project is for educational purposes. Always verify cryptocurrency data from official sources before making financial decisions.