lingrem.com

Lingrem

Spaced-repetition language-learning platform, live on web + iOS from one Next.js/Capacitor codebase. An OpenAI/Claude engine generates learning content into Zod-validated structured formats; a separate GraphQL API owns the deterministic SM-2 scheduling, per-language Google TTS, and schema-level rate-gating; subscriptions split Stripe (web) + Apple IAP (iOS).

frontend next.jsmicroservices node.jsdatabase mongohosting self-hostedpayments stripe + apple iapai structured-output generation

A language learning platform built around Spaced Repetition System (SRS) methodology — designed to surface vocabulary and lessons at the optimal moment for long-term retention. Fully developed end-to-end, from the SRS algorithm and microservices architecture to the cross-platform front end and native iOS experience. One of the core architectural decisions was building a shared Next.js codebase with a custom i18n routing approach that serves both the web app and the iOS app, avoiding duplication across platforms while keeping the user experience native to each.

SRS Engine

The learning engine is built around a custom SRS implementation that tracks each item per user — vocabulary, phrases, and lesson content — assigning levels, calculating optimal review intervals, and triggering reminders at the right time. The algorithm accounts for performance history, difficulty weighting, and streak data to progressively build a personalized learning path. Pro users can also apply the SRS method to their own custom content, extending the system beyond language learning to any subject.

Microservices

The backend runs as a set of independent Node.js microservices, each responsible for a specific domain: lesson creation with automated multilingual translation, speech audio generation, AI connections for content generation, and SRS calculation and scheduling. This separation allows each service to be scaled, updated, or replaced independently without affecting the rest of the system.

AI Content Generation

Content generation is treated as a system, not a single API call. Lessons, translations, and vocabulary are produced with structured-output prompts against typed schemas, so the model can only return validated shapes — never free text to a learner. A per-task provider split routes structured parsing, literal translation, speech, and imagery to whichever model fits each job, coordinated by an orchestration pipeline that detects the source language, canonicalizes each item to a keyword to dedupe against existing lessons, generates across all target languages in the background, and streams results to the client over GraphQL subscriptions.

Reliability is handled as an engineering problem. The spaced-repetition scheduling is deterministic and lives in a separate service the model never touches; free-tier usage is capped declaratively at the schema layer; and language-specific script conversion — Japanese kana, pinyin — stays in real code rather than the prompt. A stronger model is reserved for paid usage and a lighter one for routine generation, and generated audio is cached and reused per term to keep cost predictable.

The speech service generates natural HD audio per language and term, stored and served from an internal audio database built and populated incrementally over time.

Media Database

An internal image and audio database acts as the media backbone of the platform. Rather than relying on external services at runtime, assets are processed, stored, and indexed internally — images associated to vocabulary items and audio to terms and lessons. The database grows as new content is added, building a reusable, queryable asset layer.

Payments & Subscriptions

Subscriptions are split by platform at the payment level — Stripe on web and Apple In-App Purchases on iOS — but unified at the subscription level: a single active plan is recognized and consumable across both platforms regardless of where it was purchased. This required custom logic to reconcile subscription state from two separate payment sources into a single entitlement model.

lingrem.com