# vinilnaik3705/kryonex architecture

> Architecture diagram of the GitHub repository vinilnaik3705/kryonex, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vinilnaik3705/kryonex
- Repository: https://github.com/vinilnaik3705/kryonex

## Overview

Kryonex is a crypto-market trading simulator. Users enter through the React app, view market and news data, analyze assets, and manage simulated trades and portfolios; authenticated simulation state syncs through the Express API. The backend also provides AI analysis, PayPal checkout, and live WebSocket market feeds. The graph combines excerpted calls and imports with README-documented capabilities; several UI and backend modules were not sampled, so their internal call paths are omitted where evidence is unavailable.

Main entry points: [`backend/server.js`](https://github.com/vinilnaik3705/kryonex/blob/main/backend/server.js) (Express API server), [`frontend/src/App.jsx`](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/App.jsx) (React app routes), [`frontend/src/hooks/useWalletAndPortfolio.js`](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/hooks/useWalletAndPortfolio.js) (Wallet and holdings), [`frontend/src/pages/Trade.jsx`](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Trade.jsx) (Trade)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Trading interface"]
  node_app["React app routes<br/>[App.jsx]"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_markets["Markets<br/>[Markets.jsx]"]
  node_trade["Trade<br/>[Trade.jsx]"]
  node_portfolio["Portfolio<br/>[Portfolio.jsx]"]
  node_watchlist["Watchlist<br/>[Watchlist.jsx]"]
  node_heatmap["Heatmap view"]
  node_chart["Candlestick chart"]
  node_payment["Payment page<br/>[Payment.jsx]"]
  node_paymentservice["Payment client<br/>[paymentService.js]"]
  node_chatbot["AI companion<br/>[CryptoChatbot.jsx]"]
end

subgraph group_market["Market intelligence"]
  node_cryptoroutes["Crypto endpoints<br/>[cryptoRoutes.js]"]
  node_cryptoapi["Crypto data integration<br/>[cryptoAPI.js]"]
  node_news["News integration<br/>[newsAPI.js]"]
  node_newsroutes["News endpoints<br/>[newsRoutes.js]"]
  node_ai["AI analysis endpoint<br/>[aiRoutes.js]"]
  node_livefeed["Binance market feed"]
  node_websocket["WebSocket gateway"]
end

subgraph group_simulation["Simulation and accounts"]
  node_wallet["Wallet and holdings"]
  node_auth["Authentication context<br/>[AuthContext.jsx]"]
  node_simroutes["Simulation endpoints"]
  node_simmodel["Simulation state model<br/>[SimulationState.js]"]
end

subgraph group_platform["API platform"]
  node_backend["Express API server<br/>[server.js]"]
  node_cache[("Response cache<br/>[cacheService.js]")]
  node_database[("PostgreSQL<br/>[db.js]")]
  node_paypal["PayPal checkout API"]
  node_groq["Groq AI"]
end

node_user(("Trader"))

node_user -->|"uses"| node_app
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_markets
node_app -->|"routes to"| node_trade
node_app -->|"routes to"| node_portfolio
node_app -->|"routes to"| node_watchlist
node_app -->|"routes to"| node_payment
node_markets -.->|"renders"| node_heatmap
node_trade -.->|"renders"| node_chart
node_trade -.->|"updates"| node_wallet
node_portfolio -.->|"uses"| node_wallet
node_wallet -->|"reads identity"| node_auth
node_wallet -->|"syncs state"| node_backend
node_wallet -->|"fetches prices"| node_backend
node_payment -.->|"uses"| node_paymentservice
node_paymentservice -->|"calls API"| node_backend
node_backend -->|"mounts"| node_cryptoroutes
node_backend -->|"mounts"| node_newsroutes
node_backend -->|"mounts"| node_ai
node_backend -->|"mounts"| node_simroutes
node_backend -->|"initializes"| node_websocket
node_cryptoroutes -->|"calls"| node_cryptoapi
node_cryptoapi -->|"uses cache"| node_cache
node_newsroutes -->|"calls"| node_news
node_simroutes -->|"reads and writes"| node_simmodel
node_simroutes -->|"checks connection"| node_database
node_simmodel -->|"persists state"| node_database
node_ai -->|"requests analysis"| node_groq
node_chatbot -.->|"requests analysis"| node_ai
node_payment -.->|"checkout flow"| node_paypal
node_websocket -->|"streams prices"| node_livefeed

click node_app "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/App.jsx"
click node_dashboard "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Dashboard.jsx"
click node_markets "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Markets.jsx"
click node_trade "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Trade.jsx"
click node_portfolio "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Portfolio.jsx"
click node_watchlist "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Watchlist.jsx"
click node_heatmap "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/components/ui/CryptoHeatmapGrid.jsx"
click node_chart "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/components/ui/CandlestickChart.jsx"
click node_wallet "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/hooks/useWalletAndPortfolio.js"
click node_auth "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/context/AuthContext.jsx"
click node_payment "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Payment.jsx"
click node_paymentservice "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/services/paymentService.js"
click node_backend "https://github.com/vinilnaik3705/kryonex/blob/main/backend/server.js"
click node_cryptoroutes "https://github.com/vinilnaik3705/kryonex/blob/main/backend/routes/cryptoRoutes.js"
click node_cryptoapi "https://github.com/vinilnaik3705/kryonex/blob/main/backend/api-integration/cryptoAPI.js"
click node_cache "https://github.com/vinilnaik3705/kryonex/blob/main/backend/services/cacheService.js"
click node_news "https://github.com/vinilnaik3705/kryonex/blob/main/backend/api-integration/newsAPI.js"
click node_newsroutes "https://github.com/vinilnaik3705/kryonex/blob/main/backend/routes/newsRoutes.js"
click node_ai "https://github.com/vinilnaik3705/kryonex/blob/main/backend/routes/aiRoutes.js"
click node_chatbot "https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/components/CryptoChatbot.jsx"
click node_simroutes "https://github.com/vinilnaik3705/kryonex/blob/main/backend/routes/simulationRoutes.js"
click node_simmodel "https://github.com/vinilnaik3705/kryonex/blob/main/backend/models/SimulationState.js"
click node_database "https://github.com/vinilnaik3705/kryonex/blob/main/backend/config/db.js"
click node_websocket "https://github.com/vinilnaik3705/kryonex/blob/main/backend/services/websocketService.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_dashboard,node_markets,node_trade,node_portfolio,node_watchlist,node_heatmap,node_chart,node_payment,node_paymentservice,node_chatbot toneBlue
class node_cryptoroutes,node_cryptoapi,node_news,node_newsroutes,node_ai,node_livefeed,node_websocket toneAmber
class node_wallet,node_auth,node_simroutes,node_simmodel toneMint
class node_backend,node_cache,node_database,node_paypal,node_groq toneRose
class node_user toneIndigo
```

## Components

### Trading interface

- [React app routes](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Dashboard](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Markets](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Markets.jsx): `frontend/src/pages/Markets.jsx`
- [Trade](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Trade.jsx): `frontend/src/pages/Trade.jsx`
- [Portfolio](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Portfolio.jsx): `frontend/src/pages/Portfolio.jsx`
- [Watchlist](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Watchlist.jsx): `frontend/src/pages/Watchlist.jsx`
- [Heatmap view](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/components/ui/CryptoHeatmapGrid.jsx): `frontend/src/components/ui/CryptoHeatmapGrid.jsx`
- [Candlestick chart](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/components/ui/CandlestickChart.jsx): `frontend/src/components/ui/CandlestickChart.jsx`
- [Payment page](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/pages/Payment.jsx): `frontend/src/pages/Payment.jsx`
- [Payment client](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/services/paymentService.js): `frontend/src/services/paymentService.js`
- [AI companion](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/components/CryptoChatbot.jsx): `frontend/src/components/CryptoChatbot.jsx`

### Market intelligence

- [Crypto endpoints](https://github.com/vinilnaik3705/kryonex/blob/main/backend/routes/cryptoRoutes.js): `backend/routes/cryptoRoutes.js`
- [Crypto data integration](https://github.com/vinilnaik3705/kryonex/blob/main/backend/api-integration/cryptoAPI.js): `backend/api-integration/cryptoAPI.js`
- [News integration](https://github.com/vinilnaik3705/kryonex/blob/main/backend/api-integration/newsAPI.js): `backend/api-integration/newsAPI.js`
- [News endpoints](https://github.com/vinilnaik3705/kryonex/blob/main/backend/routes/newsRoutes.js): `backend/routes/newsRoutes.js`
- [AI analysis endpoint](https://github.com/vinilnaik3705/kryonex/blob/main/backend/routes/aiRoutes.js): `backend/routes/aiRoutes.js`
- **Binance market feed**
- [WebSocket gateway](https://github.com/vinilnaik3705/kryonex/blob/main/backend/services/websocketService.js): `backend/services/websocketService.js`

### Simulation and accounts

- [Wallet and holdings](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/hooks/useWalletAndPortfolio.js): `frontend/src/hooks/useWalletAndPortfolio.js`
- [Authentication context](https://github.com/vinilnaik3705/kryonex/blob/main/frontend/src/context/AuthContext.jsx): `frontend/src/context/AuthContext.jsx`
- [Simulation endpoints](https://github.com/vinilnaik3705/kryonex/blob/main/backend/routes/simulationRoutes.js): `backend/routes/simulationRoutes.js`
- [Simulation state model](https://github.com/vinilnaik3705/kryonex/blob/main/backend/models/SimulationState.js): `backend/models/SimulationState.js`

### API platform

- [Express API server](https://github.com/vinilnaik3705/kryonex/blob/main/backend/server.js): `backend/server.js`
- [Response cache](https://github.com/vinilnaik3705/kryonex/blob/main/backend/services/cacheService.js): `backend/services/cacheService.js`
- [PostgreSQL](https://github.com/vinilnaik3705/kryonex/blob/main/backend/config/db.js): `backend/config/db.js`
- **PayPal checkout API**
- **Groq AI**

### Other components

- **Trader**

## Connections

- Trader → React app routes: uses (evidence: `README.md`)
- React app routes → Dashboard: routes to (evidence: `frontend/src/App.jsx`)
- React app routes → Markets: routes to (evidence: `frontend/src/App.jsx`)
- React app routes → Trade: routes to (evidence: `frontend/src/App.jsx`)
- React app routes → Portfolio: routes to (evidence: `frontend/src/App.jsx`)
- React app routes → Watchlist: routes to (evidence: `frontend/src/App.jsx`)
- React app routes → Payment page: routes to (evidence: `frontend/src/App.jsx`)
- Markets → Heatmap view: renders
- Trade → Candlestick chart: renders
- Trade → Wallet and holdings: updates
- Portfolio → Wallet and holdings: uses
- Wallet and holdings → Authentication context: reads identity (evidence: `frontend/src/hooks/useWalletAndPortfolio.js`)
- Wallet and holdings → Express API server: syncs state (evidence: `frontend/src/hooks/useWalletAndPortfolio.js`)
- Wallet and holdings → Express API server: fetches prices (evidence: `frontend/src/hooks/useWalletAndPortfolio.js`)
- Payment page → Payment client: uses
- Payment client → Express API server: calls API (evidence: `frontend/src/services/paymentService.js`)
- Express API server → Crypto endpoints: mounts (evidence: `backend/server.js`)
- Express API server → News endpoints: mounts (evidence: `backend/server.js`)
- Express API server → AI analysis endpoint: mounts (evidence: `backend/server.js`)
- Express API server → Simulation endpoints: mounts (evidence: `backend/server.js`)
- Express API server → WebSocket gateway: initializes (evidence: `backend/server.js`)
- Crypto endpoints → Crypto data integration: calls (evidence: `backend/routes/cryptoRoutes.js`)
- Crypto data integration → Response cache: uses cache (evidence: `backend/api-integration/cryptoAPI.js`)
- News endpoints → News integration: calls (evidence: `backend/routes/newsRoutes.js`)
- Simulation endpoints → Simulation state model: reads and writes (evidence: `backend/routes/simulationRoutes.js`)
- Simulation endpoints → PostgreSQL: checks connection (evidence: `backend/routes/simulationRoutes.js`)
- Simulation state model → PostgreSQL: persists state (evidence: `backend/models/SimulationState.js`)
- AI analysis endpoint → Groq AI: requests analysis (evidence: `backend/routes/aiRoutes.js`)
- AI companion → AI analysis endpoint: requests analysis
- Payment page → PayPal checkout API: checkout flow
- WebSocket gateway → Binance market feed: streams prices (evidence: `backend/services/websocketService.js`)
