cobe

A 5KB, zero-dependency WebGL library for rendering interactive, animated 3D globes with markers and arcs.

Library
npm
v2.0.1
5,763stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
52/100Fair
Development Activity32
Maintenance24
Community56
Maturity56
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
62/100Good
Architecture75
Code Quality40
Innovation78
Learning Curve55

Cobe renders an interactive 3D globe directly onto an HTML canvas using raw WebGL2 (with a WebGL1 + ANGLE_instanced_arrays fallback for older browsers), with no runtime dependencies and a published bundle of roughly 5KB. Its shaders are authored in the GLSLX shading language and precompiled at build time, so the published package ships plain, minified GLSL rather than compiling shaders from source at runtime.

The API is a single createGlobe(canvas, opts) call that returns update() and destroy() functions, letting consumers drive rotation, markers, arcs, and colors imperatively — a pattern documented in the README for React’s requestAnimationFrame loops. Version 2 adds arcs connecting two globe locations and CSS Anchor Positioning support, so markers and arcs can be bound to ordinary DOM elements (tooltips, labels) via CSS custom properties instead of manual screen-space projection math.

What You Get

  • A single createGlobe(canvas, opts) function that renders directly onto a <canvas> using WebGL2 (falling back to WebGL1 with the ANGLE_instanced_arrays extension, and a manual per-instance draw loop as a last resort)
  • An update(state) method that applies a Partial<COBEOptions> patch — rotation (phi/theta), markers, arcs, colors, opacity, scale, and canvas size — and re-renders without recreating the WebGL context
  • Shaders precompiled from GLSLX source (.glslx files) into plain GLSL at build time via scripts/build.js, so no shader-language compilation happens in the browser
  • CSS Anchor Positioning hooks — markers and arcs with an id expose --cobe-{id} / --cobe-visible-{id} CSS custom properties so ordinary DOM elements can be pinned to their screen position purely in CSS

Common Use Cases

  • Visualizing a global user or customer base on marketing and landing pages
  • Rendering live geographic data points on analytics or status dashboards
  • Drawing flight paths, network links, or shipment routes as arcs between coordinates
  • Embedding an interactive globe without the bundle weight of a full 3D/mapping library

Under The Hood

Architecture The entire rendering pipeline lives behind a single default export, createGlobe(canvas, opts) in src/index.js, which creates the WebGL context, compiles three shader programs (globe, marker, arc) via the small webgl.js helper module, sets up quad/instance buffers, and returns a closure exposing update() and destroy(). All mutable state (phi, theta, markers, arcs, colors, scale) is captured as local variables inside that closure rather than passed through any store or class instance, and update() merges partial state then immediately re-issues a three-pass draw sequence (globe quad, instanced arcs, instanced markers) using WebGL2 instancing or the ANGLE_instanced_arrays extension. DOM/CSS integration is factored into a separate anchor.js module (createAnchorManager) that tracks marker/arc anchor <div> elements and a single shared <style> tag for CSS custom properties, avoiding a per-frame stylesheet rewrite unless visible markers actually change. The design is a modular monolith: one large orchestrating file plus small, single-purpose helpers (webgl.js, anchor.js, texture.js); replacing the core createGlobe closure would mean replacing the whole rendering pipeline, since there is no dependency injection or plugin seam.

Tech Stack The library is hand-written JavaScript with JSDoc type annotations rather than TypeScript, publishing type declarations only through a separately maintained index.d.ts. It has zero runtime dependencies and targets the browser’s native WebGL2/WebGL1 APIs directly. The build pipeline uses esbuild for JS bundling, the glslx compiler to turn .glslx shader source into minified GLSL string constants injected at build time, and terser for a final minification pass beyond what esbuild alone achieves, in service of keeping the published bundle near 5KB. The package is ESM-only (type: module) and lives in a pnpm workspace alongside a separate website/ Next.js 12 + React 18 demo app that is not part of the published package.

Code Quality No test files exist anywhere in the repository — there is no *.test.*, *.spec.*, or test directory, and correctness appears to rely on manual verification against the interactive demo site. Source files use consistent JSDoc-annotated plain JavaScript; failure paths (missing WebGL context, failed shader/program compilation) return no-op { update, destroy } objects rather than throwing, which is defensive but silent about failures. No linter, formatter, or CI configuration is present in the cloned repository.

API Design The public surface is intentionally minimal: one default export, createGlobe(canvas, opts), returning { update, destroy }, with nearly every visual option defaulted via ||/?? fallbacks so a consumer can start from a handful of required fields and opt into the rest incrementally. update() accepting a Partial<COBEOptions> patch is a deliberate fit for framework render loops (the README shows a React requestAnimationFrame pattern that increments phi every frame). The CSS Anchor Positioning integration in v2 — binding marker/arc ids to --cobe-{id} custom properties — is a genuinely distinctive DX choice, letting consumers position DOM tooltips relative to 3D globe points without any manual projection math on their side. Documentation is limited to the README’s Quick Start, Arcs, and Bindable Markers sections, with no separate docs site beyond the live demo.

Used by 7 apps in this directory

TypeScript
45%
Other

Convex Backend

Developer Tools · Databases

12,494

Open-source reactive database that lets developers build live-updating apps with pure TypeScript, strong consistency, and real-time subscriptions—no separate API layer required.

View details
87
Repo Health
82
Technical
68
Dependency
Built with
TypeScript45%
Rust43%
Updated 2 days ago
MDX
50%
Apache 2.0

Formizee

Forms Surveys

183

An open-source form backend and builder platform — design forms, collect submissions, and get analytics without hosting your own server, positioned as an alternative to Formspree and Typeform.

View details
28
Repo Health
59
Technical
68
Dependency
Built with
MDX50%
TypeScript49%
Updated 1 years ago
Python
51%
AGPL 3.0

LearnHouse

Learning Management · CMS

2,240

Open-source LMS with AI tutoring, real-time collaboration boards, live code execution, and built-in course monetization — self-hosted in minutes.

View details
90
Repo Health
77
Technical
66
Dependency
Built with
Python51%
TypeScript48%
Updated yesterday
TypeScript
67%
Apache 2.0

open-design

Design Tools

94,473

Local-first, open-source Claude Design alternative that turns your existing coding agent CLI into a full agentic design studio — with 259+ skills, 142+ design systems, and sandboxed artifact delivery across web, desktop, and mobile surfaces.

View details
85
Repo Health
86
Technical
72
Dependency
Built with
TypeScript67%
HTML25%
Updated yesterday
TypeScript
81%
AGPL 3.0

OpenStatus

Monitoring · Devops

9,072

Open-source status pages and uptime monitoring with global synthetic checks, monitoring-as-code, and AI agent integration via MCP.

View details
77
Repo Health
82
Technical
69
Dependency
Built with
TypeScript81%
MDX15%
Updated yesterday
TypeScript
95%
Other

Suna

AI Agents

20,178

Turn your company into a git repo — one config, one command center, a workforce of AI agents that runs the real work around the clock.

View details
90
Repo Health
79
Technical
68
Dependency
Built with
TypeScript95%
Updated today
TypeScript
71%
Apache 2.0

Supabase

Developer Tools · Databases · Search

108,912

The open-source Postgres development platform that replaces Firebase with authentication, real-time APIs, edge functions, storage, and vector embeddings — all built on PostgreSQL.

View details
90
Repo Health
91
Technical
62
Dependency
Built with
TypeScript71%
MDX26%
Updated today

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search