Obsidian Plugin API

Permanent noteCreated Updated

On this page

The Obsidian Plugin API is the TypeScript interface community plugins are built against. It exposes the vault (files, metadata cache, frontmatter), the workspace (panes, views, ribbon, status bar), the editor (CodeMirror 6), commands, settings tabs, and events. Having shipped a fleet of plugins with it (see My Obsidian Plugins (MoC)), my take: it's a pragmatic API, well documented in the happy path, with the sharp edges living in the metadata cache timing and mobile differences.

Anatomy of a plugin

A plugin is a folder in .obsidian/plugins/<id>/ with three files:

  • manifest.json: id, name, version, minAppVersion, and isDesktopOnly (which decides Obsidian Mobile availability)
  • main.js: the bundled code; the entry class extends Plugin with onload() / onunload()
  • styles.css (optional)

Plugins are written in TypeScript, bundled with esbuild (or Bun; see Obsidian Plugin Template (Bun)), and hot-reloaded during development.

Distribution

Community plugins reach users through the official directory, powered by a pull request to the obsidianmd/obsidian-releases repo. Initial submissions get a manual review (see Obsidian Restricted Mode for the security model). Pre-release or unlisted plugins install via the BRAT plugin for Obsidian.

Good to know

  • The API surface is defined in the obsidian npm package (type definitions only); anything not in the public API is reachable but unsupported and breaks without notice.
  • app.metadataCache is the workhorse for anything that reads links, tags, or frontmatter without parsing files yourself.
  • Plugins can expose their features to the outside world too; my pattern for that is documented in Pattern for exposing Obsidian plugin features via the Obsidian CLI.

References

Thanks for reading. Get the newsletter or visit the store.

Notes that link here 8