Skip to content

Peleke/interlinear

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

49 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Interlinear

AI-Powered Language Acquisition That Actually Works

Next.js TypeScript Supabase OpenAI License: MIT

Stop memorizing flashcards. Start acquiring language.

Get Started Β· Features Β· Documentation Β· Contributing


The Problem

Most language apps are glorified flashcard decks with gamification slapped on top. They optimize for daily streaks, not actual fluency. You finish 500 lessons and still freeze up in a real conversation.

Why? Because they treat language like triviaβ€”isolated vocabulary, disconnected grammar drills, zero context. That's not how humans acquire language.

The Solution

Interlinear is an AI tutoring laboratory built on how language acquisition actually works:

"Language is acquired through comprehensible input in context, not through memorization of rules." β€” Stephen Krashen

Instead of drilling you on word lists, Interlinear immerses you in real texts with intelligent supportβ€”click any word for instant definitions, hear native pronunciation, and get AI-powered feedback that understands the difference between a typo and a fundamental misunderstanding.


✨ Features

🎯 Real-Time Error Analysis

Not just "wrong, try again." Get detailed grammatical explanations organized by error type, with native audio pronunciation. The system distinguishes between lexical mistakes and syntactic confusionβ€”like a linguistics professor in your pocket.

🎭 AI Roleplay Conversations

Practice with AI personas who maintain narrative coherence across extended dialogues. No scripted decision treesβ€”genuine conversational flow that adapts to your level and responds to what you actually say.

πŸ“œ Classical Language Support

The first computationally sophisticated approach to Latin instruction. Full morphological analysis, academic-grade content, and the same analytical depth available for modern languages. Finally, dead languages get the tech they deserve.

πŸ“Š Pattern Recognition & Feedback

Comprehensive post-session analysis identifying recurring error patterns with targeted remediation strategies. Like office hours with a professor who never forgets your previous mistakes.

🎚️ Adaptive CEFR Calibration

Dynamic difficulty from A1 to C2 based on demonstrated competencyβ€”not self-assessment. The system meets you where you are and grows with you.

⚑ Progressive Web App

Installable on any device with offline support. No app store gatekeeping, no forced updates, no platform-specific compromises. Just works.


πŸ†š Why Interlinear?

Traditional Apps Interlinear
Learning Model Memorization drills Contextual immersion
Error Feedback ❌ "Incorrect" βœ… Detailed grammar analysis
Conversation Practice Scripted dialogues AI with narrative memory
Classical Languages Basic/None Full morphological analysis
Difficulty Adjustment Manual selection Automatic CEFR calibration
Platform App store lock-in PWA (works everywhere)

πŸ–ΌοΈ Screenshots

Reader Interface AI Tutor Error Analysis
Click any word for instant definitions Roleplay conversations with AI personas Detailed grammatical breakdowns

Screenshots coming soon


Part II: Technical Documentation

For engineers, contributors, and the curious


πŸ—οΈ Architecture Overview

Interlinear is built on a modern, type-safe stack optimized for real-time AI interactions and cost-efficient scaling.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         Client (PWA)                             β”‚
β”‚         Next.js 15 Β· React 19 Β· TypeScript Β· Tailwind           β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      API Layer (Next.js)                         β”‚
β”‚    Vercel AI SDK Β· Mastra Workflows Β· Server Components         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚                  β”‚                  β”‚
           β–Ό                  β–Ό                  β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚   Supabase  β”‚    β”‚   OpenAI    β”‚    β”‚ ElevenLabs  β”‚
    β”‚  PostgreSQL β”‚    β”‚   Anthropic β”‚    β”‚    TTS      β”‚
    β”‚  + Auth     β”‚    β”‚             β”‚    β”‚             β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚
           β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚         Google Cloud Run            β”‚
    β”‚   Serverless Β· Auto-scaling 0-10    β”‚
    β”‚   OpenTofu/Terraform IaC            β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

Layer Technology Why
Frontend Next.js 15, React 19, TypeScript App Router, RSC, type safety
Styling Tailwind CSS Utility-first, rapid iteration
Database Supabase PostgreSQL RLS, real-time, managed auth
AI/LLM OpenAI, Anthropic via Vercel AI SDK Structured output, streaming
Orchestration Mastra AI workflow management
Audio ElevenLabs Neural TTS, native quality
Infrastructure Google Cloud Run, OpenTofu Serverless, IaC
CI/CD GitHub Actions Automated builds & deploys

