30817:nip-decks-flashcards

Decks and Flashcards

Anjhc

published
2025-06-17

NIP-DF: Decks and Flashcards

Summary

Defines a standard format for representing decks of flashcards and flashcards themselves as Nostr events, including how to link flashcards to their parent decks.

Tags

deck, flashcard, learning, education


Motivation

There is currently no standard way in Nostr to create structured learning materials like decks of flashcards. This NIP enables:

  • Users to create decks and share them.
  • Flashcards to be attached to decks.
  • Flashcards and decks to be synchronized, versioned, and distributed across clients.

Event Kinds

Kind Name Description
30500 deck Defines a deck of flashcards
30501 flashcard Defines a flashcard attached to a deck

Deck Event (kind: 30500)

A deck event represents a named collection of flashcards.

{
  "kind": 30500,
  "tags": [
    ["d", "<deck-id>"],
    ["name", "Basic Math"],
    ["description", "A deck of flashcards covering basic arithmetic."],
    ["subject", "Mathematics"],
    ["version", "1"]
  ],
  "content": ""
}

Required Tags

  • ["d", <deck-id>]: A unique ID for the deck (deterministically derived or randomly generated).
  • ["name", <deck-name>]: The display name of the deck.

Optional Tags

  • ["description", <text>]: A human-readable description.
  • ["subject", <topic>]: Topic or category (e.g., history, math, science).
  • ["version", <version>]: Version number for content updates.

Flashcard Event (kind: 30501)

A flashcard event represents a single question/answer pair.

{
  "kind": 30501,
  "tags": [
    ["d", "<deck-id>"],
    ["order", "3"],
    ["version", "1"]
  ],
  "content": "{\"front\": \"What is 2 + 2?\", \"back\": \"4\"}"
}

Required Tags

  • ["d", <deck-id>]: The deck ID this flashcard belongs to.

Optional Tags

  • ["order", <index>]: Index within the deck (integer or string).
  • ["version", <version>]: Version of the flashcard.

Content Format

Must be a JSON object:

{
  "front": "Question or prompt",
  "back": "Answer or explanation"
}

Optionally, clients may support extra fields such as "hint" or "media".

Deterministic Deck ID

Clients may derive the <deck-id> using a sha256(pubkey + created_at + name), or generate it randomly (e.g., uuidv4()), ensuring uniqueness.

Extensions (Future NIPs)

  • Progress tracking: Add kind: 30502 to log study sessions or flashcard scores.
  • Collaboration: Multi-author decks.
  • Flashcard types: Support multiple choice, true/false, cloze deletion.
  • Media support: Embed or link images/audio.

Backward/Forward Compatibility

Clients not recognizing kind: 30500 or 30501 will safely ignore them.

Use Cases

  • Personal study apps
  • Public learning repositories
  • Flashcard marketplaces
  • Collaborative classroom tools

Example Flow

  1. Alice creates a deck Basic Spanish (kind: 30500).
  2. Alice creates 10 flashcards (kind: 30501) tagged with the deck ID.
  3. Bob subscribes to Alice’s pubkey and loads the deck and cards.
  4. Bob studies and optionally tracks his progress with kind: 30502.

Discussion

Connect a key to comment.