|
| 1 | +# Tech Stack Overview |
| 2 | + |
| 3 | +The Stellar Dashboard can be viewed at |
| 4 | +[dashboard.stellar.org](dashboard.stellar.org). |
| 5 | + |
| 6 | +## Architecture at a Glance |
| 7 | + |
| 8 | +This is a **full-stack JavaScript/TypeScript application** with: |
| 9 | + |
| 10 | +- **Frontend**: React SPA (Single Page Application) |
| 11 | +- **Backend**: Node.js/Express API server |
| 12 | +- **Build Tool**: Vite |
| 13 | +- **Package Manager**: npm |
| 14 | + |
| 15 | +## Frontend Stack |
| 16 | + |
| 17 | +**Purpose**: Dashboard UI displaying Stellar network metrics and data |
| 18 | +visualization |
| 19 | + |
| 20 | +We use `muicss` library for the UI. It hasn't been updated in years, so it holds |
| 21 | +us back from upgrading all dependencies to the latest versions. |
| 22 | + |
| 23 | +`react-d3-components` library was replaced by `d3`, which is used to build |
| 24 | +charts. |
| 25 | + |
| 26 | +## Backend Stack |
| 27 | + |
| 28 | +**Purpose**: Serve API data, cache Stellar network metrics, proxy requests, and |
| 29 | +connect to BigQuery |
| 30 | + |
| 31 | +### Key Responsibilities |
| 32 | + |
| 33 | +- **Cache Updates**: Periodically updates Stellar network data (lumens supply, |
| 34 | + ledger stats) |
| 35 | +- **API Proxy**: Proxies requests to `/api/*` (via Vite in dev, Express in |
| 36 | + production) |
| 37 | +- **Data Aggregation**: Fetches data from Stellar API and BigQuery |
| 38 | +- **Rate limiting**: Rate limit is IP based and there are both endpoint-specific |
| 39 | + and global limits |
| 40 | + |
| 41 | +### Environment Variables |
| 42 | + |
| 43 | +```bash |
| 44 | +UPDATE_DATA=true # Enable periodic cache updates |
| 45 | +DEV=true # Development mode |
| 46 | +``` |
| 47 | + |
| 48 | +--- |
| 49 | + |
| 50 | +## Pinned Security Resolutions |
| 51 | + |
| 52 | +```json |
| 53 | +{ |
| 54 | + "resolutions": { |
| 55 | + "**/ua-parser-js": "0.7.28" // Prevents vulnerable versions |
| 56 | + } |
| 57 | +} |
| 58 | +``` |
| 59 | + |
| 60 | +This pins `ua-parser-js` to prevent dependency vulnerabilities. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## External Services & APIs |
| 65 | + |
| 66 | +### Stellar Network |
| 67 | + |
| 68 | +- **Stellar SDK** queries the Stellar blockchain |
| 69 | +- Fetches account data, transaction metrics, network stats |
| 70 | + |
| 71 | +### Google Cloud BigQuery |
| 72 | + |
| 73 | +- Stores historical ledger & transaction data |
| 74 | +- Used for long-term trend analysis |
| 75 | +- Requires service account JSON configuration |
| 76 | + |
| 77 | +### Redis Cache |
| 78 | + |
| 79 | +- **Port**: 6379 (default) |
| 80 | +- **Purpose**: Store computed metrics to reduce repeated API calls |
| 81 | +- **Required for**: Backend data updates |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## Build & Deployment |
| 86 | + |
| 87 | +### Deployment Platforms |
| 88 | + |
| 89 | +- **Heroku**: Configured via `Procfile` and `heroku-postbuild` script |
| 90 | +- **Docker**: `Dockerfile` available for containerized deployment |
| 91 | + |
| 92 | +### Environment |
| 93 | + |
| 94 | +- **Node.js version**: 22.x (specified in `engines`) |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +## Key Architectural Patterns |
| 99 | + |
| 100 | +### Frontend-Backend Communication |
| 101 | + |
| 102 | +``` |
| 103 | +Frontend (React) |
| 104 | + ↓ (HTTP requests via Axios) |
| 105 | +Vite Dev Proxy (dev) / Express (prod) |
| 106 | + ↓ (backend/routes.ts) |
| 107 | +External APIs (Stellar SDK, BigQuery, Redis) |
| 108 | +``` |
| 109 | + |
| 110 | +### Data Flow for Metrics |
| 111 | + |
| 112 | +1. Backend periodically fetches data from Stellar API |
| 113 | +2. Computes aggregates (e.g., lumens in circulation) |
| 114 | +3. Caches results in Redis |
| 115 | +4. Frontend requests cached data via `/api/*` endpoints |
| 116 | +5. Charts and widgets update in real-time |
| 117 | + |
| 118 | +### Caching Strategy |
| 119 | + |
| 120 | +- **Redis**: Primary cache for hot data |
| 121 | +- **In-memory**: Some computed values cached in process |
| 122 | +- **Update frequency**: 10-minute intervals (configurable) |
0 commit comments