A modern, real-time cryptocurrency tracking application built with Next.js 15, React 19, and TypeScript. Track your favorite cryptocurrencies with live prices powered by the CoinGecko API.
- Real-time Price Tracking: Live cryptocurrency prices updated from CoinGecko API
- Modern UI: Clean, responsive design with dark mode support
- Multiple Currencies: Support for USD, EUR, and GBP
- Server-Side Rendering: Fast initial page loads with Next.js App Router
- Type-Safe: Built with TypeScript and Zod for runtime validation
- Responsive Design: Optimized for desktop and mobile devices
- Bitcoin (BTC)
- Ethereum (ETH)
- Solana (SOL)
- Dogecoin (DOGE)
- Framework: Next.js 15 with App Router
- Frontend: React 19, TypeScript
- Styling: Tailwind CSS v4
- Validation: Zod
- State Management: React Context
- API: CoinGecko API
- Package Manager: pnpm
-
Clone the repository
git clone git@github.com:mrlemoos/crypto-tracker.git cd crypto-tracker -
Install dependencies
pnpm install
-
Run the development server
pnpm run dev
-
Open your browser Navigate to http://localhost:3000 to see the application.
src/
├── app/ # Next.js App Router
│ ├── api/ # API routes
│ │ └── cryptocurrencies/
│ ├── globals.css # Global styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page
├── components/ # React components
│ ├── crypto-card.tsx # Individual crypto card
│ ├── crypto-dashboard.tsx # Main dashboard
│ ├── crypto-grid.tsx # Grid layout
│ └── footer.tsx # Footer component
├── context/ # React Context providers
│ └── cryptocurrencies-context.tsx
├── lib/ # Utilities and services
│ ├── cryptocurrencies.ts # CoinGecko API integration
│ ├── invariant.ts # Utility functions
│ └── schema.ts # Zod schemas
pnpm dev- Start development server with Turbopackpnpm build- Build production applicationpnpm start- Start production serverpnpm lint- Run ESLint
Fetch cryptocurrency prices with optional parameters:
Query Parameters:
tracking- Array of cryptocurrency IDs (default:["bitcoin", "ethereum", "solana", "dogecoin"])fiatVersus- Fiat currency code (default:"usd", supports:"usd","eur","gbp")
Example:
GET /api/cryptocurrencies?tracking=bitcoin,ethereum&fiatVersus=usd
Response:
{
"data": {
"bitcoin": {
"usd": 45000.0
},
"ethereum": {
"usd": 3000.0
}
}
}The application fetches live cryptocurrency prices from the CoinGecko API. Prices are displayed with proper formatting and currency symbols.
The crypto cards are displayed in a responsive grid that adapts to different screen sizes:
- Mobile: 1 column
- Tablet: 2 columns
- Desktop: 2 columns
The application includes built-in dark mode support using Tailwind CSS dark mode classes.
- Runtime Validation: Zod schemas ensure API responses match expected types
- Compile-time Safety: TypeScript provides static type checking
- Schema Validation: API parameters are validated using Zod schemas
This project is open source and available under the MIT License.