A starter template for building Obsidian plugins with Svelte, bundled by esbuild and managed with Bun.
This is an extension of the official Obsidian plugin starter template.
- Write your plugin interface in Svelte
- Fast bundling with esbuild and
esbuild-svelte - Bun for dependency management, with a
bun.locklockfile - Source code in
src/, build output indist/ bun run devrebuilds automatically as you save- Reloads the plugin in Obsidian after each build, via the official Obsidian CLI
- A GitHub Actions release workflow that packages your plugin when you tag a version
- Bun — installs dependencies and runs the build scripts
- Node.js 22 or newer — runs the build and reload scripts
Check what you have installed:
bun --version
node --version-
Click Use this template on GitHub to create your own plugin repository
-
Install dependencies:
bun install
-
Start a watch build. It compiles into
dist/and rebuilds whenever you save:bun run dev
For a one-off production build, run
bun run build. -
Link
dist/into your vault so Obsidian can load the plugin. Name the folder to match theidin yourmanifest.json:ln -s /path/to/your/plugin/dist /path/to/your/vault/.obsidian/plugins/your-plugin-id
For example:
ln -s ~/repos/my-plugin/dist ~/Desktop/obsidian-development/.obsidian/plugins/my-plugin
Always link the main checkout's
dist/, never a git worktree's. A worktree'sdist/is deleted along with the worktree, which leaves the link dangling. -
Open Obsidian, go to Community plugins, and enable your plugin
Obsidian does not pick up new plugin files on its own. If you have the official Obsidian CLI enabled, the build reloads the plugin for you.
-
Turn the CLI on in Obsidian under Settings → General → Command line interface (needs the 1.12.7 installer or newer), then follow the prompt to add it to your PATH. Check it with:
obsidian version
-
Copy the example env file and fill in the vault you develop against:
cp .env.example .env
OBSIDIAN_VAULT=obsidian-development
Run
obsidian vaultsto list the vault names Obsidian knows about.
Every successful build now reloads the plugin in that vault, whether it came from bun run dev or bun run build. To reload without rebuilding:
bun run reloadThe plugin to reload comes from the id field in manifest.json. If the folder you linked into .obsidian/plugins is named something else, set OBSIDIAN_PLUGIN_ID in .env to match the folder.
Reloading is entirely optional. With no .env, or without the CLI installed, the build prints a short note once and carries on. Note that the CLI starts Obsidian if it is not already running.
Your vault links to the main checkout's dist/, so a reload from a worktree would load the main checkout's files, not the worktree's. Builds in a worktree therefore skip the reload. To try a worktree build in Obsidian:
- Stop any
bun run devwatch running in the main checkout, or its next rebuild will overwrite the files you copy in. - Copy
dist/main.jsanddist/manifest.jsonfrom the worktree into the main checkout'sdist/. - Run
bun run reloadfrom the main checkout.
When you're done, rebuild in the main checkout to switch back.
The included workflow builds your plugin and attaches main.js and manifest.json to a GitHub release whenever you push a tag. It requests the contents: write permission itself, so you don't need to change your repository's Actions settings.
Tag a version and push it:
git tag 0.1.0
git push origin 0.1.0