mourner

mourner/flatbush

JavaScript ISC Dev Tools

A very fast static spatial index for 2D points and rectangles in JavaScript 🌱

1.6k stars
63 forks
active
GitHub +1 / week

1.6k

Stars

63

Forks

6

Open issues

11

Contributors

v4.6.2 09 Jun 2026

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.

Dev Tools Library Discovery value: 5/10
Documentation 8/10
Activity 9/10
Community 7/10
Code quality 7/10

Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.

Overall score 8/10

AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.

spatial-indexing r-tree computational-geometry performance-optimized data-structures
Actively maintained Well documented Niche/specialized use case Production ready
Deep Analysis · Based on README and public signals
1w ago

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.

Origin

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.

Growth

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.

In production

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.

Code analysis
Architecture

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.

Tests

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.

Maintenance

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.

Honest verdict

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

Risks
  • 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.
Prediction

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.

0 found this helpful

Newsletter

Get analyses like this every Monday

Free weekly digest of the most interesting open-source discoveries.

Languages

JavaScript
100%

Information

Language
JavaScript
License
ISC
Last updated
2d ago
Created
102mo ago
Analyzed with
anthropic/claude-haiku-4-5

Stars over time

Loading…

Contributors over time

Top 100 contributors only — repos with more will plateau at 100.

Loading…

Similar repos

mourner

mourner/rbush

RBush is a high-performance JavaScript R-tree spatial index library for 2D...

2.8k JavaScript Dev Tools
mapbox

mapbox/delaunator

Delaunator is a high-performance JavaScript library for computing Delaunay...

2.6k JavaScript Dev Tools
google

google/flatbuffers

FlatBuffers is a cross-platform serialization library designed for zero-copy...

26.2k C++ Dev Tools
Turfjs

Turfjs/turf

Turf is a modular JavaScript library for spatial analysis, providing...

10.4k TypeScript Data
mapbox

mapbox/earcut

Earcut is a fast, lightweight JavaScript library for real-time polygon...

2.6k JavaScript Web Dev
vs. alternatives
RBush

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.

KDBush

Also by Agafonkin; KDBush specializes in point-only indexing with similar speed/memory tradeoffs. Flatbush handles rectangles; KDBush handles points exclusively.

Google FlatBuffers

FlatBuffers is a serialization format; Flatbush is a spatial index. Not direct competitors but both emphasize compact binary representation and zero-copy access.

Mapbox Supercluster

Supercluster clusters geographic points for map visualization; Flatbush does spatial range/neighbor queries. Different problems; both used in mapping pipelines.

Turf.js

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.