← 목록

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

devto 2026-06-25 원문 보기 ↗


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:

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:

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.
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?