Open source

ts-simple-fsrs

A minimal implementation of the FSRS (Free Spaced Repetition Scheduler) algorithm written in TypeScript.

Published December 31, 2024 (Updated December 31, 2024)

simple-ts-fsrs offers a lightweight implementation of the FSRS algorithm. I created this package because I wanted a simple TypeScript library to use in a language learning program I'm making.

simple-ts-fsrs takes great inspiration from the Open Spaced Repetition project and I want to give thanks for all the contributors.

Installation

Even though the package is created using Deno it can be used with node.js as well.

Node.js

npx jsr add @austinshelby/simple-ts-fsrs

Deno

deno add jsr:@austinshelby/simple-ts-fsrs

I decided to host the package on JSR (https://jsr.io/@austinshelby/simple-ts-fsrs) because I got intrigued by this new package registry. Getting to develop my package fully in TypeScript was a massive productivity boost and I highly recommend giving JSR a go.

Quickstart

Getting started with simple-ts-fsrs is easy. To assess your ability to recall information, first initialize FSRS (the default parameters are reasonable) and call the assessRecall method with your rating.

import { FSRS } from "@austinshelby/simple-ts-fsrs";

const fsrs = new FSRS();

// Assess the ability to recall information for the first time
const assessment = fsrs.assessRecall({
rating: "Remembered",
});

// Assess the ability to recall information on subsequent attempts
const newAssessment = fsrs.assessRecall({
rating: "Forgot",
now: new Date(),
previousAssessment: assessment,
});

The package is 100% TypeScript so you'll have great IDE autocompletion.

To assess already previously recalled information, just pass the previous assessment into the method.

You can also optionally pass a date as the time of the assessment.


Austin Shelby

Austin Shelby

I am a freelance software engineer, instructor, and public speaker with over half a decade of hands-on experience in the entire software development process. I am passionate about building high-performing web applications and sharing what I have learned along the way.