-
Notifications
You must be signed in to change notification settings - Fork 142
Tech Stack Overview doc #350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| # Tech Stack Overview | ||
|
|
||
| The Stellar Dashboard can be viewed at | ||
| [dashboard.stellar.org](https://dashboard.stellar.org). | ||
|
|
||
| ## Architecture at a Glance | ||
|
|
||
| This is a **full-stack JavaScript/TypeScript application** with: | ||
|
|
||
| - **Frontend**: React SPA (Single Page Application) | ||
| - **Backend**: Node.js/Express API server | ||
| - **Build Tool**: Vite | ||
| - **Package Manager**: npm | ||
|
|
||
| ## Frontend Stack | ||
|
|
||
| **Purpose**: Dashboard UI displaying Stellar network metrics and data | ||
| visualization | ||
|
|
||
| We use `muicss` library for the UI. It hasn't been updated in years, so it holds | ||
| us back from upgrading all dependencies to the latest versions. | ||
|
|
||
| `react-d3-components` library was replaced by `d3`, which is used to build | ||
| charts. | ||
|
|
||
| ## Backend Stack | ||
|
|
||
| **Purpose**: Serve API data, cache Stellar network metrics, proxy requests, and | ||
| connect to BigQuery | ||
|
|
||
| ### Key Responsibilities | ||
|
|
||
| - **Cache Updates**: Periodically updates Stellar network data (lumens supply, | ||
| ledger stats) | ||
| - **API Proxy**: Proxies requests to `/api/*` (via Vite in dev, Express in | ||
| production) | ||
| - **Data Aggregation**: Fetches data from Stellar API and BigQuery | ||
| - **Rate limiting**: Rate limit is IP based and there are both endpoint-specific | ||
| and global limits | ||
|
|
||
| ### Environment Variables | ||
|
|
||
| ```bash | ||
| UPDATE_DATA=true # Enable periodic cache updates | ||
| DEV=true # Development mode | ||
quietbits marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| BQ_PROJECT_ID=... # BigQuery project ID used by backend/bigQuery.ts | ||
| REDIS_URL=... # Production Redis connection URL used by backend/redis.ts | ||
| PORT=5000 # Server port configuration (defaults to 5000) used by backend/routes.ts | ||
| TRUST_PROXY=... # Trusted proxy CIDRs configuration used by backend/routes.ts | ||
|
|
||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## Pinned Security Resolutions | ||
|
|
||
| ```json | ||
| { | ||
| "resolutions": { | ||
| "**/ua-parser-js": "0.7.28" // Prevents vulnerable versions | ||
| } | ||
| } | ||
quietbits marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| This pins `ua-parser-js` to prevent dependency vulnerabilities. | ||
|
|
||
| --- | ||
|
|
||
| ## External Services & APIs | ||
|
|
||
| ### Stellar Network | ||
|
|
||
| - **Stellar SDK** queries the Stellar blockchain | ||
| - Fetches account data, transaction metrics, network stats | ||
|
|
||
| ### Google Cloud BigQuery | ||
|
|
||
| - Stores historical ledger & transaction data | ||
| - Used for long-term trend analysis | ||
| - Requires service account JSON configuration | ||
|
|
||
| ### Redis Cache | ||
|
|
||
| - **Port**: 6379 (default) | ||
| - **Purpose**: Store computed metrics to reduce repeated API calls | ||
| - **Required for**: Backend data updates | ||
|
|
||
| --- | ||
|
|
||
| ## Build & Deployment | ||
|
|
||
| ### Deployment Platforms | ||
|
|
||
| - **Heroku**: Configured via `Procfile` and `heroku-postbuild` script | ||
| - **Docker**: `Dockerfile` available for containerized deployment | ||
|
|
||
| ### Environment | ||
|
|
||
| - **Node.js version**: 22.x (specified in `engines`) | ||
|
|
||
| --- | ||
|
|
||
| ## Key Architectural Patterns | ||
|
|
||
| ### Frontend-Backend Communication | ||
|
|
||
| ``` | ||
| Frontend (React) | ||
| ↓ (HTTP requests via Axios) | ||
| Vite Dev Proxy (dev) / Express (prod) | ||
| ↓ (backend/routes.ts) | ||
| External APIs (Stellar SDK, BigQuery, Redis) | ||
| ``` | ||
|
|
||
| ### Data Flow for Metrics | ||
|
|
||
| 1. Backend periodically fetches data from Stellar API | ||
| 2. Computes aggregates (e.g., lumens in circulation) | ||
| 3. Caches results in Redis | ||
| 4. Frontend requests cached data via `/api/*` endpoints | ||
| 5. Charts and widgets update in real-time | ||
|
|
||
| ### Caching Strategy | ||
|
|
||
| - **Redis**: Primary cache for hot data | ||
| - **In-memory**: Some computed values cached in process | ||
| - **Update frequency**: 10-minute intervals (configurable) | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,7 +50,6 @@ | |
| "morgan": "^1.8.2", | ||
| "muicss": "^0.9.5", | ||
| "react": "^18.2.0", | ||
| "react-d3-components": "^0.9.1", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is no longer used. |
||
| "react-dom": "^18.2.0", | ||
| "redis": "^4.0.1" | ||
| }, | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.