> ## Documentation Index
> Fetch the complete documentation index at: https://docs.calit.now/llms.txt
> Use this file to discover all available pages before exploring further.

# Headless JavaScript and self-hosting

> Generate calendar links and .ics files without the widget or Calit hosting.

## Install from npm

```sh theme={null}
npm install @oxhq/calit-now
```

Import `@oxhq/calit-now` once in a browser entry point to register `<cal-it>`. For calendar links or iCalendar files without a DOM, use `@oxhq/calit-now/core`.

## Self-host the scripts

Download the built assets and serve them with a JavaScript MIME type from your own site. You can also build them with `npm ci && npm run build` from the [OSS repository](https://github.com/oxhq/calit-now).

| File | Use |
| - | - |
| [cal-it.js](https://oxhq.github.io/calit-now/dist/cal-it.js) | HTML custom element. |
| [cal-it.embed.js](https://oxhq.github.io/calit-now/dist/cal-it.embed.js) | One script per button; retains the settings fragment. |
| [core.js](https://oxhq.github.io/calit-now/dist/core.js) | ES module usable without a DOM. |

## Public functions

```js theme={null}
import { buildCalendarLinks, normalizeEvent, toICS } from '@oxhq/calit-now/core';

const event = {
  title: 'Open studio',
  start: '2027-04-10',
  uid: 'open-studio-2027@example.org',
};
const normalized = normalizeEvent(event);
const { google, outlook, yahoo } = buildCalendarLinks(event);
const content = toICS(event);
```

If you downloaded the standalone file instead, change the import to its local path. In Node, use an ES module project or save the downloaded file as `core.mjs`.

* `normalizeEvent(event)` returns `from` and `until` as epoch milliseconds, `allDay`, and the normalized metadata. Invalid input throws.
* `buildCalendarLinks(event)` returns the three provider editor URLs; it does not make any network requests.
* `toICS(event, { now })` returns iCalendar text. The optional `now` is a Date to control the export timestamp in tests. Supply a stable `uid` to identify the same event across exports; reimport behavior depends on the calendar app.

GitHub Pages demo URLs follow the current build. For reproducibility, keep your own release copy and keep its filename versioned. You can build and validate examples with `npm test`; the browser suite is `npm run test:browser` after installing Chromium as described in the repository.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.