Skip to content

Getting started

Obsidian Dev Utils is a collection of essential functions, helpers, and build tooling that streamline Obsidian plugin development. This guide gets you from an empty project to your first call.

Install the package from npm:

Terminal window
npm install obsidian-dev-utils

If you are starting a brand-new plugin, the Obsidian Plugin Yeoman Generator scaffolds a project that already wires up this library and its scripts for you.

Everything the library exposes for use inside a running plugin is a normal import. For example, show a prompt modal without writing any modal boilerplate:

import { prompt } from 'obsidian-dev-utils/obsidian/modal/prompt';
const name = await prompt({
app,
title: 'Enter your name'
});

Helpers are grouped by file and folder, and each group is reachable through several import styles (deep path, namespace, or a single flat barrel). See Helper Functions for the full set of import styles, including the flat __merged barrel.

The library also ships the build, lint, format, spellcheck, and test tooling most plugins need, exposed as functions you wrap in your own scripts/:

scripts/build.ts
import { wrapCliTask } from 'obsidian-dev-utils/script-utils/cli-utils';
import { build } from 'obsidian-dev-utils/script-utils/bundlers/esbuild';
await wrapCliTask(() => build());

Then wire it into package.json:

{
"scripts": {
"build": "jiti scripts/build.ts"
}
}

See Commands for the complete list of build and tooling entry points.

  • Helper Functions — general-purpose and Obsidian-specific helpers, and the ways to import them.
  • Setting Components — ready-made settings-tab controls.
  • Modals — alert, confirm, prompt, and select modals with an async API.
  • Plugin Helpers — building blocks to simplify your own plugin class.
  • Commands — the build, lint, format, and test tooling.
  • API reference — the complete, searchable API generated from the library’s TSDoc.