Skip to content

ishiko732/ts-fsrs-demo

Repository files navigation

ts-fsrs-demo

A spaced-repetition flashcard demo built on ts-fsrs, showcasing the FSRS algorithm in a minimal Next.js application.

Table of Contents

Getting Started

Prerequisites

  • Node.js 20+
  • pnpm (recommended) / npm / yarn / bun
  • Docker (for the local PostgreSQL instance)

Environment Variables

Create a .env file in the project root. The variables below are required; see the Prisma environment variables reference for background on the URL format.

# PostgreSQL connection string
DATABASE_URL="postgres://username:password@host:port/database?sslmode=require"
DATABASE_URL_WITH_SCHEMA="${DATABASE_URL}&schema=fsrsDemo"

# NextAuth
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=         # openssl rand -base64 32

# GitHub OAuth — https://github.com/settings/developers
GITHUB_ID=
GITHUB_SECRET=

# Optional: RSA keys for an external service
# openssl genpkey -algorithm RSA -out private.pem -pkeyopt rsa_keygen_bits:2048
RSA_PRIVATE_KEY=""
# openssl rsa -in private.pem -pubout -out public.pem
RSA_PUBLIC_KEY=""

Installation

pnpm install

Run

  1. Start PostgreSQL via Docker:

    pnpm docker        # alias for `docker compose up`
  2. Push the schema to the database:

    pnpm db:push
  3. Start the dev server:

    pnpm dev
  4. Open http://localhost:3000 and sign in.

Build

pnpm build
pnpm start

build demo

Screenshots

Home

home

Notes

notes list

View added notes and their status. Click a note to open its detail page.

note detail note forget

On the detail page you can click forget to reset the learning state of the card.

Review

question answer

Keyboard shortcuts are supported for revealing the answer and grading. Use Ctrl+Z / ⌘+Z to undo the last review.

finish

A completion message is shown after finishing a review session.

Settings

setting button FSRS settings

Customize the FSRS parameters under settings.

Training

Train your own FSRS parameters using the hosted optimizer:

License

See LICENSE.

About

Interval Repeat Flashcard Demo with Basic Simple Features Designed based on Next.js App Router, ts-fsrs, Hono.js and kysely.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Contributors