Quick overview: CoinScope is a lightweight crypto dashboard built with React 19 + Vite. It pulls data from the CoinGecko API and uses React Router for navigation. The app lists top coins with search, sorting, and page-size controls, and each coin has a detail page with image, description, market stats, official links, and a 7‑day price chart powered by Chart.js + date-fns. Loading states and basic error handling are included, with Vite’s dev proxy handling CoinGecko CORS in local development.
- Coins list with search filter, sort options, and page size limit
- Coin details page with image, description, market stats, and links
- 7‑day price chart (Chart.js) with time scale and tooltips
- Loading states and basic error handling
- Vite dev proxy to avoid CORS during local development
- React 19 + Vite 7
- React Router 7
- Chart.js 4 + react-chartjs-2 5
- chartjs-adapter-date-fns + date-fns
- react-spinners for loaders
- ESLint (Vite’s React config)
Prerequisites
- Node.js 18+ and npm
Install
npm install
Environment
- Create
.envin the project root (already included here). For development, requests are proxied via Vite to avoid CORS:VITE_API_URL="/api/coins/markets?vs_currency=usd"VITE_COIN_API_URL="/api/coins"
Dev Server
npm run dev- Open
http://localhost:5173
Build & Preview
npm run buildnpm run preview
- Coin data is fetched from the CoinGecko API.
- During development,
vite.config.jsproxies/api/*tohttps://api.coingecko.com/api/v3to bypass browser CORS. - For production, you should serve through a backend or serverless proxy (or configure a reverse proxy) because CoinGecko does not include permissive CORS headers for direct browser calls.
src/pages/home.jsx– list view with filtering/sorting/limitsrc/pages/coin-details.jsx– single coin view + chart and linkssrc/components/CoinChart.jsx– 7‑day price chartsrc/components/Spinner.jsx– loading indicatorsrc/App.jsx– routes and top-level data fetchingvite.config.js– Vite plugins and dev proxy for/api
npm run dev– start dev servernpm run build– build for productionnpm run preview– preview production build
- Set
VITE_API_URLandVITE_COIN_API_URLappropriately if you deploy behind your own API gateway or serverless proxy. - Chart uses a time scale; ensure
chartjs-adapter-date-fnsremains installed and imported.