How baloo8721/web3-real-estate-calculator works
Project type and purpose
• This is a static, single-page “full-stack” application in the sense that it has a frontend plus a tiny automated data-refresh backend task, but it is really a client-only web app hosted on GitHub Pages.
• Purpose: perform various real-estate and crypto-currency calculations (mortgage, seller, investor, crypto) with multilingual UI and Web3 integrations.
File structure
• Top-level web assets:
• index.html, test.html – entry points
• styles.css – stylesheet
• script.js, cryptoCalculator.js, walletSearch.js – main UI logic
• images/ – static images
• wallet.json, rates.json – local JSON data stores
• Automated data fetch:
• scripts/fetch-rates.js – Node script to retrieve live crypto rates
• .github/workflows/update-rates.yml – scheduled GitHub Action that runs fetch-rates.js and commits a new rates.json
• Deployment:
• .github/workflows/deploy.yml – CI pipeline to push the site to GitHub Pages
• Configuration:
• package.json, package-lock.json – Node dependencies (for the fetch script)
• .gitignore – ignored files
Extract insights from the README
• Static web app with mortgage/investor/crypto calculators
• Live on GitHub Pages
• Multilingual, responsive, Web3 enabled
Main components
a. Frontend (Client)
• index.html + CSS + images
• JavaScript modules:
– script.js (UI initialization, event handling, language switching)
– cryptoCalculator.js (crypto-related calculation logic)
– walletSearch.js (load and search wallet.json)
• Local data stores (JSON files): rates.json, wallet.json
b. Data Update Service (Backend Task)
• scripts/fetch-rates.js fetches live crypto rates from an external API
• Runs on schedule via GitHub Actions (update-rates.yml)
• Commits updated rates.json back into the repo
c. Hosting / CI/CD
• GitHub Actions (deploy.yml) builds and publishes to GitHub Pages
• Live URL on baloo8721.github.io
d. External Dependencies
• Crypto-rates API (e.g., CoinGecko)
• GitHub Pages for static hosting
Relationships & interactions
• On push or schedule: update-rates.yml → run fetch-rates.js → external API → new rates.json → commit
• On any commit to main: deploy.yml → publish index.html + assets to GitHub Pages
• At runtime in user’s browser: index.html loads → script.js pulls rates.json & wallet.json → cryptoCalculator.js & walletSearch.js execute calculations → UI updates
Architectural patterns and design principles
• “Jamstack” style: pre-built markup (HTML), APIs (static JSON), and client JS
• CI as backend: GitHub Actions replace a traditional server
• Separation of concerns:
• Data acquisition (fetch-rates)
• Presentation and logic (script.js + calculator modules)
• Static content (HTML/CSS/images)