How tushallohar/cryptoverse works
This repository is a client-side React application built with Vite. Architecturally, it is a single-page crypto market/portfolio dashboard with a thin serverless API layer for proxying external services. The main runtime is the browser; the backend surface is limited to Vercel-hosted functions in api/.
The application shell is centered around src/main.jsx, src/app/routes.jsx, and src/layout/*. AppLayout, Header, and TickerBar provide the persistent frame, while route-level screens in src/pages/ and src/features/ fill the main content area. This suggests a shared chrome with many specialized analytics views rather than separate apps.
Routing is a key organizing boundary. src/app/routes.jsx maps a large set of pages such as market overview, coin detail, alerts, watchlist, portfolio, AI chat, arbitrage, backtesting, screener, heatmap, on-chain, and whale alerts. NotFoundPage handles unmatched routes, so the navigation layer is intentionally broad and feature-driven.
The app’s main business logic is split across feature components and reusable hooks. src/features/ contains higher-level screens like MarketPage and CoinDetailPage, while src/hooks/ contains the data-fetching and derived-state logic for live prices, market data, charting, alerts, page titles, and coin details. This keeps UI components relatively thin and pushes API and transformation logic into reusable modules.
External market data appears to come through utility clients in src/utils/, especially marketAPI.jsx and apiClient.jsx. Those utilities likely consume CoinGecko data directly or via the local proxy endpoints. The presence of api/coingecko-proxy.js indicates the repository uses a serverless proxy boundary to avoid browser-side CORS issues and to centralize outbound API access.
AI functionality is isolated as a separate subsystem. src/pages/AiChatPage.jsx talks to src/utils/geminiAPI.jsx, which in turn is backed by api/gemini-proxy.js. That creates a clean separation between the browser UI and the Gemini service, with the proxy acting as the trust boundary for any API keys or request shaping.
Client-side state is divided into shared context and persisted stores. src/context/ThemeContext.jsx and src/context/CurrencyContext.jsx manage app-wide preferences, while src/store/alertsStore.jsx, watchlistStore.jsx, and portfolioStore.jsx hold user-managed domain state. This points to a hybrid state model: React context for global settings and dedicated stores for domain data that likely needs persistence or cross-page access.
There is also a local persistence layer for chart data. src/utils/indexedDbCharts.jsx suggests chart history or time-series caches are stored in IndexedDB, which reduces repeat fetches and supports richer chart interactions. This is an important architectural boundary because it moves part of the data layer into the browser itself.
Visualization is a major subsystem. src/components/CandlestickChart.jsx, the various market pages, and utility hooks like useChart indicate charting and technical-analysis-style views are first-class. src/components/ui/Toast.jsx and src/components/ErrorBoundary.jsx provide shared UX infrastructure for transient feedback and fault isolation.
Styling and build tooling are standard but relevant to the architecture. The repo uses Tailwind CSS (tailwind.config.js, postcss.config.js) and Vite (vite.config.js) for fast SPA builds and development HMR. eslint.config.js defines code quality boundaries, while vercel.json ties the app to Vercel deployment and serverless function hosting.
Overall data flow is: user navigates a route, a page or feature component invokes a hook, the hook calls a utility/API client, the request may go through a local serverless proxy to an external service, and the result is normalized into shared state or rendered directly. User preferences and app-specific data then flow back through contexts/stores and, where needed, browser persistence such as IndexedDB.
Main entry points: routes.jsx Routes · hooks Data Hooks · AppLayout.jsx App Shell · pages Analytics Pages
Components 19
Browser app
Client-side React shell, routes, screens, and shared presentation components.
- Routes · Top-level route registry and navigation boundaries.
src/app/routes.jsx - App Shell · Persistent frame for the SPA content area.
src/layout/AppLayout.jsx - Header · Top navigation and app-level controls.
src/layout/Header.jsx - Ticker Bar · Persistent market ticker displayed across screens.
src/layout/TickerBar.jsx - Market View · Primary market overview surface.
src/features/MarketPage.jsx - Coin Detail · Per-asset detail and analytics surface.
src/features/CoinDetailPage.jsx - Analytics Pages · Specialized market tools and dashboards such as watchlist, portfolio, screener, heatmap, on-chain, and backtesting.
src/pages - AI Chat · Browser UI for conversational AI features.
src/pages/AiChatPage.jsx - Candlestick Chart · Primary visualization for price history and technical analysis.
src/components/CandlestickChart.jsx - Feedback UI · Reusable error and toast presentation components.
src/components/ErrorBoundary.jsx
State & data
Hooks, stores, context, and utilities that drive fetching and client state.
- App Contexts · Theme and currency preference providers.
src/context - Domain Stores · Persistent watchlist, alerts, and portfolio state.
src/store - Data Hooks · Shared fetching and derived-state hooks for live prices, market data, charts, alerts, and titles.
src/hooks - API Clients · Browser-side clients that normalize market and AI service calls.
src/utils - Chart Cache · Local browser persistence for chart history and time-series reuse.
src/utils/indexedDbCharts.jsx - Market API · External market-data access layer.
src/utils/marketAPI.jsx - Gemini API · Client wrapper for AI chat requests.
src/utils/geminiAPI.jsx
Serverless API
Vercel-hosted proxy functions for external services.
- CoinGecko Proxy · Proxy endpoint for external market-data requests.
api/coingecko-proxy.js - Gemini Proxy · Proxy endpoint for AI service requests.
api/gemini-proxy.js
Connections 23
- Routes → App Shell: mounts · Routes are rendered inside the persistent app shell.
- App Shell → Header: contains · Shell includes the global header.
- App Shell → Ticker Bar: contains · Shell includes the live ticker bar.
- Routes → Market View: renders · One route target is the market overview feature.
- Routes → Coin Detail: renders · One route target is the coin detail feature.
- Routes → Analytics Pages: renders · Many routes land in specialized analytics pages.
- Routes → AI Chat: renders · AI chat is exposed as its own route.
- Market View → Data Hooks: uses · Market view depends on shared market data hooks.
- Coin Detail → Data Hooks: uses · Coin detail view depends on shared data hooks.
- Market View → Candlestick Chart: shows · Market view uses chart visualization components.
- Coin Detail → Candlestick Chart: shows · Coin detail view uses chart visualization components.
- Analytics Pages → Domain Stores: shares · Analytics surfaces reuse domain state stores where relevant.
- Analytics Pages → Data Hooks: uses · Analytics pages compose shared hooks for derived data.
- AI Chat → Gemini API: calls · AI chat uses the Gemini client wrapper.
- Data Hooks → API Clients: delegates · Hooks delegate transport and normalization to utility clients.
- API Clients → Market API: includes · Market client is the primary external data entry point.
- API Clients → Gemini API: includes · Gemini client is the AI entry point.
- Market API → CoinGecko Proxy: proxies through · Market data requests go through the CoinGecko serverless boundary.
- Gemini API → Gemini Proxy: proxies through · AI requests go through the Gemini serverless boundary.
- Data Hooks → Chart Cache: persists · Chart-related hooks use IndexedDB-backed persistence.
- App Contexts → App Shell: provides · Global preferences are made available through the app shell.
- Domain Stores → Analytics Pages: feeds · Persistent domain state feeds portfolio, watchlist, and alerts pages.
- Feedback UI → Routes: guards · Shared error handling protects route-level rendering.