npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

remotestorage-module-flashcards

v2.4.0

Published

remoteStorage.js data module for flashcards with spaced-repetition review state

Readme

remotestorage-module-flashcards

A remoteStorage.js data module for flashcards, including spaced-repetition review state (FSRS card model).

Cards are stored at /flashcards/<group>/<id>. A group exists as long as it contains at least one card. Settings shared between devices and a log of reviews are stored next to them.

Install

bun add remotestorage-module-flashcards remotestoragejs

Requires remoteStorage.js 2.x.

Usage

import RemoteStorage from "remotestoragejs";
import Flashcards, { type FlashcardsApi } from "remotestorage-module-flashcards";

const rs = new RemoteStorage({ modules: [Flashcards] });
rs.access.claim("flashcards", "rw");
rs.caching.enable("/flashcards/");

const flashcards = (rs as unknown as { flashcards: FlashcardsApi }).flashcards;

const card = await flashcards.store({ frontText: "pivo", backText: "beer", group: "food" });
await flashcards.store({ ...card, group: "drinks" }, { previousGroup: "food" }); // moves the card

API

| Method | Description | | --- | --- | | store(card, { previousGroup? }) | Create or update a card. Generates @id (UUID) and ISO timestamps. When previousGroup differs from card.group, the old copy is removed. Resolves with the stored card. | | get(group, id, maxAge?) | One card, or undefined. | | remove(group, id) | Delete one card. | | listGroups(maxAge?) | Sorted group names. | | getAllByGroup(group, maxAge?) | Cards in a group. | | getAll(maxAge?) | Cards in all groups. | | removeGroup(group) | Delete every card in a group. | | getSettings(maxAge?) | Settings shared by every device ({} until some are saved). | | setSettings(changes) | Change some settings and keep the rest. Resolves with all of them. | | logReview(entry) | Add a review to the log. | | unlogReview(entry) | Take a review back out (same at, cardId and direction). | | getReviewLog(maxAge?) | Every logged review, oldest first. | | on("change", handler) / removeEventListener(...) | remoteStorage.js change events for the scope, including the settings (.settings) and log (.log/<day>) documents. |

maxAge is passed through to remoteStorage.js; use false to read from the local cache without waiting for a sync.

Also exported: normalizeFlashcard, normalizeSettings, normalizeReviewLog (for the newValue of change events), normalizeDate, normalizeGroup, SETTINGS_PATH, LOG_FOLDER, the JSON schemas, and the Flashcard / ReviewState / Settings / ReviewLogEntry types.

Data format

{
  "@id": "3f0c…",              // UUID (v1 used YYYYMMDD-HHMMSS)
  "@type": "flashcard",
  "frontText": "pivo",
  "backText": "beer",
  "hint": "Dám si pivo.",      // optional: a hint for the front, when it is the question
  "backHint": "I'll have a beer.", // optional: a hint for the back, when it is the question
  "extra": "Plural: piva",     // optional: more about the answer, shown with it
  "group": "food",
  "createdAt": "2026-01-02T03:04:05.000Z",
  "updatedAt": "2026-01-02T03:04:05.000Z",
  "review": {                  // optional, absent until first review
    "algorithm": "FSRS-7",
    "due": "2026-01-05T03:04:05.000Z",
    "stability": 3.17,
    "stabilityFast": 2.81,     // FSRS-7 only
    "difficulty": 5.28,
    "elapsedDays": 0,
    "scheduledDays": 3,
    "learningSteps": 0,
    "reps": 1,
    "lapses": 0,
    "state": 2,                // 0 new, 1 learning, 2 review, 3 relearning
    "lastReview": "2026-01-02T03:04:05.000Z",
    "firstReview": "2026-01-02T03:04:05.000Z" // when it stopped being new
  },
  "direction": "both",         // optional: "reverse" (back → front) or "both"; absent = front → back
  "reverseReview": { /* same shape as review, for back → front */ },
  "reviewedCount": 1,          // kept for v1 readers
  "reviewedAt": "2026-01-02T03:04:05.000Z"
}

Settings

One document at /flashcards/.settings, so every device uses the same values:

{
  "newCardsPerDay": 20,        // optional
  "updatedAt": "2026-01-02T03:04:05.000Z"
}

setSettings() keeps fields it doesn't know, so apps can add their own.

Review log

One document per UTC day at /flashcards/.log/<YYYY-MM-DD>, so each review is a small write:

{
  "date": "2026-01-02",
  "entries": [
    {
      "at": "2026-01-02T03:04:05.000Z",
      "cardId": "3f0c…",
      "group": "food",         // the card's group at the time
      "rating": 3,             // 1 again, 2 hard, 3 good, 4 easy
      "state": 0,              // the card's state before the review (0 = it was new)
      "reverse": true          // only for back → front reviews
    }
  ]
}

If two devices log reviews for the same day before syncing with each other, remoteStorage keeps the server's copy of that day and the other device's entries for it are lost. The cards themselves are not affected.

.settings and .log can't be used as group names.

Apps on a version of this module before 2.2 find no cards in either, but:

  • their listGroups() includes .log, and removing that "group" deletes the review log;
  • they drop direction and reverseReview from a card when they save it.

So update every app that uses the same storage.

Upgrading from 1.x

  • Requires remoteStorage.js 2.x; ships ESM and TypeScript types.
  • Dates are ISO 8601. v1 records (YYYYMMDD-HHMMSS) are upgraded when read and rewritten in the new format the next time they're stored.
  • New cards get UUID ids, so cards created in the same second no longer collide.
  • store() takes { previousGroup } to move cards between groups.
  • listGroups() resolves with an array of names (it used to resolve with the raw folder listing). getAllByGroup() resolves with an array.
  • familiarity is no longer written; scheduling state lives in review.

Development

bun install
bun test
bun run typecheck
bun run build

Releasing

In GitHub, open Actions > Publish > Run workflow and pick patch, minor, or major. The workflow bumps the version, runs the checks, publishes to npm with provenance, and pushes the version commit and tag to master.