SOURCE / PINNED RELEASE
Made of little things.
The Bathyal Post
- Release
- fa6ce530b9f3…
- Author-recorded commit
- b255b3c9fd49…
- License
- LICENSE
- Author’s source reference
- nostr://npub182jczunncwe0jn6frpqwq3e0qjws7yqqnc3auccqv9nte2dnd63scjm4rf/wss%3A%2F%2Fgit.napplet.soy%2F/n-55c50b9a042
Archive hash verified: 03cf62191e7476c5…. The source-to-build association is the author’s claim; it has not been independently rebuilt.
---
name: napplet-make
description: Use when a user asks to create, build, implement, prototype, or port a complete napplet (sandboxed Nostr iframe applet) in one prompt. Entry point that triages the project state and toolchain, then routes through napplet-port (if migrating), napplet-design, napplet-ui, napplet-build (+ napplet-sdk / napplet-interop as needed), and napplet-test, and ends with an evidence report. Keeps social reads and publishes OUTBOX-first and treats NAP-RELAY as an explicit escape hatch only.
---
# Making a Napplet End to End
Top-level workflow for "build me a napplet". Do not jump to code. The goal is a working, conformant, responsive applet with its own visual direction whose authority boundaries are right on the first pass.
Protocol truth: NIP-5D (<https://github.com/nostr-protocol/nips/pull/2303>) and the NAPs track (<https://github.com/napplet/naps>). Use only the surface shipped by the installed `@napplet/*` packages. Never invent message types, domains, manifest tags, loading rules, or shell authority to satisfy a prompt; a needed-but-undefined surface is a gap to report.
## Which skills, in which order
| Request | Route |
| --- | --- |
| New napplet from an idea | `napplet-design` → `napplet-ui` → `napplet-build` → `napplet-test` |
| Port an existing Nostr app / client / widget | `napplet-port` → `napplet-design` → `napplet-ui` → `napplet-build` → `napplet-test` |
| Add a feature to an existing napplet | Re-run `napplet-design` for that feature's boundary → `napplet-build` → `napplet-test` |
| Change only layout / visuals | `napplet-ui` → `napplet-test` (four-frame + theme checks) |
| Debug or verify a built napplet | `napplet-test`; edit only after reproducing the failure |
| Needs a NAP / domain the packages do not ship | Stop and flag the gap; do not fake it |
Load `napplet-sdk` while writing calls and `napplet-interop` only if the spec has cross-napplet features.
## Step 1 — Brief
```
d-tag / deployment name:
new build or port:
single-purpose job (one line):
must-have flows:
optional flows:
visual direction: main experience and surrounding UI; see docs/napplet-visual-design.md
form factor: sizes it must survive; minimum (if any)
target runtime assumptions:
known protocol / package gaps:
```
Split a "whole app" request into focused napplets unless the user explicitly wants one compound napplet that still works in a small frame.
## Step 2 — Inspect the existing soyLI workspace
Read docs/napplet-space.md before running tools. The project and its skills are
already installed. Inspect package.json, napplet.json, vite.config.ts and src/.
Do not run another scaffold/init command or reinstall skills.
Use soyli setup for a fresh checkout, soyli run verify for the project checks,
soyli run test:conformance for upstream conformance and soyli check for the host.
Use soyli dev and its printed URL for interactive preview; stop your owned session
after testing. If a surrounding studio owns the preview process, let it manage
that lifetime. A raw Vite URL is not a hosted napplet preview.
Preserve compatible build configuration, dependencies and source history when
contributing to an existing project. Read the installed napplet-port skill when
porting application code. Load the relevant downstream skills explicitly:
napplet-ui for visuals and napplet-test before calling the result verified.
## Step 3 — Non-negotiables while executing
- **Sandbox authority.** No `fetch`, XHR, WebSocket, browser storage, cookies, `window.nostr`, external scripts/styles/images, relay pools, or signing in napplet code. Bytes → bundled or `resource`; state → `storage`; Nostr → `outbox` / `common` / `lists` / `count` / `dm`; links → `link`; `relay` only for a named relay-local escape hatch recorded in the brief.
- **Project-specific design.** Design the content/scene and UI together; choose density and composition for the interaction. Keep it responsive and avoid redundant website chrome (`napplet-ui`).
- **SDK-first.** `@napplet/sdk` wrappers for calls; `window.napplet?.domain` only for optional-domain gating. No `shell.ready()` / `shell.supports()` / service probes — they do not exist.
- **Requires = hard only.** Bare domain names; `keys`, `theme`, `config`, `notify`, `resource`, `inc`, `intent` almost never belong there.
- **Theme is a design choice.** Keep app-owned colors by default. Opt into host matching or a scoped hybrid deliberately; test the chosen policy using docs/napplet-visual-design.md.
## Step 4 — Definition of done
"Done" means all of these, with evidence in the final report:
- `pnpm verify` and `pnpm test:conformance` pass in the project (or the retrofit equivalents).
- Boundary audit from `napplet-test` is clean; every `relay` use has a written reason.
- `napplet-ui` four-frame check (`200×160`, `320×560`, `900×600`, largest available) in dark and light: intended palette preserved or opted-in surfaces updated, no clipped controls, minimum notice correct if declared.
- local `requires` (published as `R`) matches the spec's hard list; `napplet.json` owns portable metadata; use docs/napplet-manifest.md.
- soyLI sandbox preview checked. Separately test the same artifact in an independent shell (such as Paja), or explicitly report that compatibility as unverified.
- Any protocol/package gap listed as a gap, not papered over.
Report: changed files, NAP domains used and why, relay escape hatches, frames and themes checked, commands run with results, untested gaps.
## soyLI manifest metadata
Before publication or changing capabilities/discovery, read docs/napplet-manifest.md. Save metadata in napplet.json; the publisher creates the signed event. Choose optional archetypes in napplet.json for what the napplet does (game for games). Consult https://archetypes.napplet.run/ for observed spellings; new names are valid. Keep descriptive topics separate. For opt-in public rooms follow docs/napplet-backend.md, retain manual entry and never advertise private rooms or guest keys. Advertise only implemented intents and optional integrations, and verify their absent-domain fallbacks.
## soyLI controller input (NAP-GAMEPAD)
Read this before adding, porting or testing USB/Bluetooth gamepad support. Read
docs/napplet-controllers.md for the full guide and use docs/examples/gamepad.ts.
**Protocol.** Controllers follow the NAP-GAMEPAD draft,
https://github.com/napplet/naps/pull/130 (draft revision 0b28f77e3dfa0f07dd7c0f9d61a7090ee99f3a5e). The upstream shim supplies the standard binding over the private NIP-5D port. Controllers are browser-wide devices, so the soyLI
runtime is their only native reader. It denies the native API to napplet frames
(Permissions-Policy `gamepad 'none'`) and pushes `gamepad.state` snapshots to
the napplet that holds input focus. Other napplets see connected pads with zero
axes/buttons and `timestamp` 0.
**How it is patched in.** The host prelude runs before your scripts. Where the
native `navigator.getGamepads()` exists but is denied, it replaces only
`Navigator.prototype.getGamepads` with a reader of the latest snapshot and sends
one `gamepad.subscribe`. Pads keep native `Gamepad`/`GamepadButton` prototypes,
in slot order with `null` gaps. `gamepadconnected`/`gamepaddisconnected` arrive
as `GamepadEvent`s through listeners and `on…` handlers. A host `blocked` state
throws `SecurityError`; `unavailable` returns empty slots. Where native access is
allowed or there is no Gamepad API, the native API is untouched; the standard binding subscribes on first use. The shim also exposes the
optional `window.napplet.gamepad`: `getGamepads()`, `available`, `focused` and
`onChange(callback) → { close }`. It is installed independently of native API replacement.
**Build rules.**
- Write ordinary Gamepad API code: poll `navigator.getGamepads()` once per
`requestAnimationFrame`, or use `createGamepadInput` from the bundled helper.
The same code runs on hosts with native access. Feature-detect
`window.napplet?.gamepad` only for its `focused`/`available` state.
- Gamepad is optional. Do not add `gamepad` (or SERIAL) to `requires`; keep
complete keyboard and pointer/touch controls. Use NAP-KEYS (`keys`) for named
keyboard actions when the game has them.
- Treat `focused: false` as idle input: pause or freeze controller-driven
actions; do not treat the neutral snapshot as release events. Do not fire a
press for a button already held when focus returns; the helper waits for
`focused: true` for you.
- Route players by `pad.index`, never array position. Handle disconnect by
clearing that player's input. Do not use `pad.id` as an identity.
- Expect about one host frame of extra latency and no rumble
(`vibrationActuator` is `null`). `event.isTrusted` is `false`; do not gate on it.
Do not rely on own-property shape, `JSON.stringify(pad)` or `[native code]`.
- Show players that the napplet must be clicked/focused to receive controller
input, for example on the title or pause screen.
**Verify.** Use the Controller tester in soyli dev, then click the napplet to give
it input. Check movement, edges (one press per press), pause on focus loss, no
phantom press on refocus, disconnect/reconnect and keyboard/touch fallback.
Synthetic or simulated input and soyli check are not hardware tests: report
physical-controller and Safari/Firefox coverage separately.
