# Deftlet
`deft/stdext/deftlet` is the panel-app module contract. It separates
module loading from instantiation: a panel file imports deftlet,
declares `implements Deftlet`, and exports `get-panel` (plus optional
`get-menu` / `get-margins`). Importing it also opts the panel into the
debug-attach protocol.
import "deft/stdext/deftlet"
## Contract
| Method | Signature | Description |
|---|---|---|
| `get-panel` | `{||}` | Return the Panel value to mount (build state, spawn coroutines here) |
| `get-menu` | `{||}` | Return the app's menu map (optional) |
| `get-margins` | `{||}` | `%{ left right top bottom }` margins (optional) |
import "deft/stdext/deftlet" def get-panel {|| # init state, spawn coroutines… %MyView{ label "My App" } }
Every shipping app in the tree is written this way — see the
App Platform chapter for the panel model and
the Editor help for a large real example.
## Debug Attach
Importing deftlet transitively imports
debug-host and subscribes the panel to
`debug-attach-request` and `debug-detach`, forwarding to the real
handlers. The result: any deftlet-based panel can be attached to by the
shell/editor debugger without extra wiring — the shell publishes an
attach request with the target panel id, the panel starts a debug
server, and announces its port.
## See Also
- App Platform — workspaces and panel apps
- Debugging — the attach protocol, client and host
- Debug server — the JSON-RPC protocol