DEV Community

Jayesh Patel
Jayesh Patel

Posted on

Building an Open MIT-Licensed Ephemeris Engine in C — JPL Moshier Ephemeris

For a long time, most of my work around astronomical and astrological software revolved around wrappers and bindings — especially around Swiss Ephemeris integrations.

Over the past few months, I decided to move deeper into the actual engine layer itself.

Instead of only building language bindings, I started building a fully open, extensible, MIT-licensed ephemeris engine in C designed for:

  • astronomy
  • astrology
  • astronomical almanac systems
  • planetary calculations
  • eclipse computations
  • sidereal and coordinate systems

That project became:

JPL Moshier Ephemeris

An independent native ephemeris engine written in C.


Why Build Another Ephemeris Engine?

Most existing ephemeris systems are:

  • closed-source or partially restricted
  • GPL/commercial licensed
  • difficult to extend cleanly
  • tightly coupled to legacy APIs
  • not designed for modern multi-language interoperability

I wanted a foundation that was:

  • fully MIT licensed
  • extensible
  • embeddable
  • project-owned
  • cross-platform
  • suitable for modern bindings and runtimes

The goal was not just to wrap existing systems, but to build an actual reusable engine layer.


Core Architecture

The engine supports multiple calculation backends and analytical models.

Supported Systems

  • JPL/CALCEPH kernel-backed calculations
  • Moshier analytical calculations
  • VSOP87 analytical planetary models
  • ELP2000 lunar theory
  • Meeus analytical algorithms

This allows mixing:

  • high-precision ephemeris kernels
  • lightweight analytical calculations
  • fallback computational modes

depending on accuracy and performance requirements.


What the Engine Supports

Currently implemented functionality includes:

  • planetary calculations
  • lunar calculations
  • solar calculations
  • eclipse calculations
  • occultation calculations
  • rise/set calculations
  • sidereal systems
  • ayanamsa support
  • house system calculations
  • fixed star calculations
  • coordinate transformations
  • time conversions
  • nutation/precession
  • topocentric calculations

API Surface

One important design goal was broad API coverage and extensibility.

Comparison

Project Public Functions Public Constants
Swiss Ephemeris 106 348
JPL Moshier Ephemeris 204 462

The engine fully covers the traditional Swiss Ephemeris-style public API surface while extending it with additional APIs and functionality.


Why MIT License Matters

Licensing was a major consideration from the beginning.

The project is MIT licensed to allow:

  • open commercial use
  • embedding into proprietary systems
  • unrestricted integration
  • easier ecosystem adoption
  • broader language bindings

without GPL-style redistribution constraints.


Multi-Language Ecosystem

On top of the native engine, I also built:

JPL Moshier Ephemeris PHP

A PHP 8.3+ FFI wrapper with prebuilt runtime libraries for:

  • Linux
  • macOS
  • Windows

The wrapper exposes the native engine directly to PHP while keeping deployment relatively simple.


Long-Term Vision

The larger goal is to build a complete open ephemeris ecosystem that can power:

  • astronomy applications
  • astrology software
  • Panchang / almanac systems
  • research tools
  • calendar systems
  • educational software
  • cross-language scientific tooling

across multiple platforms and programming languages.


Project Links

Native C Engine

jpl-ephemeris GitHub

PHP Wrapper

jpl-moshier-ephemeris-php GitHub

Packagist

Packagist package


Feedback Welcome

The project is still evolving, and I’d genuinely appreciate:

  • testing
  • benchmarking
  • API feedback
  • architecture suggestions
  • contributions

from developers working in astronomy, astrology, scientific computing, calendrical systems, or language bindings.

Top comments (0)