Napplets in Flotilla
Communities on Flotilla install apps on their relay. An app can add a content type such as wiki pages or tasks, appear as an item in the space menu, or take over a room. Apps are napplets (NIP-5D), so each one is built once and runs in any space and in any compatible shell. This page summarizes the plan, and each area has its own page.
What gets built#
- Content types. A napplet declares the kinds it handles and the surfaces it renders for them: a create form, an edit form, a detail page, a list page and the content of an item. Flotilla puts each surface where its native content types already go: the compose menu, the space menu, chat cards and detail routes. Comments, reactions, zaps, bookmarks and unread counts stay native around the napplet's content.
- Pinned apps. A napplet with a parameterless
openintent becomes an item in the space menu when an admin pins it. - App rooms. A room whose metadata names a napplet runs the app beside the room's chat.
- Directory. Each space lists the napplets its relay holds. Members open them with consent, and admins pin from the list.
- Installing. Admins of hosted relays install apps and bundles from the hosting panel. Admins elsewhere pin from the directory.
- Links and cards. A napplet shared in chat shows as a card, and a link to one opens it outside any space.
Decisions#
These hold across every area page.
- Napplets run in a scope: global, a space, or a room. Flotilla enforces the scope, and the proposed
contextNAP tells the napplet which space or room it serves, so the same build works in every space. - Kinds go in the intent:
napplet:kind-1068/viewnames the detail surface for kind 1068. Admin pins decide whether an app appears, and its intents decide where. - Admins install apps per space. A pin names an exact version.
- Apps installed by admins run without prompts inside their own space, for actions that stay in the space. Posting as the user goes through Flotilla's delayed send with an undo toast that names the app.
- Napplets never receive event signatures.
- Flotilla embeds napplets through a static host page with its own CSP.
- Welshman gets a host core written from scratch,
@welshman/napplet. It reuses Kehto only for verification and frame preparation.
One build for every space#
A napplet doesn't need to be built for a particular space. Building per space would also be harmful: each build would have different bytes and so a different identity, which rules out a shared catalog, shared caches and one update for every space.
Instead, the shell runs each instance in a scope and rewrites its requests. NAP-RELAY already lets the shell choose relays when a request names none, so this "single relay mode" is shell policy, and it can differ between shells. The napplet learns where it runs from a proposed context NAP, whose context.get() returns one string: the relay URL for a space, or url'h for a room. A napplet that wants names or pictures loads the relay's NIP-11 document or the room's metadata itself.
| Napplet call | What the shell does in a room scope |
|---|---|
relay.subscribe for kind 30818 | Sends it to the space relay with #h set to the room |
outbox.publish(template) | Adds the room's h tag, publishes to the space relay only, through the delayed send |
relay.subscribe naming another relay | Refuses it |
outbox.query for kind 0 profiles | Uses normal outbox routing, since profiles are public and live outside the space |
context.get() | Returns wss://relay.example.com'game-night |
storage.setItem | Stores the value under the napplet, the user and the space |
Two specs need changes for this to be compliant. NAP-OUTBOX publishes to the user's own write relays by default, which would leak a private space's posts. NAP-STORAGE keys storage by artifact hash and has no space partition. The spec page covers both, and the trust model covers what each scope allows.
Architecture#
| Layer | Where | Responsibility | Page |
|---|---|---|---|
| Upstream specs | NIP-5D and napplet/naps | Kind intents, a context NAP, unsigned events, stable storage keys, app lists | spec |
| Host page | New dependency-free package, bundled by each shell | Napplet frame, port handoff, teardown signals, CSP floor | host |
| Host core | @welshman/napplet | Verification, sessions, dispatch, scopes, policies, intent routing | core |
| Welshman glue | Napplets plugin in @welshman/app | Domain handlers built on welshman's network, router, publisher and profiles | glue |
| Flotilla core glue | app/tools/napplets | Flotilla's policies, storage, theme, intent handlers and hooks | glue |
| Flotilla UI | components, routes, areas/spaces | Content types, pinned apps, app rooms, directory, cards, consent | flotilla |
| Hosting and relay | Hosting panel, hosting backend, zooid | Installing apps, Blossom mirroring, relay-signed app lists, kind policy | hosting |
| First-party napps | Separate repositories | Authoring kit and the built-in apps | napps |
A publish from an app installed in a room takes this path.
outbox.publish(template)h, removes other relays, signsThe host page only sets up the channel. After the handoff, the napplet's port talks to Flotilla directly.
Milestones#
| Milestone | Delivers | Done when | |
|---|---|---|---|
| M0 | Cards | Manifest kinds and reader in welshman. Manifest cards and links in Flotilla. Spec conversations open. | No napplet code runs. |
| M1 | Run | Host page. @welshman/napplet with identity, theme and reads. Apps open from cards and links in global scope behind ENABLE_NAPPLETS. | @napplet/conformance passes, and the host page works in both Capacitor WebViews. |
| M2 | Spaces | Scopes, storage, publishing with undo, the directory, admin app lists, pinned app items, Settings → Apps. | Nothing a scoped app publishes leaves its space. A third-party napplet runs in a space. |
| M3 | Content types | Content surfaces, compose menu items, list and detail routes, fallback items. A Polls napp, then Wiki. | The Polls napp matches native polls. |
| M4 | Hosting | Install, update and remove from the hosting panel. Blossom mirroring, relay-signed app lists, kind policy, bundles. | Install, use, update and uninstall on a hosted relay. |
| M5 | Rooms and badges | App rooms and notify badges. | Relays keep a napplet tag in room metadata. |
Upstream proposals run alongside every milestone. Most of the behavior Flotilla needs is shell policy that today's specs already allow, such as choosing relays and dropping signatures, so it ships before the proposals merge. The kind intents and the context NAP are Flotilla conventions until upstream accepts them. Kind intents already fit today's intent grammar.
Areas beyond the original list#
- Trust model. Scopes, grants, pins and data minimization touch every layer, so they have one page.
- Relay support. Zooid has to accept installed apps' kinds, sign app lists, store mirrored artifacts and keep a room's app tag. This is on the hosting page.
- First-party napps and the authoring kit. Someone has to build the apps the hosting panel offers, and a development mode lets authors load an unsigned napplet in a Flotilla dev build. Both are on the napps page.
- Mobile. The host page has to work in Android's WebView and iOS's WKWebView before the flag turns on for mobile. That is a gate for M1.
- Activity, search and moderation. Custom kinds need unread counts, search through their
alttags, and admin deletion. Flotilla's existing hooks and event menu cover these, as described on the Flotilla page.
Open questions#
| Question | Recommendation | Page |
|---|---|---|
| How does a pin name a version with the author's signature? | Pin author-signed snapshots (kind 5129), and have the napplet CLI publish one on every deploy. | spec |
| Where does the host page package live? | Build it without welshman dependencies in the welshman monorepo, and offer it to the napplet org once its API settles. | host |
| Does a space scope include content posted in rooms? | Match Flotilla's native list pages for the same surface. | flotilla |
| Who signs app lists on relays the platform doesn't host? | Space admins, verified against the space's roles. | hosting |
| Which kinds do new content types use? | Existing NIP kinds where they fit. New kinds get a NIP draft before they ship in a bundle. | napps |
| Are napplets on iOS? | Off at first, like hosting and paid spaces. | flotilla |
Risks#
| Risk | Mitigation |
|---|---|
| Upstream rejects the context proposal, and Flotilla's napps only run in Flotilla | Propose early and keep each proposal small |
The napplet packages keep breaking, with 47 releases of @napplet/core since April | Depend on few modules and pin them exactly |
| An admin-installed app misuses prompt-free publishing | Pins name exact versions, scopes confine publishing, and every post has an undo window |
| Many frames make mobile slow | Items in chat render from alt text without a frame, and frames are limited to forms, pages and rooms. Rendering items natively is outside napplets' scope. |
| App Review rejects napplets on iOS | Keep napplets off on iOS, as hosting and paid spaces are |