Skip to content

mahmud886/crypto-tracker

Repository files navigation

πŸš€ Cryptocurrency Tracker

A modern, real-time cryptocurrency tracking application built with Next.js 15, featuring live price data, interactive charts, and crypto news.

Cryptocurrency Tracker TypeScript TailwindCSS React

✨ Features

πŸ“Š Live Price Tracking

  • Real-time cryptocurrency prices from CoinGecko API
  • Top cryptocurrencies by market cap
  • 24-hour price changes and market data
  • Responsive grid layout with search and sorting

πŸ“ˆ Interactive Charts

  • Historical price data visualization with Recharts
  • Multiple time ranges (24H, 7D, 30D, 90D)
  • Line and area chart types
  • Responsive chart design

πŸ“° Crypto News Feed

  • Latest cryptocurrency news
  • Category-based filtering (Bitcoin, Ethereum, DeFi, NFT, Regulation)
  • Real-time updates
  • Responsive card layout

🎨 Modern UI/UX

  • Dark/Light mode toggle
  • Responsive design for all devices
  • Smooth animations with Framer Motion
  • shadcn/ui component library
  • TailwindCSS for styling

⚑ Performance & Reliability

  • Server-side rate limiting
  • Intelligent caching (client & server-side)
  • API fallback mechanism
  • Error isolation and graceful degradation
  • SWR for data fetching and caching

πŸ› οΈ Tech Stack

Frontend

  • Next.js 15 - React framework with App Router
  • TypeScript - Type safety and better DX
  • TailwindCSS - Utility-first CSS framework
  • shadcn/ui - Accessible component library
  • Framer Motion - Smooth animations
  • Recharts - Data visualization
  • Lucide React - Beautiful icons

Data & APIs

  • CoinGecko API - Cryptocurrency data
  • SWR - Data fetching and caching
  • Axios - HTTP client
  • Next.js API Routes - Proxy and caching

Development Tools

  • Prettier - Code formatting (printWidth: 120)
  • ESLint - Code linting
  • TypeScript - Type checking

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/crypto-tracker.git
    cd crypto-tracker
  2. Install dependencies

    npm install
  3. Start the development server

    npm run dev
  4. Open your browser Navigate to http://localhost:3000

Build for Production

npm run build
npm start

πŸ“ Project Structure

crypto-tracker/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                    # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ api/               # API routes
β”‚   β”‚   β”‚   └── crypto/        # CoinGecko proxy
β”‚   β”‚   β”œβ”€β”€ cryptocurrencies/  # Cryptocurrencies page
β”‚   β”‚   β”œβ”€β”€ news/              # News page
β”‚   β”‚   β”œβ”€β”€ globals.css        # Global styles
β”‚   β”‚   β”œβ”€β”€ layout.tsx         # Root layout
β”‚   β”‚   └── page.tsx           # Home page
β”‚   β”œβ”€β”€ components/            # React components
β”‚   β”‚   β”œβ”€β”€ ui/               # shadcn/ui components
β”‚   β”‚   β”œβ”€β”€ crypto-list.tsx   # Cryptocurrency list
β”‚   β”‚   β”œβ”€β”€ price-chart.tsx   # Price charts
β”‚   β”‚   β”œβ”€β”€ news-feed.tsx     # News feed
β”‚   β”‚   └── navigation.tsx    # Navigation bar
β”‚   └── lib/                  # Utilities and configurations
β”‚       β”œβ”€β”€ api.ts           # API client and functions
β”‚       β”œβ”€β”€ hooks.ts         # Custom React hooks
β”‚       └── utils.ts         # Utility functions
β”œβ”€β”€ public/                   # Static assets
β”œβ”€β”€ .prettierrc              # Prettier configuration
β”œβ”€β”€ tailwind.config.ts       # TailwindCSS configuration
β”œβ”€β”€ next.config.ts           # Next.js configuration
└── package.json             # Dependencies and scripts

🎯 Available Scripts

# Development
npm run dev          # Start dev server with formatting
npm run build        # Build for production with formatting
npm start           # Start production server

# Code Quality
npm run format      # Format code with Prettier
npm run format:check # Check formatting without changes
npm run lint        # Run ESLint
npm run lint:fix    # Fix ESLint errors

πŸ”§ Configuration

Prettier

  • Print Width: 120 characters
  • Single Quotes: Enabled
  • Semicolons: Enabled
  • Trailing Commas: ES5 style

API Configuration

  • Rate Limiting: 2-second intervals between API calls
  • Caching: 60-second server-side cache
  • Fallback: Automatic proxy route fallback
  • Error Handling: Graceful degradation with cached data

🌟 Key Features Explained

Smart Rate Limiting

The application implements intelligent rate limiting to prevent API overload:

  • Server-side rate limiting (2-second intervals)
  • Client-side rate limiting (3-second intervals)
  • Automatic fallback to cached data on rate limits
  • Proper HTTP status codes (429) with retry instructions

Intelligent Caching

Multi-layer caching system for optimal performance:

  • Server-side cache (1-minute duration)
  • Client-side cache (60-second duration)
  • Cache headers for browser caching
  • Stale-while-revalidate strategy

Error Isolation

Robust error handling prevents cascading failures:

  • Each API call is independent
  • Fallback mechanisms for failed requests
  • Graceful degradation with cached data
  • User-friendly error messages

Responsive Design

Mobile-first approach with adaptive layouts:

  • Grid layouts that adapt to screen size
  • Touch-friendly interactions
  • Optimized for all devices
  • Dark/light mode support

πŸ”Œ API Integration

CoinGecko API

  • Base URL: https://api.coingecko.com/api/v3
  • Rate Limits: Free tier limitations handled gracefully
  • Endpoints Used:
    • /coins/markets - Market data
    • /coins/{id}/market_chart - Price history
    • /coins/{id} - Detailed coin information

Proxy Route

  • Path: /api/crypto
  • Features: Rate limiting, caching, error handling
  • Benefits: CORS handling, request optimization

🎨 Styling & Theming

TailwindCSS

  • Utility-first CSS framework
  • Custom design system with shadcn/ui
  • Dark/light mode support
  • Responsive breakpoints

Component Library

  • shadcn/ui: Accessible, customizable components
  • Radix UI: Headless UI primitives
  • Lucide React: Consistent icon system

πŸ“± Responsive Design

  • Mobile: Optimized touch interactions
  • Tablet: Adaptive grid layouts
  • Desktop: Full feature experience
  • Breakpoints: sm, md, lg, xl, 2xl

πŸ”’ Error Handling

  • API Errors: Graceful fallbacks and user notifications
  • Network Issues: Offline detection and retry mechanisms
  • Rate Limiting: Intelligent backoff and cached responses
  • Validation: Input validation and error boundaries

πŸš€ Performance Optimizations

  • Code Splitting: Automatic with Next.js
  • Image Optimization: Next.js Image component
  • Caching: Multi-layer caching strategy
  • Bundle Analysis: Optimized bundle sizes
  • Lazy Loading: Component and data lazy loading

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow the existing code style (Prettier configured)
  • Write TypeScript for type safety
  • Add proper error handling
  • Test on multiple screen sizes
  • Update documentation as needed

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support

If you have any questions or need help, please:

  • Open an issue on GitHub
  • Check the documentation
  • Review the code comments

Made with ❀️ and lots of β˜•

Built with Next.js 15, TypeScript, and TailwindCSS

About

A modern, real-time cryptocurrency tracking application built with Next.js 15, featuring live price data, interactive charts, and crypto news.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors