docs/contributing.mdx
Contributions are welcome! Whether you are fixing bugs, adding features, improving documentation, or suggesting ideas, your help makes this project better. This guide covers the contribution workflow, code conventions, and security requirements.
git clone https://github.com/YOUR_USERNAME/worldmonitor.git
cd worldmonitor
npm install
git checkout -b feature/your-feature-name
npm run dev
This project follows specific patterns to maintain consistency:
TypeScript
any where possibleconst over let, never use varArchitecture
src/services/) handle data fetching and business logicsrc/components/) handle UI renderingsrc/config/) contains static data and constantssrc/utils/) contain shared helper functionsPerformance
No Comments Policy
The dashboard handles untrusted data from dozens of external sources. Defense-in-depth measures prevent injection attacks and API abuse.
All user-visible content is sanitized before DOM insertion:
escapeHtml(str) // Encodes & < > " ' as HTML entities
sanitizeUrl(url) // Allows only http/https protocols
This applies to:
The mark element highlighting in search escapes text before wrapping matches, preventing injection via crafted search queries.
Serverless proxy functions validate and clamp all parameters:
| Endpoint | Validation |
|---|---|
/api/yahoo-finance | Symbol format [A-Za-z0-9.^=-], max 20 chars |
/api/coingecko | Coin IDs alphanumeric+hyphen, max 20 IDs |
/api/polymarket | Order field allowlist, limit clamped 1-100 |
This prevents upstream API abuse and rate limit exhaustion from malformed requests.
URL() constructor, only http: and https: protocols are permittedrel="noopener" to prevent reverse tabnappingeval(), all code is bundled at build timeescapeHtml() when rendering user-controlled or external datasanitizeUrl() for any URLs from external sourcesEnsure your code builds:
npm run build
Test your changes manually in the browser
Write a clear commit message:
Add earthquake magnitude filtering to map layer
- Adds slider control to filter by minimum magnitude
- Persists preference to localStorage
- Updates URL state for shareable links
Push to your fork:
git push origin feature/your-feature-name
Open a Pull Request with:
| Do | Don't |
|---|---|
| Focus on one feature or fix | Bundle unrelated changes |
| Follow existing code patterns | Introduce new frameworks without discussion |
| Keep changes minimal and targeted | Refactor surrounding code unnecessarily |
| Update README if adding features | Add features without documentation |
| Test edge cases | Assume happy path only |
Bug Fixes
New Features
Data Sources
Documentation
Security
PRs that don't follow the code style or introduce security issues will be asked to revise.
By contributing to World Monitor, you agree that your contributions are licensed under AGPL-3.0. See the License page for full terms, commercial licensing, and common scenarios.