DEV Community

Cover image for Compute astrology charts in the browser: no node-gyp, no .se1 files, no AGPL
Xalen Technologies
Xalen Technologies

Posted on

Compute astrology charts in the browser: no node-gyp, no .se1 files, no AGPL

If you've wired Swiss Ephemeris into a Node astrology app, you know the ritual. You npm install sweph, and now every machine needs Python plus a C/C++ toolchain, because the package compiles Swiss's C code via node-gyp at install time (make/gcc on Linux, Xcode on macOS, Visual C++ Build Tools on Windows).

It works on your laptop. Then it explodes:

  • Apple Silicon: node-gyp can't find full Xcode behind Command Line Tools.
  • Slim Docker / CI images: no Python, no build-essential, so the install dies.
  • Serverless: the .node binary you built locally won't load on Amazon Linux (wrong arch or glibc).

Then there's the data. Neither sweph nor swisseph bundles the .se1 ephemeris files; you download them yourself and point the library at a path. The modern set is 2 MB, the full GitHub set is 100 MB. And since 2.10.1, sweph is AGPL-3.0 (LGPL only under a professional license), a real obligation to weigh for a closed-source SaaS backend.

The pure-Rust alternative

XALEN Ephemeris is an analytical engine written entirely in Rust and licensed Apache-2.0. Three things make it interesting for JS/TS devs:

  • No node-gyp. The Node addon is napi-rs, which ships prebuilt per-platform binaries via npm. No Python, no C compiler, no compile step.
  • A real WASM build via wasm-bindgen, so you compute charts client-side in the browser: no server round-trip, no backend copyleft.
  • Zero data files. The core math (VSOP87A, ELP2000-82, IAU precession/nutation, an 8,870-star catalog) is analytical and compiled into the binary. No .se1 to host.
import init, * as xalen from "xalen-ephemeris"; // WASM build, runs in the browser
await init(); // load the .wasm module
const chart = xalen.computeChart({ datetime: "1990-04-12T08:30:00Z", lat: 28.6, lon: 77.2 });
console.log(chart); // planet longitudes, house cusps, etc.
Enter fullscreen mode Exit fullscreen mode
Swiss via Node XALEN (pure Rust)
Build deps node-gyp + Python + C compiler none: prebuilt binary / .wasm
Runtime data .se1 files (2 to 100 MB) none, compiled in
Browser / WASM possible via Emscripten native wasm-bindgen
License AGPL-3.0 / professional Apache-2.0

To be fair, Swiss can be compiled to WASM (Emscripten ports exist, and its built-in Moshier mode is file-free). So the honest edge isn't capability, it's delivery: pure Rust straight to WASM, with no Emscripten/MEMFS shim and no data files to bundle.

Honest caveat: XALEN is young and not on npm or PyPI yet (crates.io currently serves an older 0.3.1 line). Today this is a watch-and-prototype story, not a drop-it-into-prod one.

Repo: github.com/vedika-io/xalen-ephemeris. Would you ship ephemeris math to the client, or is server-side non-negotiable for you?

Top comments (0)