Flotilla integration
This page lists where napplets appear in Flotilla and how each surface is built. Flotilla's UI calls napplets apps. A napplet that handles a custom content type fills the same places as Flotilla's native types, and Flotilla keeps everything that works on any event native around it.
Surfaces#
| Surface | Appears in | Opens | Scope | Milestone |
|---|---|---|---|---|
| Manifest card | Chat, quotes, notes | /apps/[naddr] | Global | M0 |
| Link to a napplet | /[bech32] with a manifest naddr | /apps/[naddr] | Global | M1 |
| Directory | Apps item in the space menu | /spaces/[relay]/apps | Space | M2 |
| Pinned app | Pinned apps in the space menu | /spaces/[relay]/apps/[address] | Space | M2 |
| Content list | A section in the space menu | /spaces/[relay]/content/[kind] | Space | M3 |
| Content detail | Cards, links, activity | /spaces/[relay]/content/[kind]/[id] | Space or room | M3 |
| Create form | Compose menu, create menu, list page | Modal | Space or room | M3 |
| Edit form | Event menu, for the author | Modal | Space or room | M3 |
| Item | Chat, feeds, activity | Inside a native card | None | M3 |
| App room | Room list | /spaces/[relay]/[h] | Room | M5 |
Custom content types#
A content-type napplet advertises surfaces with intents that carry the kind, as the spec page describes. Flotilla's native content types all follow one pattern, and each part of the pattern gets a napplet equivalent.
| Native pattern | For an installed kind |
|---|---|
| CONTENT_KINDS and showSection | Kinds with a list surface among the space's installed apps. Their sections always show. |
| makeContentPath | A default branch to /spaces/[relay]/content/[kind] for installed kinds |
| NoteContent<Kind> | NoteContentCustom, from the app's icon and the event's alt tag |
| NoteContentMinimal<Kind> | NoteContentMinimalCustom, the same way |
| ComposeMenu and PostCreateMenu items | One item per create surface, opening the form in a modal |
| <Kind>Edit components | An Edit item in EventMenu that opens the edit surface |
| List and detail routes per kind | The two content routes, rendering the list and view surfaces |
| Comments, reactions, zaps, bookmarks, reports | Unchanged. These components take any event. |
| Unread dots | registerActivity for installed kinds |
Flotilla only uses surfaces from apps installed in the current space. An app that isn't installed can't add a menu section or claim a kind.
Creating. The compose menu in a room opens the create surface in a modal, in room scope, and shares the result to chat as native types do with shareToChat. The space's create menu and the list page's New button open it in space scope. A create or edit surface ends when the napplet publishes one event of the surface's kind. Flotilla then closes the modal, and the publish keeps its undo toast.
Viewing. The detail route gives the napplet frame the content column. Comments and reactions sit in a side panel on wide layouts and behind a button on narrow ones, so the frame never has to report its height. The list route works the same way without the panel.
Items. Flotilla draws the card around every custom event: its author, time, reactions and menu. The item surface is only the content inside it. A frame per item would be too heavy in a chat, and rendering items natively is outside napplets' scope, so NoteContentCustom fills the card with the app's verified icon and title, the event's NIP-31 alt text and an Open button. Events without alt show the app's name only. Items never start a frame.
Labels. A menu section uses the list surface's label from P1, and falls back to the manifest's title.
Pinned apps#
An installed napplet that accepts a parameterless napplet:<archetype>/open appears under Pinned apps in the space menu, with its verified icon. It opens at /spaces/[relay]/apps/[address] in space scope. The page header shows the app's icon, title and author, says who installed it, and has a permissions menu and a reload button.
The frame closes when the user leaves the page, and the napplet keeps its state in storage. An app that has to keep running across pages, such as a music player, would need an app-level layer like CallBanner in AppContainer. That isn't planned.
App rooms#
A room whose metadata names an installed napplet is an app room. getRoomType returns a new RoomType.App, as it returns RoomType.Voice for the livekit tag. The room page shows the napplet beside the room's chat on wide layouts, the way RoomCallPane shares a room with a call, and as a tab beside the chat on narrow ones. The napplet runs in room scope, so it reads and writes only the room's events, and its audience is the room's members.
RoomCreate gains an app choice among the space's installed apps. App rooms need the relay to keep the extra metadata tag, which the hosting page covers.
Directory#
/spaces/[relay]/apps lists the manifests the space relay holds, with installed apps first. Members open an app from the directory in space scope, after the consent prompt. Admins see an Install button. On hosted relays, it links to the hosting panel. On other relays, it adds the app to the admin-signed app list. The Apps item in the space menu appears when the relay holds manifests or has installed apps.
App lists#
deriveSpaceApps(url) reads the space's app list. It trusts a list signed by the relay's own key, and otherwise the newest list signed by one of the space's admins. Each entry resolves to the author's pinned snapshot, and Flotilla notices when the author's address points at a newer version. The list decides what the space menu, the compose menu and the custom cards show, and the trust model decides what each installed app may do.
Cards and links outside spaces#
NoteContentNapplet renders a manifest wherever an event can appear: icon, title, author, description and an Open button. Opening it starts /apps/[naddr] in global scope, after the consent prompt. getEventPath sends manifest kinds there, so /[bech32] links and permalinks open the app.
An event of an installed kind links to its detail route in the space that installed the app. Elsewhere, it opens in the note overlay with the fallback item.
Consent and settings#
NappletConsent covers the first open of an app that isn't installed in the current space. It shows what the app requires, what Flotilla will give it and which space it can read. A publish prompt shows the kind, a preview of the content and its destination. Both are dialogs that components/flows/napplets.ts opens for the ask function.
Settings → Apps lists every app the user has opened. Each entry shows the app's grants, has a switch that turns the app off on this device, and can clear its storage. The permissions menu on an app page shows the same entry.
Search, activity and moderation#
- Unread dots on custom sections come from
registerActivity, as they do for native types. SpaceSearchmatches installed apps by name, and custom content by itsalttext.- Admins delete custom content from
EventMenu, which already works on any kind. Reports work the same way.
Mobile#
App pages fill the page between the header and the bottom nav, and Flotilla's own chrome handles safe areas. Create and edit forms open as full-screen sheets. ENABLE_NAPPLETS is off on iOS at first, as ENABLE_HOSTING and ENABLE_PAID_SPACES are, because App Review guideline 4.7 holds the host app responsible for mini apps. The host page has to pass on Android's WebView and on WKWebView before the flag turns on for mobile.
Files#
- src
- app
- components
- NappletFrame.sveltemounts the host page and opens a session
- NappletConsent.svelte
- NappletHeader.svelteicon, title, author, installer, permissions
- NoteContentNapplet.sveltemanifest card
- NoteContentMinimalNapplet.svelte
- NoteContentCustom.svelteitem content for an installed kind
- NoteContentMinimalCustom.svelte
- SpaceMenuApps.sveltepinned apps
- RoomApp.svelteapp beside the room's chat
- SpaceMenuNavItems.sveltecustom sections and the Apps item
- ComposeMenu.sveltecreate items
- PostCreateMenu.sveltecreate items
- EventMenu.svelteEdit for installed kinds
- NoteContent.sveltefinal branch for installed kinds
- NoteContentMinimal.svelte
- RoomCreate.svelteapp rooms
- areas/spaces/rooms
- room.tsRoomType.App
- navigation
- pages.tsapp and content routes
- locations.tsmanifests and installed kinds
- routes
- apps/[naddr]
- +page.svelte
- spaces/[relay]
- apps
- [address]
- +page.sveltepinned or directory app
- +page.sveltedirectory
- content/[kind]
- [id]
- +page.svelteview surface
- +page.sveltelist surface
- settings/apps
- +page.svelte
- svelte.config.jsframe-src 'self'
Work#
| Milestone | Items |
|---|---|
| M0 | NoteContentNapplet and NoteContentMinimalNapplet for manifests. getEventPath for manifest kinds. |
| M1 | NappletFrame, the /apps/[naddr] route, NappletConsent for first open, the CSP change, ENABLE_NAPPLETS. |
| M2 | Directory route, SpaceMenuApps, deriveSpaceApps, admin pinning from the directory, publish prompts and the undo toast, Settings → Apps. |
| M3 | Content routes, fallback items, menu sections, compose and create items, Edit in EventMenu, activity and search for installed kinds. |
| M5 | RoomType.App, RoomApp with the chat split, app rooms in RoomCreate, notify badges. |