Skip to content
← Projects

solar-spa

WebAssembly build of NREL's Solar Position Algorithm for near-native speed.

WebAssemblynpm

About

solar-spa is a WebAssembly build of NREL's Solar Position Algorithm, delivering near-native performance for solar position calculations in Node and the browser.

Install

npm install solar-spa

Quick start

import { spa } from 'solar-spa';

const result = await spa(
  new Date(2025, 5, 21, 12, 0, 0), // June 21, 2025 at noon
  40.7128, -74.0060,               // NYC lat/lon
  { timezone: -4, elevation: 10 }, // EDT, 10m elevation
);

console.log(result.zenith, result.sunrise, result.sunset);

Full API and options onGitHub and npm.