A very fast static spatial index for 2D points and rectangles in JavaScript 🌱
1.6k
Stars
63
Forks
6
Open issues
11
Contributors
AI Analysis
Flatbush is a static spatial indexing library for 2D points and rectangles in JavaScript, implementing a packed Hilbert R-tree algorithm. It excels for applications requiring fast spatial queries over millions of objects, particularly in mapping, data visualization, and computational geometry—useful for backend developers and library authors who need high-performance spatial indexing, but not for general-purpose data storage or dynamic datasets requiring insertions/deletions.
Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.
AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.
Static spatial index library for JavaScript; fast alternative to RBush when data doesn't change post-index
Flatbush is a JavaScript library implementing packed Hilbert R-tree spatial indexing for 2D points and rectangles. It trades mutability for speed and memory efficiency, making it suited for large-scale static datasets in mapping, visualization, and computational geometry. Created by the author of RBush, it targets developers who can index data once and query many times. Adoption appears concentrated in mapping libraries and geospatial tooling rather than mainstream enterprise use.
Built in 2018 by Mapbox engineer Vladislav Agafonkin, who also created RBush and Leaflet. Positioned as a specialized variant of RBush optimized for immutable, pre-indexed spatial data, leveraging the packed Hilbert curve for better cache locality and memory compaction.
1,590 stars accumulated over 8 years at steady, modest pace (1 star in last 7 days). Growth appears organic within geospatial and mapping communities rather than exponential. Sibling project RBush has 1.2x more stars, suggesting Flatbush serves a narrower use case. No major adoption spikes evident from metadata; success measured by niche penetration rather than viral adoption.
Adoption not verified through concrete documentation. README does not list known users or case studies. Strong presence in Mapbox ecosystem (author affiliation) and geospatial tools (geoflatbush extension exists) suggests real-world use, but no NPM download metrics, production credits, or quantified user counts provided. Indirect evidence: 1.6K stars and 63 forks suggest some adoption, but insufficient to measure scale or penetration.
Based on README, Flatbush uses a packed Hilbert R-tree stored as a single contiguous array buffer. Appears to support transferable objects for Web Workers and optional SharedArrayBuffer for multi-threaded access. Configurable node size, array type (Float64Array, Int32Array), and buffer type suggest performance tuning for specific workloads. Implementation details not inspectable from README alone.
README mentions build status badge linked to GitHub Actions but does not document test coverage percentage or test strategy. Presence of CI workflow suggests active testing, but depth unknown.
Last push 2026-06-09 (23 days prior to analysis date), indicating active maintenance. Regular commit activity inferred from CI badge presence. No deprecation warnings in README. Library remains compatible with modern JavaScript (ESM imports, jsDelivr CDN support documented). Appears actively maintained at a steady, non-urgent pace consistent with stable, mature software.
ADOPT IF: you have millions of 2D geometric objects that remain static post-index and require fast bounding-box or k-nearest-neighbor queries; you need to transfer indices between Web Workers or persist them to disk; memory footprint and indexing speed are critical. AVOID IF: your data changes frequently (add/remove operations needed); you work primarily in other languages and need seamless integration; you lack familiarity with spatial indexing concepts. MONITOR IF: you evaluate geospatial stacks; you're building performance-sensitive visualization tools; you need to assess whether Flatbush's strict immutability constraint aligns with your data pipeline.
Independent dimensions
Mainstream potential
4/10
Technical importance
7/10
Adoption evidence
4/10
- Immutability constraint severely limits applicability; any dynamic dataset requires re-indexing entire structure, making it unsuitable for live-updating systems.
- Adoption appears limited to niche geospatial and mapping communities; mainstream JavaScript adoption not evident from available signals.
- Author is active but project is not aggressive about promotion or cross-language porting; may remain JavaScript-only despite potential for C/Rust/Go implementations.
- Performance claims in README not independently verified; benchmark section truncated, and no peer-reviewed comparisons provided.
- API surface is minimal; extension points (filters, custom serialization) appear limited, constraining customization for specialized use cases.
Flatbush will remain a stable, niche tool within geospatial engineering circles. Likely to maintain steady maintenance without significant API changes or user-base expansion. Potential for growth if web-based visualization and mapping tools adopt it as a dependency, but no evidence of breakout adoption trajectory.
Explore similar
Newsletter
Get analyses like this every Monday
Free weekly digest of the most interesting open-source discoveries.
Languages
Information
- Language
- JavaScript
- License
- ISC
- Last updated
- 2d ago
- Created
- 102mo ago
- Analyzed with
- anthropic/claude-haiku-4-5
Stars over time
Contributors over time
Top 100 contributors only — repos with more will plateau at 100.
Open issues
Top contributors
Recent releases
Similar repos
| Repository | Stars | Week Δ | Language | Score | Updated |
|---|---|---|---|---|---|
|
|
1.6k | +1 | JavaScript | 8/10 | 2d ago |
|
|
2.8k | — | JavaScript | 8/10 | 1mo ago |
|
|
2.6k | — | JavaScript | 8/10 | 2w ago |
|
|
26.2k | — | C++ | 9/10 | 3w ago |
|
|
10.4k | — | TypeScript | 8/10 | 1w ago |
|
|
2.6k | — | JavaScript | 8/10 | 2d ago |
RBush (2.7K stars) is mutable and general-purpose; Flatbush is immutable and optimized for pre-indexed, read-heavy workloads. RBush better for dynamic data; Flatbush better for speed/memory when data is static.
Also by Agafonkin; KDBush specializes in point-only indexing with similar speed/memory tradeoffs. Flatbush handles rectangles; KDBush handles points exclusively.
FlatBuffers is a serialization format; Flatbush is a spatial index. Not direct competitors but both emphasize compact binary representation and zero-copy access.
Supercluster clusters geographic points for map visualization; Flatbush does spatial range/neighbor queries. Different problems; both used in mapping pipelines.
Turf is a geospatial analysis library with broader scope; Flatbush is a narrowly focused spatial index. Turf may use Flatbush internally but solves different abstraction level.