| Crates.io | swisseph-wasm |
| lib.rs | swisseph-wasm |
| version | 0.1.5 |
| created_at | 2026-01-06 15:00:43.637226+00 |
| updated_at | 2026-01-12 17:36:36.166338+00 |
| description | Swiss Ephemeris Bindings for WebAssembly |
| homepage | |
| repository | https://github.com/fusionstrings/swisseph-wasm |
| max_upload_size | |
| id | 2026033 |
| size | 23,185,356 |
High-precision, WebAssembly bindings for the Swiss Ephemeris.
- 🚀 Best-in-Class: Faster, smaller, and more accurate than pure JS implementations.
- 🛡️ Safe: Rust-based memory safety for FFI interactions.
- 📦 Universal: Works in Node.js, Deno, Bun, and Browsers.
When precision matters, swisseph-wasm is both faster and more
accurate.
| Environment | swisseph-wasm | astronomy-engine | Comparison |
|---|---|---|---|
| Deno (Bench) | ~182,000 iter/s | ~126,000 iter/s | 1.44x Faster 🚀 |
For simple calculations, the overhead of calling WebAssembly dominates. Pure JS is faster here.
| Environment | swisseph-wasm | astronomy-engine | Note |
|---|---|---|---|
| Browser (Chrome) | ~319,000 ops/sec | ~577,000 ops/sec | Inlined WASM vs Pure JS |
| Deno (Native) | ~178,000 ops/sec | ~434,000 ops/sec | Default Loader |
Summary: Use
swisseph-wasmfor professional-grade astrology (precision + complex speed). Useastronomy-enginefor UI/visualizations (low precision + simple speed).
Run them yourself:
deno task bench
deno run -A benches/deno_throughput.ts
# For browser: Serve root and open benches/browser_bench.html
deno add jsr:@fusionstrings/swisseph-wasm
Use as a native Rust crate:
cargo add swisseph-wasm
Advanced: Import raw WASM (Deno):
import wasmBytes from "@fusionstrings/swisseph-wasm/wasm";
const module = new WebAssembly.Module(wasmBytes);
npm install @fusionstrings/swisseph-wasm
Use the bundled browser version (inlined WASM) directly:
import { swe_julday } from "@fusionstrings/swisseph-wasm/browser";
// WASM initializes automatically
import {
SE_GREG_CAL,
SE_MOON,
SE_SUN,
swe_calc_ut,
swe_julday,
} from "@fusionstrings/swisseph-wasm";
// 1. Calculate Julian Day for Jan 1, 2000, 12:00 UTC
const jd = swe_julday(2000, 1, 1, 12.0, SE_GREG_CAL);
console.log(`Julian Day: ${jd}`); // 2451545.0
// 2. Calculate Sun Position
const sun = swe_calc_ut(jd, SE_SUN, 0);
console.log("Sun Longitude:", sun.longitude);
// 3. Calculate Moon Position
const moon = swe_calc_ut(jd, SE_MOON, 0);
console.log("Moon Longitude:", moon.longitude);
rustup target add wasm32-unknown-unknownmacOS Users:
brew install llvm
The build script automatically detects Homebrew LLVM.
deno task build
To update the version across Deno, Cargo, and NPM configs:
deno task bump-version <new-version>
# Example: deno task bump-version 1.2.3
This command validates the version format, updates all config files, and syncs
Cargo.lock.
MIT License. Based on the Swiss Ephemeris (GPL/Commercial dual license). Note: Using this library implies compliance with the Swiss Ephemeris license terms.