Skip to content

open-spaced-repetition/ts-fsrs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

277 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Introduction | 简体中文はじめに


ts-fsrs

codecov Release Deploy

ts-fsrs is a TypeScript toolkit for building spaced repetition systems with FSRS.

Packages

This repository contains two main packages:

Package Description FSRS Version Package Version Downloads
ts-fsrs the scheduler for review flows fsrs version ts-fsrs npm version ts-fsrs npm monthly downloads ts-fsrs npm total downloads
@open-spaced-repetition/binding the optimizer for parameter training and CSV conversion fsrs version binding npm version binding npm monthly downloads binding npm total downloads

Installation

All current packages in this repository require Node.js >=20.0.0.

Node.js 16 and 18 are end-of-life, so we no longer support versions earlier than Node.js 20. See the official release status page.

pnpm add ts-fsrs

If you also need parameter optimization from review logs:

pnpm add @open-spaced-repetition/binding

Basic Usage

Use ts-fsrs to schedule reviews:

import { createEmptyCard, fsrs, Rating } from 'ts-fsrs'

const scheduler = fsrs()
const card = createEmptyCard()

// Preview all four possible outcomes before the user answers.
const preview = scheduler.repeat(card, new Date())
// Apply the final rating after the user has already answered.
const result = scheduler.next(card, new Date(), Rating.Good)

console.log(preview[Rating.Good].card)
console.log(result.card)
console.log(result.log)

Use @open-spaced-repetition/binding when you want to train FSRS parameters from review logs. For CSV conversion, timezone handling, browser/WASI setup, and training examples, see packages/binding/README.md.

More Documentation

For detailed usage, advanced examples, browser/WASI setup, and API notes:

Examples

Other Implementations

FSRS is also available in other languages and ecosystems:

Contribute

For how to setup a local development eniroment, how to set up a Dev Container, and contribution guidelines, see CONTRIBUTING.md.

About

ts-fsrs is a versatile package written in TypeScript that supports ES modules, CommonJS, and UMD.

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Sponsor this project

 

Contributors