A local-first learning app built on installable content packs. A pack is a course or subject with levels, sections, Markdown theory, and authored or AI-generated test sets. Packs are fetched from a public manifest, stored in IndexedDB, and work offline.
- React 19
- TypeScript 6
- Vite 8
- TanStack Router
- TanStack DB
- AI SDK + OpenAI-compatible provider
- shadcn/ui-style components on Radix + Tailwind CSS 4
- dnd-kit
- react-markdown + remark-gfm
- Zod
- i18next / react-i18next
- Vite PWA
- Vitest
- Biome
- Node.js
24.8.0(see.nvmrc) - npm
npm install
npm startVite starts on port 3000 by default. Change it with VITE_PORT.
| Command | Description |
|---|---|
npm start |
Start the Vite dev server. |
npm run build |
Type-check, then build into VITE_OUTPUT_DIR. |
npm run check |
Run Biome and tsc. |
npm run typecheck |
Type-check only. |
npm test |
Run Vitest once. |
npm run test:watch |
Run Vitest in watch mode. |
npm run biome:lint |
Run Biome lint. |
npm run biome:format |
Format source files with Biome. |
src/
components/ui/ shadcn-style primitives
contexts/ language, theme, PWA
core/
i18n/ i18next setup
router/ TanStack Router setup
features/
ai/ provider client and errors
packs/ pack schemas, install/update service, manifest provider, AI generation and grading
settings/ provider settings schema
storage/ TanStack DB collections, API-key storage
subjects/ active-subject state
sync/ global Git snapshot, GitHub contents API, conflict resolution
theory/ Markdown renderer
layouts/
pages/
library/ subjects, catalog, entry, theory and test runner
progress/ subject-scoped results
settings/ AI · Sync · Data
public/content/
manifest.json available subjects
packs/<id>/pack.json groups, catalog entries, prompts, theory and test references
packs/<id>/theory/*.md Markdown theory
packs/<id>/tests/*.json authored test sets
/subjects— choose a subject; accessible without an active subject/settings— global AI provider, Git sync, and data management/catalog— catalog of the active subject, grouped by type/catalog/:entryId— entry with Test, Cards, and Theory review/catalog/:entryId/tests/:testSetId— mode-specific runner/theory— theory list of the active subject/theory/:entryId— Markdown theory/progress— attempts for the active subject- old
/library,/tests, and related routes redirect to/subjects
Without an active subject only /subjects and /settings are available. The active subject is stored in localStorage.
There is no authentication. The app is a static SPA with local browser storage.
A subject is a pack. Its catalog groups entries by a type such as A1 and gives each entry a name such as Present Simple.
Every entry has three test modes:
- Test — all tasks on one page, one final result.
- Cards — one task at a time with immediate feedback.
- Theory review — one task at a time, deeper rule checking.
All modes use the same task types: single choice, multiple choice, short answer, cloze, spot the error, and open response.
AI generation merges prompts from the pack, the catalog entry, and the selected mode. Entry-level prompts can forbid ambiguous tasks; for example, the Adverbs of Frequency entry requires a decisive context instead of interchangeable adverbs.
Page content uses a small CSS enter animation (.page-enter) keyed by the current pathname. The sidebar and header never animate, and there is no shared-element morphing between routes.
The animation is disabled when prefers-reduced-motion: reduce is set.
Add a folder under public/content/packs/<id>/ with:
pack.json
theory/*.md
tests/*.json
Add the pack to public/content/manifest.json with its id, version, localized title/description, language, tags, and packUrl.
pack.json declares groups, catalog entries, order, prompts, theory file paths, and test set references with a mode (test, cards, theory-review). Every entry and test set is validated with Zod before it reaches storage. To update a pack, bump the version in both the manifest and pack.json; installed subjects then show Update in the library.
Theory Markdown supports GFM tables, nested lists, blockquotes, and code blocks. Test sets support single-choice, multiple-choice, short-answer, cloze, spot-error, and open-response tasks. Open responses are graded by AI against the task rubric.
TanStack DB is the only data layer:
settings—localStorageCollectionOptions(openstudia:settings:v1)packs— installed pack configs and downloaded theorypackTestSets— downloaded, user-added, and AI-generated test setspackAttempts— mode-specific test results- active subject —
localStoragekeyopenstudia:active-subject - legacy English collections (
tests,attempts,cardSessions,theoryDrills,theorySessions)
The API key is stored outside TanStack DB:
sessionStorageby default;localStorageonly when “Remember on this device” is enabled.
The key is never included in the JSON backup.
The app supports any OpenAI-compatible endpoint:
- OpenAI
- OpenRouter
- Groq
- Ollama / LM Studio
- custom base URL
Provider setup is a strict flow:
- Enter the base URL and API key.
- Click Check API to verify the endpoint and load models.
- Choose a model from the searchable combobox (or enter a custom model ID if the provider does not expose
/models). - Click Test model to verify that the selected model responds.
- Only then Save becomes available.
Changing the base URL, API key, or model invalidates the relevant checks. A saved configuration stores lastVerifiedAt; pack pages only enable AI generation with a verified configuration.
Generation and evaluation use AI SDK structured outputs with Zod validation and one repair attempt. If a provider does not support JSON schema, turn off Structured outputs in Settings → AI.
Because this is a client-side app, the key is visible to the browser. For a public multi-user deployment, put the provider behind a server-side proxy. The provider must also allow browser requests (CORS); local Ollama requires OLLAMA_ORIGINS.
Sync is global across every installed pack and attempt. It is manual by default, with optional auto-sync on launch and on meaningful events: Settings → Sync.
- Create a private GitHub repository and add a README (the repository needs its first commit): https://github.com/new.
- Create a fine-grained token with
Contents: read and writefor that repository: https://github.com/settings/personal-access-tokens/new. - Paste
owner/repo, the branch, and the token, then press Sync.
The app stores one JSON snapshot in the repository. If both local and remote data changed, it asks whether to replace local with remote or remote with local. The AI API key and the GitHub token are never included in the snapshot; public repositories are rejected.
The UI uses ru-RU and en-US, with ru-RU as the fallback. Locale files live at:
public/locales/ru-RU/translation.json
public/locales/en-US/translation.json
Topic definitions use the same ru-RU / en-US keys for localized labels.
clozeScore = correct blanks / total blanks * 100
writingScore = average AI score across writing tasks
attemptScore = 0.6 * writingScore + 0.4 * clozeScore
masteryAfter = first attempt
? attemptScore
: 0.65 * previous mastery + 0.35 * attemptScore
The AI recommends a review interval, and the app clamps it to a score-based band. Three consecutive strong attempts at 90+ mastery schedule the next review in 30 days.
PWA support is configured in vite.config.ts. The service worker is registered only in prod mode. The app can detect updates and reset its cache from the AI → Data section.
Generated icons and the service worker are build artifacts. Do not edit them manually.
Copy .env.template to .env.local for local work.
| Variable | Purpose |
|---|---|
VITE_DEFAULT_NAME |
Full app name for HTML and the PWA manifest. |
VITE_DEFAULT_NAME_SHORT |
Short app name. |
VITE_DEFAULT_THEME_COLOR |
Theme color for the PWA manifest. |
VITE_DEFAULT_DESCRIPTION |
App description. |
VITE_BASE_PATH |
Public base path for assets, router, and PWA scope. |
VITE_NODE_ENV |
prod, dev, or test. Controls robots meta. |
VITE_PORT |
Dev server port. |
VITE_OUTPUT_DIR |
Build output directory. |
The Deploy to GitHub Pages workflow builds and publishes the app from main.
- Enable Settings → Pages → Build and deployment → Source: GitHub Actions once for the repository.
- The workflow sets
VITE_BASE_PATH=/<repository>/, because project Pages are served from a subpath. - It copies
build/index.htmltobuild/404.htmlfor SPA deep links and adds.nojekyll. - For a custom domain served from
/, overrideVITE_BASE_PATHin the workflow to/. - The published URL is
https://<owner>.github.io/<repository>/.
- Build with
npm run build. - Serve the output as a static SPA with fallback to
index.html. - Keep
VITE_BASE_PATHaligned with the actual hosting path. - Provide a production
VITE_NODE_ENVand branding values.
- AI request fails immediately — usually CORS or an invalid base URL. Check the provider's browser-access settings.
- No model list — some providers do not expose
/models; enter the model manually. - Data disappeared — local data is tied to the browser profile and origin. Clearing site data removes it.
- PWA update does not appear — service worker registration is enabled only in
prodmode.