- TypeScript 79.7%
- HTML 16.6%
- JavaScript 3.1%
- CSS 0.3%
- Shell 0.3%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .github | ||
| docs | ||
| packages | ||
| scripts | ||
| .dev.vars.example | ||
| .gitignore | ||
| biome.json | ||
| bun.lock | ||
| CONTRIBUTING.md | ||
| LICENSE.md | ||
| package.json | ||
| PLAN.html | ||
| README.md | ||
| tsconfig.base.json | ||
Behold.quest
Local-first Obsidian sync, history, archives, sharing, and publishing on a Cloudflare backend you own.
Behold.quest is an Obsidian plugin plus a Cloudflare Worker backend. The backend is deployed into the vault owner's Cloudflare account. Text syncs through Yjs in one Durable Object per vault; attachments live in R2; archives are built and encrypted on the client; publishing renders Obsidian's Reading view into static pages.
The full architecture and design decisions are in PLAN.html.
Features
- Live text sync with Yjs, cursor/selection presence, offline edits, and catch-up on reconnect.
- Attachments in R2, content-addressed, immutable, with all versions retained and conflict copies.
- Per-file history with diffs and non-destructive restore; every edit for 30 days, then grouped.
- Encrypted archives built locally with tar + zstd + age, uploaded to R2 with daily/weekly/monthly retention.
- Sharing through one-time viewer/contributor invites and guest-onboarding links. Guests use configurable OAuth/OIDC providers and never need a Cloudflare account.
- Publishing of individual notes or a whole vault as static pages, with public, unlisted, authenticated, and one-time-link access. Published notes are not editable on the web.
- Mobile-compatible plugin code path; no background daemon. Android is the primary tested device.
Set up from Obsidian
1. Install the plugin
Copy the zip contents into <vault>/.obsidian/plugins/behold-quest/, or use the release zip, then enable Behold.quest in Settings → Community plugins.
2. Add your domain to Cloudflare
If the domain is not already in your Cloudflare account, add it in the Cloudflare dashboard and wait for it to become active. The plugin uses api.<domain>, auth.<domain>, and *.<domain> for publishing.
3. Create the backend
Open Settings → Behold.quest and click Sign in with Cloudflare. Authorize in your browser; it returns you to Obsidian automatically.
- If you already host a backend, the plugin reconnects. It does not redeploy or rotate secrets.
- If this is your first setup, choose a Cloudflare account (only if you have more than one) and an active domain, then confirm Create my backend. The Worker, Durable Objects, D1 database, and R2 bucket are created in your selected Cloudflare account, not the project's account. Usage belongs to that host account.
- Create or select a vault explicitly before syncing any notes.
There are no OAuth client IDs, scopes, redirect URLs, API tokens, or manual backend fields to configure. The project operator registers the public Cloudflare app and configured OAuth/OIDC identity apps once; see operator deployment. These registrations and the login service must be activated before this sign-in flow is available.
Sign in on another device
On a device where you are already signed in, click Account → Link account. With one configured provider the browser opens directly; with multiple providers choose one. Shared-service OAuth/OIDC providers and providers configured on your backend are offered together. This works for owners and guests: it links to your existing user without creating another account, changing roles, or consuming another invite. Normal users never enter client IDs or secrets. Settings checks your authenticated backend for link status—even if the browser return failed—and shows Account linked. Link additional identities under collapsed Account-link recovery → Link another account; checking status does not contact the shared login service.
On another device, expand Already have an account or invite? → Sign in and use the same linked provider. Shared-service providers find your linked backends without a URL; backend-local providers use that backend's sign-in link. Cloudflare remains the separate hosting setup/reconnect action, not a required identity provider for guests. Discord is just one optional configured provider. Linking is explicit; matching emails never grants ownership, and existing accounts are never merged or promoted.
Browser-return recovery appears only in the waiting sign-in dialog under Browser did not return? Never share the completion code.
Direct backend sign-in links and invites still work independently of the shared login service. Optional backend-local provider registration/linking lives under Sharing → Custom sign-in providers; copy a direct sign-in link under Advanced. Backend-local apps remain independent of the shared-service apps and work without the shared service.
Signing in never chooses a vault or uploads files. Select Vault → Active vault explicitly.
4. Use it
- Edit notes; the status-bar dot shows connection state.
- Behold.quest: Show file history for per-file history.
- Behold.quest: Create archive now after setting an archive password.
- Behold.quest: Publish current note after setting a personal subdomain.
- Under Sharing, add a sign-in provider and create invites for other people.
Manual backend deployment
For operators who prefer to deploy with Wrangler, see docs/DEPLOY.md. The plugin has no manual URL/bootstrap-token connection form; existing backends use provider sign-in links or Cloudflare OAuth discovery.
Code review
Pull requests are reviewed by the self-hosted Forgejo Pi Review bot. Reviews are advisory: findings are verified against the source before code is changed, and false positives are answered on the PR.
Security model
- Live notes and attachments are server-readable; the owner's backend can read them.
- Archives are encrypted locally with a master password and are not readable by the backend.
- Cloudflare OAuth uses the project's HTTPS callback. A transient token is encrypted in the login service for at most five minutes, and released once only after browser-bound completion in the initiating plugin. The plugin uses it against the host's selected account and does not persist it. Existing Worker secrets are preserved on explicit updates.
- Optional shared sign-in trusts
login.behold.questfor linked identity assertions. It stores a hashed provider-subject-to-backend directory, not notes. Login assertions expire after two minutes, are audience-bound, and are consumed once. Backend-local sign-in does not depend on this service. - Guests receive backend sessions, never Cloudflare credentials. There are no quotas; guest usage is the owner's responsibility.
- Published pages are sanitized and served with a strict Content Security Policy.
Updating
Keep behold-quest/data.json when replacing plugin files. It contains the backend URL and session; recovery uses linked provider sign-in or Cloudflare OAuth reconnect, not re-provisioning. See docs/UPDATING.md.
Development
bun run typecheck
bun run test
bun run build
For a local backend:
scripts/dev-worker.sh
scripts/install-plugin.sh /path/to/vault
The local Worker uses http://localhost:8787 and dev-bootstrap-token.
Local smoke tests (with the Worker running):
BASE_URL=http://localhost:8787 bun scripts/smoke-worker.mjs
BASE_URL=http://localhost:8787 bun scripts/smoke-yjs.mjs
BASE_URL=http://localhost:8787 bun scripts/smoke-backend.mjs
See docs/LOCAL_DEV.md and docs/TESTING.md.
License
AGPL-3.0. See LICENSE.md.