10xCards
10xCards is a web application for creating and learning flashcards (front/back) using AI-assisted generation and the FSRS spaced-repetition algorithm.
The MVP focuses on:
- Fast flashcard generation from pasted text
- Review + editing of generated cards (accept/reject + multi-select)
- Daily study sessions (FSRS)
- AI cost control (token limits)
- Project name
- Project description
- Tech stack
- Getting started locally
- Available scripts
- Project scope
- Project status
- License
- Contributing
- Frontend: Astro 5 + React 19 + TypeScript 5
- UI: Tailwind CSS 4 + shadcn/ui (Radix primitives)
- Backend: Supabase (PostgreSQL + Auth + SDK)
- AI: OpenRouter (
OPENROUTER_API_KEY) - Hosting/infra: DigitalOcean (Docker image deployment)
- Tooling: ESLint + Prettier + Husky + lint-staged
- Testing:
- Unit & integration: Vitest (Vite-native, ESM, TypeScript, watch mode, coverage v8/istanbul); mocks:
vi.fn()/vi.mock(), MSW (Mock Service Worker) for API/OpenRouter - E2E: Playwright (Chromium/Firefox/WebKit), tests against
astro devorastro preview; auth via storage state, parallel projects
- Unit & integration: Vitest (Vite-native, ESM, TypeScript, watch mode, coverage v8/istanbul); mocks:
flowchart LR
U[User] -->|Browser| FE[Astro 5 + React 19 UI]
FE -->|SSR / API routes| APP[Astro Node adapter - standalone]
APP -->|Auth + DB| SB[(Supabase\nPostgreSQL + Auth)]
APP -->|AI generation| OR[OpenRouter API]
SB -->|stores| DATA[Flashcards, tags, decks,\nFSRS scheduling, token usage]
- Node.js:
22.14.0(see.nvmrc) - npm: comes with Node.js
- Install dependencies:
npm install- Create a local
.envfile (or export env vars in your shell) with at least:
SUPABASE_URL=...
SUPABASE_KEY=...
OPENROUTER_API_KEY=...Notes:
SUPABASE_URL/SUPABASE_KEYare required to connect to Supabase.OPENROUTER_API_KEYis required for AI flashcard generation.
- Run the dev server (defaults to port
3000):
npm run dev- Build and run the production build locally:
npm run build
npm run previewnpm run dev: start Astro dev servernpm run build: create a production buildnpm run preview: preview the production buildnpm run astro: run the Astro CLI
npm run lint: run ESLint across the reponpm run lint:fix: run ESLint with auto-fixesnpm run format: format files with Prettier
npm run test: run unit tests in watch modenpm run test:run: run unit tests oncenpm run test:ui: run unit tests with UInpm run test:coverage: run unit tests with coverage reportnpm run test:e2e: run E2E tests with Playwrightnpm run test:e2e:ui: run E2E tests with Playwright UInpm run test:e2e:debug: debug E2E testsnpm run test:e2e:codegen: generate E2E tests with Playwright codegen
See TESTING.md for setup, running, and writing tests (src/test/, e2e/, npm run test:run, npm run test:e2e). Quick reference: TESTING-CHEATSHEET.md.
- Hypothesis: users can generate a study-ready set of flashcards without manually writing most cards.
- MVP success: ≥ 75% acceptance rate for AI-generated flashcards (saved, including after edits).
- Failure: acceptance rate < 75% despite prompt/limit iterations.
- P0 (must-have):
- AI flashcard generation + accept/edit workflow
- Anti-hallucination via sources extracted from
inputText - Daily FSRS session
- AI cost controls (token limits)
- P1:
- Decks (manual + dynamic)
- Search
- P2 (out of MVP scope):
- Offline mode
- Monitoring (Prometheus/Grafana)
- Full history/versioning
- Mermaid/diagrams inside user content (MVP forbids Mermaid in flashcard Markdown)
- Auth: Google OAuth, sessions with TTL
- Flashcards:
- Markdown content (no HTML)
- Fields: front, back, tags, difficulty, sources, origin, timestamps, deletedAt
- One-level rollback stored in DB, TTL = 24h since last edit; each edit overwrites previous version and resets TTL
- Tags: managed by admin; users can only search/select (no user-created tags)
- Decks:
- Manual decks: many-to-many
- Dynamic decks: tag-based filters; materialized as a snapshot at the start of the daily FSRS session
- AI limits:
- Limits on input text size, max cards per batch, max front/back length
- Per-user/day token counter with a fixed daily window, reset at 00:00 UTC
- Block requests when estimated usage exceeds the limit
- Sources (anti-hallucination): excerpts must match the input text, with
startOffset/endOffset - Search: by front + tags
- FSRS:
- Ratings: Again / Hard / Good / Easy
- Admin-configurable daily card limit
- Deterministic unit tests for scheduling correctness + snapshotting before/after session
- Admin-only schedule reset for debugging
- Admin panel: UI languages, generator languages, character/token limits, max cards/batch, tag list, session limits
- Delete:
- Soft-delete flashcards
- Hard-delete account + all user data
- Current state: early MVP development (base Astro/React/Tailwind setup is present).
- Primary objective: validate the MVP hypothesis by achieving ≥ 75% AI flashcard acceptance rate.
No LICENSE file is present in this repository. Until a license is added, treat the code as All rights reserved.
- Follow the repo conventions: Astro 5 + React 19 + TypeScript 5 + Tailwind 4, with ESLint/Prettier formatting.
- Use the scripts: run
npm run lint(ornpm run lint:fix) andnpm run formatbefore opening a PR. - Keep changes scoped: prefer small PRs that map to a single feature/requirement from the PRD.
- Testing: TESTING.md — setup, unit (Vitest) and E2E (Playwright),
src/test/,e2e/, commands. Quick reference: TESTING-CHEATSHEET.md. - PRD:
/.ai/prd.md - Tech stack notes:
/.ai/tech-stack.md