A spaced-repetition flashcard demo built on ts-fsrs, showcasing the FSRS algorithm in a minimal Next.js application.
- Node.js 20+
- pnpm (recommended) / npm / yarn / bun
- Docker (for the local PostgreSQL instance)
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=""pnpm install-
Start PostgreSQL via Docker:
pnpm docker # alias for `docker compose up` -
Push the schema to the database:
pnpm db:push
-
Start the dev server:
pnpm dev
-
Open http://localhost:3000 and sign in.
pnpm build
pnpm startView added notes and their status. Click a note to open its detail page.
On the detail page you can click forget to reset the learning state of the card.
Keyboard shortcuts are supported for revealing the answer and grading. Use Ctrl+Z / ⌘+Z to undo the last review.
A completion message is shown after finishing a review session.
Customize the FSRS parameters under settings.
Train your own FSRS parameters using the hosted optimizer:
- Hosted tool: https://optimizer.parallelveil.com
- Source code: https://github.com/ishiko732/analyzer-and-train
See LICENSE.









