How m-lab/mlab-speedtest works
This repo is a static web application (HTML/CSS/vanilla JS) that implements https://speed.measurementlab.net/. It is built with Node-based build scripts into a dist/ directory and deployed to Firebase Hosting via GitHub Actions.
So the “system” here is not a multi-service backend; it’s primarily:
• a client-side app running in the browser
• a build pipeline that generates deployable static assets
• a CI/CD pipeline that deploys to Firebase Hosting
• a localization workflow (PO → JSON) used at build time + dynamic language selection at runtime
• Build-time vs runtime responsibilities
• Hosting / CDN layer (Firebase Hosting)
• Where translations come from and how they are consumed
• Deployment environments (Sandbox vs Production) and triggers
Top-level
• src/ – authoritative source for the website: HTML, CSS, JS, assets
• scripts/ – build tooling:
• scripts/build.js – likely orchestrates building dist/ (copying assets, bundling/minifying if any, generating translation outputs, etc.)
• scripts/po-to-json.js – converts translations/languages/*.po → JSON for runtime consumption
• translations/
• translations/source/application.pot – translation template
• translations/languages/*.po – language files imported from Transifex
• Firebase hosting config:
• firebase.json, .firebaserc – hosting targets/projects, rewrites, etc.
• CI/CD:
• .github/workflows/firebase-hosting-merge.yml – deploy on merge to main (Production)
• .github/workflows/firebase-hosting-pull-request.yml – deploy preview (Sandbox)
• package.json, package-lock.json – Node toolchain (build dependencies, scripts)
src/
• src/index.html, src/404.html – entry + error page
• src/css/main.css + src/css/images/ – styling assets
• src/assets/fonts, src/assets/images – static assets
• src/js/
• app.js – main app wiring
• gauge.js – likely the speed gauge visualization component
• i18n.js – runtime language selection/loading translated strings
README-derived architecture and flows to capture
Key runtime behavior:
• The built site runs from dist/ and is served statically (locally via python3 -m http.server -d dist).
• Localization:
• build converts .po → JSON in dist/translations/
• runtime i18n.js selects language via:
• ?lang= query param
• localStorage
• browser preference
Key deployment behavior:
• GitHub Actions → Firebase Hosting
• PR (same repo) → Sandbox (https://mlab-sandbox.web.app)
• merge to main → Production (https://speed.measurementlab.net)
External dependency worth showing explicitly:
• Transifex (OTF Localization Lab) as the upstream translation management system (even though it’s not automated in this repo, it’s a real dependency in the overall system lifecycle).
Runtime (Browser + Hosting)
This will prevent the common mistake of treating build scripts as runtime services.
Development / Source
• Developer workstation
• runs npm install, npm run build
• Repo source tree
• src/ (HTML/CSS/JS/assets)
• translations/languages/*.po
• scripts/*.js
• firebase.json / .firebaserc
• Transifex (external)
• produces .po files that get downloaded and committed into translations/languages/
Build (local + CI)
• Node.js build pipeline
• scripts/build.js
• scripts/po-to-json.js
• Build output: dist/
• static site assets
• dist/translations/*.json (derived artifacts)
Deploy + Hosting
• GitHub Actions
• PR workflow → deploy to Firebase Hosting (Sandbox)
• merge workflow → deploy to Firebase Hosting (Production)
• Firebase Hosting
• serves dist/ as static hosting for each environment/URL
Runtime (what happens in the user’s browser)
• User browser
• loads index.html, CSS, JS
• App modules
• app.js (app initialization / test orchestration)
• gauge.js (UI viz)
• i18n.js (language selection + fetch translation JSON)
• Browser state
• localStorage (language persistence)
• URL query ?lang= (override)
• navigator.language (fallback)
• Static site architecture: all runtime logic executes client-side; hosting serves static artifacts.
• Build artifact separation: src/ and translations/ are inputs; dist/ is the deployable output.
• Internationalization pipeline:
• build-time conversion (PO → JSON)
• runtime language negotiation (query param → localStorage → browser preference)
• Environment-based deployment:
• same artifact type deployed to two Firebase Hosting targets/environments
• deployments gated by GitHub Actions triggers
Labels (be explicit)
• “scripts/po-to-json.js”
• “scripts/build.js”
• “src/js/i18n.js”
• “Firebase Hosting (Sandbox: mlab-sandbox.web.app)”
• “Firebase Hosting (Prod: speed.measurementlab.net)”
• “build step”
• “deploy artifact”
• “HTTP GET static assets”
• “HTTP GET translations JSON”
• “language selection precedence”
Use this as the initial layout (then refine with exact filenames/paths):
• External: Transifex
→ **translations/languages/*.po** (repo)
• Repo: src/**, scripts/**, translations/**, firebase.json
→ Node Build (scripts/build.js + scripts/po-to-json.js)
→ Artifact: dist/ (includes dist/translations/*.json)
• CI/CD:
• GitHub Actions PR workflow → Firebase Hosting (Sandbox)
• GitHub Actions merge workflow → Firebase Hosting (Production)
• Runtime:
• User Browser ←(HTTP)→ Firebase Hosting
• Browser loads app.js, gauge.js, i18n.js
• i18n.js reads ?lang=, localStorage, navigator.language
• i18n.js fetches dist/translations/<lang>.json
That’s the “most components possible” breakdown without inventing services that aren’t present.