{"id":"9523f6bdfe08b737dc495a2deef0718c23937f5cae76e4d479f5de43555bc177","pubkey":"fd208ee8c8f283780a9552896e4823cc9dc6bfd442063889577106940fd927c1","created_at":1787987174,"kind":30817,"tags":[["d","nostr-specification-1787987038"],["client","imwald"]],"content":"# NKBIP-04: Directories\n\nThis 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\nKind `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* contain a `title` tag, the display name shown on the directory\n* events MUST NOT refer to themselves with a-tags or e-tags\n\nMAY have zero or more child tags, using the standard [[NIP-01]] tag format, followed by an optional, human-readable label.\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```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":"1eb41f1c3fe2640b9e3367c64044a3b86cc2679aaa4cf15fedda5271451b6b0dc4cc1ed35d3b8aa415ee556562c02a7bae125a746e73649ce28d0e6d33a2e42f"}