The napplet ecosystem
A napplet is a single-file web app published as a Nostr event. It runs in a sandboxed iframe and reaches relays, signing and storage only through the app that hosts it. This page covers how napplets work, how safe and stable they are, and who implements them. The plan builds on it.
Summary#
- The protocol core is small and well reviewed. A shell verifies the napplet's bytes against a signed manifest, runs them in an opaque-origin
srcdociframe, and answers requests over oneMessagePortper document. - The ecosystem is alpha. NIP-5D is an open PR whose event schema changed in October, only five capability specs are merged, and the host libraries publish about two releases a week.
- The sandbox keeps a napplet away from keys and from the host's storage. It does not stop a napplet from leaking data the host gives it. In Flotilla, letting a napplet read a closed space is the same as sharing that space with the napplet's author.
- Three established clients host napplets: Amethyst, noStrudel and Grimoire. Kehto is the main host toolkit, and its consent model still rejects a call before it asks the user.
How napplets work#
| Term | Meaning |
|---|---|
| Napplet | One self-contained index.html, stored on Blossom and described by a signed manifest event. |
| Shell | The trusted host app. It verifies napplets, embeds them, and serves their requests. Flotilla would be a shell. |
| NAP | A Nostr Applet Protocol spec for one capability domain, such as relay, storage or theme. A domain owns every domain.action message type. A shell implements any subset of domains. |
| Manifest | Kind 35129 names a napplet by d tag, kind 15129 is an author's single root napplet, and kind 5129 pins one immutable snapshot. |
A napplet moves from relays to a running frame in five steps.
35129 with one x tag holding the sha256 of index.htmlserver hintswindow.napplet bootstrapsandbox="allow-scripts", opaque origin, no storage or networkA manifest declares what the napplet needs and what it can do for others. R tags list required domains and O tags list optional ones. z tags name archetypes such as feed, and i tags name the intents the napplet accepts. None of these grant anything.
Transport and identity#
The shell injects a bootstrap that runs before any napplet script. The bootstrap creates a MessageChannel, keeps one port in a closure, and sends the other to the parent window with a single napplet.hello. The shell accepts the hello only from the contentWindow of an iframe it created, and only with exactly one port attached. It binds the napplet's identity, the pair of d tag and artifact hash, to that port. From then on it handles messages from that port and nowhere else.
Identity belongs to the document, not to the frame. A frame can navigate to unverified content and keep its Window object. The shell therefore treats a second hello, any other window message after the handoff, a second load event, or a closed port as a replaced document. In each case it closes the port, revokes every grant, and removes the frame. Closing the port is required, because a port the napplet transferred elsewhere survives the frame's removal.
Capability domains#
Each NAP is a separate spec in the napplet/naps repository. A napplet detects a domain by checking whether window.napplet.<domain> exists, and the shell decides which domains to inject for each napplet.
| Domain | Provides | Spec | Maturity |
|---|---|---|---|
identity | The user's pubkey and profile, read-only | Merged | Supported |
theme | Shell colors, fonts and changes to them | Merged | Supported |
intent | Invoke a handler by napplet:<archetype>/<intent> | Merged | Supported |
inc | Topic pub/sub between napplets | Merged | Supported |
shell | Environment snapshot and readiness | Merged | Supported |
relay | Subscribe and publish through the shell, which signs and encrypts | PR #2 | Supported |
outbox | Reads and publishing with NIP-65 routing done by the shell | PR #32 | Supported |
storage | Key-value storage per napplet and user, 512 KB | PR #3 | Supported |
upload | Blossom and NIP-96 uploads | PR #33 | Supported |
resource | Bytes from https, Blossom and nostr: URIs, fetched by the shell | PR #80 | Supported |
link | External links opened under shell policy | PR #53 | Supported |
notify | Notifications and badges drawn by the shell | PR #11 | Experimental |
dm, lists, common, keys, config, webrtc, … | Assorted | Open PRs | Experimental or exploratory |
The table reflects napplet.run on 30 November. The repository marks even the merged NAPs as draft.
Discovery#
Manifests are ordinary events, so any relay query finds them, and #R and #O filters find napplets by domain. A shell can advertise itself with a NIP-89 handler event (kind 31990) whose k tags name the manifest kinds it opens and whose N tags name the domains it can expose. A napplet with every R domain in a shell's N set runs there with full functionality.
Archetype and intent names have no registry. The napplet archetype registry was deprecated in November, and intent names are conventions that napplet authors agree on informally. Applesauce adds kind 31129 for a user's ordered handler preferences per archetype. That kind is not part of NIP-5D.
The security boundary#
NIP-5D treats every napplet as untrusted and the shell as trusted. The browser enforces the first two layers below, and the shell enforces the rest.
| Layer | Enforced by | What it blocks |
|---|---|---|
Opaque-origin sandbox, allow-scripts without allow-same-origin | Browser | Access to the shell's DOM, cookies, localStorage, IndexedDB and service workers |
Injected CSP with connect-src 'none' | Browser | fetch, WebSockets, remote images, workers and fetched frames |
| Content addressing | Shell | Bytes other than the ones the author signed. Gateways can serve bytes faster, and the shell still checks them. |
| Port binding | Shell and bootstrap | A replaced document keeping the napplet's identity and grants |
| Mediation | Shell | Key access. There is no window.nostr, and the shell signs, encrypts and decrypts on the napplet's behalf. |
These layers leave known gaps, and the spec and Kehto document them.
| Gap | Detail | Status |
|---|---|---|
| Self-navigation | CSP doesn't restrict a document navigating its own frame, so a napplet can put data it holds into a URL. NIP-5D tells shells to treat anything released to a napplet as disclosable. | Inherent to iframes |
| WebRTC | connect-src doesn't cover RTCPeerConnection. Kehto removes the RTC* globals in its bootstrap, but a nested srcdoc frame gets a fresh realm where they exist. Kehto measured this in Chromium 147 and closes it with an opt-in nested-context lock. | Mitigated in Kehto, outside the spec |
| Resource hints | Some browsers act on dns-prefetch, preconnect and prerender links despite the CSP. Shells should refuse bytes that contain them. | Shell must scan |
| Ciphertext | Shells must not sign ciphertext a napplet supplies, but no reliable test for ciphertext exists, and a napplet can disguise it. | Heuristic only |
| Side channels | NIP-5D excludes side channels and a compromised browser from its guarantees. Amethyst runs napplets in a separate Android process with no keys, which a Capacitor app can't do. | Out of scope |
Implementations and libraries#
Libraries#
Napplet authors use the @napplet packages, and shells use Kehto's. Every package is MIT-licensed and on 0.x. @kehto/shell and @napplet/shim have each published 57 releases since 19 April.
| Package | Side | Version | Role |
|---|---|---|---|
| @napplet/core | Both | 0.45.0 | Envelope types, dispatch helpers, domain selection by maturity |
| @napplet/shim | Host | 0.43.0 | The prelude that installs window.napplet before napplet scripts run |
| @napplet/sdk | Napplet | 0.39.0 | Typed wrappers over window.napplet |
| @napplet/vite-plugin | Napplet | 0.18.0 | Hashes the built index.html and writes a manifest template |
| @napplet/conformance | Test | 0.32.0 | Reference mock shell and boot fixtures for testing either side |
| @kehto/nip | Host | 0.8.1 | Manifest and artifact verification, Cache Storage artifact cache; depends only on @noble/hashes |
| @kehto/runtime | Host | 0.31.1 | Dispatch, ACL gates, service routing, sessions |
| @kehto/shell | Host | 0.36 | Iframe lifecycle, port binding, CSP and srcdoc preparation, realm locks |
| @kehto/services | Host | 0.36.0 | Reference handlers for identity, relay, theme, notify, resource and others |
| applesauce-extra/kehto | Host | 7.3.0 | Binds Kehto to an applesauce store, pool and signer; pins @kehto/shell ^0.32 |
Kehto describes itself as "far from complete", saying it "still requires the implementer to manage envelope security, process isolation, performance optimization and more". The Applesauce integration is the closest analogue to a welshman one. It exposes createKehtoHost(context, {services}), takes an approve callback for signing, and leaves consent UI, handler selection and theme to the app. Its docs pin @kehto/shell at ^0.32 while Kehto has moved on to 0.36.
Shells#
| Shell | Platform | Status | How it presents napplets |
|---|---|---|---|
| Amethyst | Android, desktop | Active development | Full-screen activity, or warm bottom-bar tabs; napplets run in a separate keyless process |
| noStrudel | Web | Active development | App store with filters, a Napplets tab on profiles, consent and intent-choice modals |
| Grimoire | Web | Active development | Tiling windows; an app command and a launcher where grants are reviewed |
| Myco | Android, Android TV | Available | Works offline; passes apps between nearby phones |
| Hypergolic | Android | Available | Workspace; pins a napplet to the home screen |
| napplet.soy | Web | Available | Playground; opens /n/<naddr> links |
| Paja | Web | Developer preview | Kehto's reference runtime for napplet authors |
| nostrapps | Web | Work in progress | One sandboxed window per app |
Three established clients host napplets: Amethyst, noStrudel and Grimoire. Their designs differ. Amethyst renders each napplet in its own process and can keep favorites warm off-screen, so switching tabs is instant. noStrudel treats napplets as content, with an app store, a Napplets tab on profiles, and detail pages. Grimoire opens them as windows in its tiling workspace.
What Grimoire's integration notes say about Kehto
Grimoire's docs/napplets.md lists the Kehto behaviors it had to work around. The first three still hold in Kehto's runtime 0.31.1, checked on 30 November: the default policy is permissive unless the host passes aclDefaultPolicy, and the only consent the runtime raises is firewall-policy. The destructive-signing consent type is declared in its types and never raised.
- Kehto's runtime creates its ACL state as permissive, and it persists every live grant when it is destroyed. Grimoire keeps its own record of grants and replays only the choices the user asked it to remember.
- ACL checks are synchronous, so a consent prompt can't hold a call open. Grimoire lets the call fail, asks the user, and reloads the frame with the grant in place.
- The runtime asks for no consent before
relay.publishsigns. Grimoire gates signing itself and attributes each signature to the frame that requested it. @kehto/aclmapsinctorelay:readandrelay:write, so grantingincnaively also grants publishing.- A browser can't enforce the
resourcedomain's private-IP rule, because a page can't see DNS results. Grimoire grants exact origins instead.
Production readiness#
- 5 Apr 2026NIP-5D opened as nips#2303Napplets reused NIP-5A site manifests and loaded from gateways.
- 16 Jun 2026Identity moves into the runtimeThe author argued that the shell must compute identity from the bytes it runs. The current text loads verified bytes through
srcdoc. - 24 Jul 2026CSP injection added
- 4 Oct 2026Event schema replacedNapplets got their own kinds, a single artifact hash,
RandOtags,zanditags, icons and screenshots. Older manifests need an adapter. - 2 Nov 2026Spec reviewKind
5129falls in NIP-90's DVM range, identity is undefined for manifests without adtag, and there is no common error envelope. All three are still open. - 21 Nov 2026Review against a formal modelA Lean model of the shell exposed port-binding gaps, which the text now closes.
- 30 Nov 2026Still open
| Area | State | Assessment |
|---|---|---|
| Core model | Small, reviewed by several implementers, checked against a formal model, with the known gaps documented | Sound |
| NIP-5D | Open PR. The schema broke in October, and three review items are open. | Moving |
| NAPs | Five merged drafts. relay, outbox and storage are unmerged. | Moving |
| Libraries | 0.x with about two releases a week. Integrations pin older ranges. | No stable API |
| Adoption | Three major clients host napplets. The 96 published releases are mostly games, demos and Nostr tools. | Early |
| Capacitor WebViews | Android shells ship napplets. Nobody reports results from Capacitor or iOS. | Untested |
Sources#
- NIP-5D draft and discussion: nostr-protocol/nips#2303, text at dskvr/nips 5D.md
- NAP specs: napplet/naps, including
projections/web.md,NAP-INTENT.mdandNAP-SHELL.md - napplet.run docs, protocol status and app listing
- Kehto: kehto/web, mainly
docs/tutorials/minimal-host-shell.md,docs/policies/NIP-5D-CONFORMANCE.mdanddocs/packages/shell.md - Applesauce hosting docs: apps/docs/napplets
- Hosts: Grimoire docs/napplets.md, Amethyst's
amethyst/plans/archive/2026-06-24-napplet-embedded-tabs.md, noStrudel's napplet changesets - npm registry metadata for release counts, as of 30 Nov 2026