Tempo Plugin Setup Guide
This guide explains how to install, register, and activate Tempo plugins in your projects.
1. Overview
Tempo features an extensible plugin architecture that allows developers to add custom business logic, date generators, term calculators, and domain-specific APIs (such as financial tickers or astronomy calculations) to the Tempo engine.
All official and community plugins are 100% open source under the MIT license and run without runtime license checks or key configuration.
2. Installation
Tempo plugins are published as scoped packages on the standard npm registry (npmjs.com). Install plugins using your package manager of choice:
npm install @magmacomputing/tempo @magmacomputing/tempo-plugin-ticker @magmacomputing/tempo-plugin-astro # npm
pnpm add @magmacomputing/tempo @magmacomputing/tempo-plugin-ticker @magmacomputing/tempo-plugin-astro # pnpm
yarn add @magmacomputing/tempo @magmacomputing/tempo-plugin-ticker @magmacomputing/tempo-plugin-astro # yarn
bun add @magmacomputing/tempo @magmacomputing/tempo-plugin-ticker @magmacomputing/tempo-plugin-astro # bun3. Registration & Activation
Tempo provides flexible registration options depending on your application structure and bundler setup.
Option A: Initialization Option (Recommended)
Pass plugins directly to Tempo.init() during application initialization. This guarantees clean execution order regardless of import hoisting:
import { Tempo } from '@magmacomputing/tempo';
import { TickerPlugin } from '@magmacomputing/tempo-plugin-ticker';
Tempo.init({
extends: [TickerPlugin]
});
const t = new Tempo();
console.log(Tempo.tickers);Option B: Explicit Extension (Tempo.extend)
Register plugins dynamically at runtime using Tempo.extend():
import { Tempo } from '@magmacomputing/tempo';
import { AstroTerm } from '@magmacomputing/tempo-plugin-astro';
Tempo.extend(AstroTerm);
const t = new Tempo('2026-03-20', { sphere: 'north' });
console.log(t.term.astro); // Discovers equinoxes and astronomical seasonsOption C: Explicit Registration (Tempo.extend)
Register plugins dynamically matching install behavior:
import { Tempo } from '@magmacomputing/tempo';
import { TickerPlugin } from '@magmacomputing/tempo-plugin-ticker';
Tempo.extend(TickerPlugin);
const t = new Tempo();
console.log(Tempo.tickers);4. Browser & Global Namespace Usage
When using pre-bundled scripts directly in HTML via <script> tags, plugins attach to the Magma.plugins global object:
<!-- 1. Core Temporal Polyfill & Tempo -->
<script src="https://cdn.jsdelivr.net/npm/@js-temporal/polyfill@0.5.1/dist/index.umd.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@magmacomputing/tempo@4/dist/tempo.bundle.min.js"></script>
<!-- 2. Plugin Script -->
<script src="https://cdn.jsdelivr.net/npm/@magmacomputing/tempo-plugin-astro@2/dist/index.global.min.js"></script>
<script>
const { Tempo, plugins } = Magma;
// Register the plugin
Tempo.extend(plugins.astro);
const t = new Tempo('next friday');
console.log(t.toString());
</script>5. Authoring Custom Plugins
Interested in creating your own plugin? Check out the Creating Custom Plugins Guide and Plugin Ecosystem Catalog to learn how to register custom getters, term definitions, and dynamic proxies.