πŸš€ Quick Start

Prerequisites

  • Node.js 20+
  • npm or yarn
  • Supabase account (free tier works)
  • OpenAI API key

Installation

# Clone the repository
git clone https://github.com/Peleke/interlinear.git
cd interlinear

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env.local

Environment Configuration

# .env.local

# Required
NEXT_PUBLIC_SUPABASE_URL=your-project-url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your-anon-key
OPENAI_API_KEY=your-openai-key

# Optional
ANTHROPIC_API_KEY=your-anthropic-key    # Alternative LLM
ELEVENLABS_API_KEY=your-elevenlabs-key  # Text-to-speech

Database Setup

Run the SQL migrations in your Supabase dashboard:

# Migrations are in supabase/schema.sql
# Apply via Supabase SQL Editor or CLI

Run Development Server

npm run dev

Open http://localhost:3000


πŸ“ Project Structure

interlinear/
β”œβ”€β”€ app/                          # Next.js App Router
β”‚   β”œβ”€β”€ api/                      # API routes (TTS, health, AI endpoints)
β”‚   β”œβ”€β”€ (auth)/                   # Auth pages (login, signup)
β”‚   β”œβ”€β”€ reader/                   # Main reading interface
β”‚   β”œβ”€β”€ tutor/                    # AI tutoring sessions
β”‚   └── profile/                  # User dashboard & stats
β”œβ”€β”€ components/                   # React components
β”‚   β”œβ”€β”€ ui/                       # Shared UI primitives
β”‚   β”œβ”€β”€ reader/                   # Reading interface
β”‚   └── tutor/                    # Tutoring components
β”œβ”€β”€ lib/                          # Core business logic
β”‚   β”œβ”€β”€ mastra/                   # AI workflow orchestration
β”‚   β”œβ”€β”€ content-generation/       # LLM content tools
β”‚   β”œβ”€β”€ supabase/                 # DB clients (server/client)
β”‚   └── services/                 # External API integrations
β”œβ”€β”€ services/
β”‚   └── latin-analyzer/           # Python FastAPI for Latin morphology
β”œβ”€β”€ tests/                        # E2E (Playwright) & unit tests
β”œβ”€β”€ terraform/                    # Infrastructure as Code
└── supabase/                     # DB schema & migrations

πŸ§ͺ Commands

# Development
npm run dev              # Start dev server (localhost:3000)
npm run build            # Production build
npm run lint             # ESLint
npm run type-check       # TypeScript checking

# Testing
npm run test:e2e         # Playwright E2E tests
npm run test:e2e:ui      # E2E with UI mode
npm run test:e2e:headed  # E2E in headed browser

# Latin Analyzer (Docker)
docker compose up -d latin-analyzer    # Start Latin service
docker compose logs latin-analyzer     # Check logs

πŸ” Design Decisions

Dynamic Rendering

All pages use forced dynamic rendering. Supabase requires runtime environment variables, making static generation impractical. Trade-off: deployment simplicity over static perf gains.

Audio Caching Economics

TTS audio cached in Supabase with user-scoped RLS. ElevenLabs charges per characterβ€”caching breaks even after ~10 repeated pronunciations, reducing API costs by ~80%.

Implicit Vocabulary Tracking

Every word click saves immediatelyβ€”no confirmation dialogs. Removes friction, lets users focus on reading. Higher DB writes are trivial at current scale.

Row Level Security

All data is user-scoped via PostgreSQL RLS policies. Client-side Supabase key is safe to expose; RLS enforces complete isolation.


πŸ“Š Performance

Metric Target Current
Time to Interactive < 2s ~1.2s
Definition Lookup (cached) < 100ms ~80ms
Definition Lookup (cold) < 500ms ~300ms
TTS Generation < 1s ~800ms
Container Cold Start < 3s ~2s

Cost @ 1,000 MAU

Service Monthly
Cloud Run ~$15
Supabase Free
ElevenLabs ~$5
Total ~$20

🚒 Deployment

See DEPLOY.md for the full guide.

# Quick deploy
./scripts/deploy-infra.sh staging
./scripts/deploy-app.sh staging

# Rollback
./scripts/rollback.sh staging

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

MIT License β€” see LICENSE for details.


πŸ™ Acknowledgments


Built with obsessive attention to how humans actually learn languages.

⬆ Back to top

About

AI-enabled foreign language reading, listening, and review aid.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors