Search...Search plugins and themes...
⌘K
Sign in
  • Get started
  • Download
  • Pricing
  • Enterprise
  • Account
  • Obsidian
  • Overview
  • Sync
  • Publish
  • Canvas
  • Mobile
  • Web Clipper
  • CLI
  • Learn
  • Help
  • Developers
  • Changelog
  • About
  • Roadmap
  • Blog
  • Resources
  • System status
  • License overview
  • Terms of service
  • Privacy policy
  • Security
  • Community
  • Plugins
  • Themes
  • Discord
  • Forum / 中文论坛
  • Merch store
  • Brand guidelines
Follow us
DiscordTwitterBlueskyThreadsMastodonYouTubeGitHub
© 2026 Obsidian

Module Host

1653lin41653lin413 downloads

Load and hot-reload standalone local JavaScript drawer modules from your vault with lifecycle cleanup and secret storage support.

Add to Obsidian
  • Overview
  • Scorecard
  • Updates2

中文文档

A minimal, zero-dependency microkernel host for Obsidian (1.11.5+, desktop only) that loads and hot-reloads standalone local JavaScript drawer modules (*plugin.js / *plugin.mjs) directly from your vault—no build step required for local modules.

Security Notice

  • Local-first host: The Module Host core makes zero network requests, includes zero telemetry, and never downloads external code.
  • Automatic local execution: Modules inside your configured vault folder (_Modules/plugins by default) are dynamically imported via native ES import() and automatically execute when the host loads or reloads.
  • Full plugin privileges (no sandbox): Modules are not sandboxed. They execute with the same privileges as a regular Obsidian plugin and can access Obsidian APIs and host-provided services, including SecretStore.
  • Network & data access by modules: Although the host itself does not connect to the network, individual modules you load may make network requests, read or modify vault data, or use configured secrets depending on their code.
  • Trusted code only: Only place modules that you wrote yourself or carefully audited into your modules folder.

Features

  • Pure microkernel runtime (Runtime): Service registry (register, get, has) with duplicate protection, single-module failure rollback, and LIFO (dispose) cleanup on hot reload or unload.
  • Single-layer hot reload (PluginLoader): Scans the configured vault folder (default: _Modules/plugins) for *plugin.js / *plugin.mjs files, strictly loads export default, and busts ESM cache using timestamp queries.
  • Secret isolation (SecretStore): Integrates exclusively with Obsidian's built-in SecretStorage (1.11.5+) and SecretComponent. Plaintext keys are never written to data.json, and missing secrets fail fast by returning null.
  • Automatic bilingual UI: Automatically adapts settings, commands, and notices between English and Chinese via Obsidian's getLanguage() API.

Core Services Registered by Default

Every module receives the runtime instance in setup(runtime) and dispose(runtime), and window.moduleHost also exposes the active runtime for console debugging or standalone scripts:

Service key Value
"app" Obsidian App instance
"plugin" ModuleHostPlugin instance
"obsidian" Full "obsidian" API namespace (Notice, Component, Modal, etc.)
"secrets" SecretStore wrapper (get(aliasOrId), list())

Quick Start: Minimal Drawer Module

  1. Create a folder in your vault (default: _Modules/plugins).
  2. Add a file whose name ends with plugin.js or plugin.mjs, such as _Modules/plugins/helloPlugin.js:
let scope = null;

export default {
  name: "hello-drawer",

  async setup(runtime) {
    const app = runtime.get("app");
    const hostPlugin = runtime.get("plugin");
    const obsidian = runtime.get("obsidian");

    // Manage listeners, timers, and UI cleanup via a standalone Component
    scope = new obsidian.Component();
    scope.load();

    const statusEl = hostPlugin.addStatusBarItem();
    statusEl.setText("Hello Drawer");
    scope.register(() => statusEl.remove());

    scope.registerEvent(
      app.workspace.on("file-open", (file) => {
        if (file) {
          statusEl.setText(`Active: ${file.basename}`);
        }
      })
    );

    new obsidian.Notice("Hello drawer loaded.");
  },

  async dispose() {
    // One-line cleanup for all listeners, timers, and registered callbacks
    scope?.unload();
    scope = null;
  }
};
  1. Run the command Reload local modules (热重载所有本地抽屉模块) from the Command Palette whenever you edit a module.

Note on commands and custom views: obsidian.Component automatically detaches workspace events, DOM events, and intervals. If your drawer manually registers commands (hostPlugin.addCommand) or custom ItemView types (hostPlugin.registerView), make sure to remove/unregister them inside dispose(runtime).

Using Secrets Safely

  1. Create your actual secret inside Obsidian Settings → Keychain / Secret Storage.
  2. In Settings → Module Host → Secret vault, add an uppercase alias (for example, DEEPSEEK_API_KEY) and bind it to your secret storage entry—or call secrets.get("my-secret-id") directly with the exact storage ID:
const secrets = runtime.get("secrets");
const apiKey = secrets.get("DEEPSEEK_API_KEY"); // returns string | null
if (!apiKey) {
  throw new Error("Missing DEEPSEEK_API_KEY in Obsidian secret storage.");
}

Optional 4-Layer Folder Convention

While Module Host itself only scans your configured plugins folder (_Modules/plugins) and enforces no directory layout outside it, organizing your _Modules folder into four optional layers keeps AI-assisted local development clean:

  • _Modules/capabilities/ — Reusable single-domain helper molecules (e.g., vault, text, JSON, canvas wrappers)
  • _Modules/presets/ — Higher-level engines or JSON configs shared across modules
  • _Modules/plugins/ — Resident drawer modules (*plugin.js / *plugin.mjs) scanned by Module Host
  • _Modules/scripts/ — One-off scripts triggered on demand via a launcher module

Installation

Manual Installation

  1. Download main.js and manifest.json from the latest GitHub Release.
  2. Copy both files into <YourVault>/.obsidian/plugins/module-host/.
  3. Enable Module Host in Obsidian Settings → Community plugins.

Build from Source

npm install
npm run build

Copy the generated main.js and manifest.json into <YourVault>/.obsidian/plugins/module-host/.

License

MIT

HealthExcellent
ReviewSatisfactory
About
Host and hot-reload standalone local JavaScript drawer modules (*plugin.js / *plugin.mjs) directly from your vault without a build step (desktop only, Obsidian 1.11.5+). Provide a minimal microkernel runtime with a service registry, ESM cache-busting, and SecretStore integration with full plugin privileges (no sandbox). Run only trusted local modules.
DevelopersCode
Details
Current version
1.0.1
Last updated
2 days ago
Created
2 days ago
Updates
2 releases
Downloads
13
Compatible with
Obsidian 1.11.5+
Platforms
Desktop only
License
MIT
Report bugRequest featureReport plugin
Author
1653lin41653lin4
GitHub1653lin4
  1. Community
  2. Plugins
  3. Developers
  4. Module Host

Related plugins

CodeScript Toolkit

Allows to do a lot of things with JavaScript/TypeScript scripts from inside the Obsidian itself

CustomJS

Reuse custom JavaScript across desktop and mobile.

BRAT

Easily install a beta version of a plugin for testing.

Templater

Create and use dynamic templates.

Claudian

Embeds Claude Code/Codex and other local Agents as AI collaborators in your vault.

Mermaid Tools

Improved Mermaid.js experience: visual toolbar with common elements and more.

Local REST API with MCP

Unlock your automation needs by interacting with your notes over a secure REST API.

Terminal

Integrate consoles, shells, and terminals.

Hot Reload

Automatically reload in-development plugins when their files are changed

Git

Integrate Git version control with automatic backup and other advanced features.