{"id":"47b36b0366f6dcdcd0b390d76c9b3ad1ed5cb930c569ece0f3ef934e7ade7a39","pubkey":"fd208ee8c8f283780a9552896e4823cc9dc6bfd442063889577106940fd927c1","created_at":1787997678,"kind":30817,"tags":[["d","nkbip-04"],["client","imwald"]],"content":"# Directories\n\nThis NKBIP-04 spec describes a Nostr directory system, modeled after kind `30040` publication indexes and inspired by UNIX directories.\n\n> **UNIX directory system**\n>\n> On UNIX, a directory is a list of names that point at files. Some of those files are themselves directories, so the lists nest into a tree. Opening a directory \"folder\" means reading that list; a nested directory is just another name in that list.\n\nKind `30045` is that list on Nostr. It uses the same structure as a `30040` from [[NKBIP-01]]: empty `content`, a `d` tag, a `title` tag, and child `a` / `e` tags. Nested directories are 30045s listed in those tags.\n\n## Directory Event\n\n### Kind `30045` MUST\n\n* have empty `content`\n* contain a `d` tag unique for kind + pubkey, normalized to a [[NIP-54]] style slug. This is the directory ID.\n* not refer to themselves with a-tags or e-tags\n\n### MAY\n\n* have zero or more child tags, using the standard [[NIP-01]] tag format, followed by an optional, human-readable label\n* contain a `title` tag, the display name shown on the directory\n\n### Further hints\n\n* Use `a` tags for addressable children and subdirectories.\n* Use `a` tags without d-tags for replaceable events, such as profile kind `0`.\n* Use `e` tags for events that are not replaceable (e.g. external files or short text notes).\n* Any kind MAY be a child. A kind `30045` child is a subdirectory.\n* Tag order is the default display order, but your client may choose to display them in a different order or allow sorting by the label or created_at timestamp.\n\n### Example\n\n```json\n{\n  \"kind\": 30045,\n  \"pubkey\": \"f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca\",\n  \"content\": \"\",\n  \"tags\": [\n    [\"d\", \"planning-2026\"],\n    [\"title\", \"Alice's Spring 2026 Planning\"],\n    [\"a\", \"30045:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:planning-january\", \"wss://relay.example.com\", \"January\"],\n    [\"a\", \"30045:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:planning-february\", \"wss://relay.example.com\", \"February\"],\n    [\"a\", \"30045:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:planning-march\", \"wss://relay.example.com\", \"March\"],\n    [\"a\", \"30045:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:planning-april\", \"wss://relay.example.com\", \"April\"],\n    [\"e\", \"5c83da77af1dec6d7289834998ad7aafbd9e2191396d75ec3cc27f5a77226f36\", \"wss://relay.example.com\", \"f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca\", \"Spring Overview\"],\n    [\"a\", \"0:f7234bd4c1394dda46d09f35bd384dd30cc552ad5541990f98844fb06676e9ca:\", \"wss://relay.example.com\", \"My vacation profile\"]\n  ]\n}\n```\n\n## Client Recommendations\n\n* Walk nested directories with a cycle/depth guard.\n* Refer to external files with kind `1063` file metadata events.\n* Link to websites with kind `39701` web bookmarks.\n* Render directories in GUIs as a tree of directory and file icons, but differentiate between Nostr-native events and external files that are merely referenced in an event.","sig":"0e13f7482cb832fe699cfdd56d313dc838c67cb1234b9f1aa05aab0fffa5efd857b7057c394a0f1c11a02ae90d1dd0bc08ef17ffee2576b108b49ec59b97180a"}