cobe

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

Library
npm
v2.0.1
5,895 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
59 /100 Fair
Development Activity 56
Maintenance 28
Community 56
Maturity 56
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
62 /100 Good
Architecture 75
Code Quality 40
Innovation 78
Learning Curve 55

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 8 apps in this directory

TypeScript
45%
Other

Convex Backend

Databases · Developer Tools

12,617

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
TypeScript 45%
Rust 43%
Updated 6 days ago
MDX
50%
Apache 2.0

Formizee

Forms Surveys

185

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
MDX 50%
TypeScript 49%
Updated 1 years ago
Python
51%
AGPL 3.0

LearnHouse

CMS · Learning Management

2,301

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
Python 51%
TypeScript 48%
Updated 5 days ago
TypeScript
71%
Apache 2.0

open-design

Design Tools

98,365

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
TypeScript 71%
HTML 22%
Updated 4 days ago
TypeScript
82%
AGPL 3.0

OpenStatus

Devops · Monitoring

9,143

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
TypeScript 82%
MDX 15%
Updated 5 days ago
TypeScript
95%
Other

Suna

AI Agents

20,238

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
66
Dependency
Built with
TypeScript 95%
Updated 4 days ago
TypeScript
72%
Apache 2.0

Supabase

Authentication · Databases · Developer Tools

110,828

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
TypeScript 72%
MDX 26%
Updated 4 days ago
Rust
64%
Apache 2.0

Temps

Analytics · Devops · Monitoring

801

A self-hosted Rust PaaS that replaces Vercel, Sentry, PostHog, Pingdom, Resend, and E2B with one binary — plus 440+ CLI operations agents like Claude Code can drive directly.

View details
81
Repo Health
86
Technical
70
Dependency
Built with
Rust 64%
TypeScript 34%
Updated 4 days ago

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