Skip to content

About

Generative-AI language-learning app: CEFR paths for English, French and German, with Gemini grading free-text answers into structured verdicts and feedback.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

ย 

History

326 Commits

Folders and files

Repository files navigation

๐ŸŒ LanguageLab

A modern, interactive language-learning platform for English ๐Ÿ‡ฌ๐Ÿ‡ง and French ๐Ÿ‡ซ๐Ÿ‡ท
Structured CEFR learning โ€ข Smart answer checking โ€ข Progress tracking โ€ข Verb practice โ€ข Exam preparation

GitHub stars Last commit Next.js React Tailwind CSS Gemini AI

English A1 to A2 French A1 to A2 Live demo

โ–ถ Live: languages-lab.vercel.app

LanguageLab: choose English, Franรงais or Deutsch


โœจ What is LanguageLab?

LanguageLab is a personal language-learning platform designed to turn a static curriculum into an interactive learning journey.

Instead of simply reading grammar rules, learners move through a structured path:

๐Ÿ“š Learn โ†’ โœ๏ธ Practice โ†’ ๐Ÿงฉ Get checked โ†’ ๐Ÿ“ˆ Track progress โ†’ ๐Ÿ“ Take the exam โ†’ ๐Ÿ”“ Unlock the next level

The project currently contains two language experiences inside one scalable application:

Language Path Exam section
๐Ÿ‡ฌ๐Ÿ‡ง English A1 โ†’ A2 ECRF Exams
๐Ÿ‡ซ๐Ÿ‡ท French A1 โ†’ A2 DELF Exams

The architecture is intentionally language-aware, so additional languages can be introduced without rebuilding the entire application.


๐ŸŽฏ Core Features

๐Ÿ—บ๏ธ Learning Path

A structured progression through CEFR levels with:

  • A1 foundation
  • A2 everyday communication
  • Sequential section unlocking
  • Completion tracking
  • Revisit mode
  • Final-level assessments
  • Reserved space for future B1 โ†’ C1 expansion

โœ๏ธ Sentence Practice

Every curriculum section contains practical sentence-production exercises.

The learner:

  1. Reads the prompt.
  2. Writes an answer.
  3. Gets checked locally first.
  4. Uses AI only when the deterministic check cannot resolve the answer.
  5. Receives feedback.
  6. Advances only after an accepted answer.

๐Ÿง  Smart Answer Checking

The answer-checking pipeline is deliberately local-first.

                 Student Answer
                       โ”‚
                       โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚ Normalize Answer โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
                       โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚ Exact Comparison โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
                  Match? โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โœ… Correct
                       โ”‚
                      No
                       โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚ Typo Tolerance   โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
                  Match? โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ โœ… Correct
                       โ”‚
                      No
                       โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚ Gemini AI Check  โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                       โ”‚
                       โ–ผ
                ๐Ÿงพ Feedback

This means straightforward answers do not need an AI request.

If Gemini is unavailable, the backend still performs the deterministic comparison before returning a fallback result.

๐Ÿ“– Rules

Grammar content is loaded from language-specific curriculum data and organized around the learning path.

๐Ÿ”ค Verb Bank

A dedicated A1/A2 verb-learning experience with:

  • Search
  • Level filtering
  • Conjugation/practice support
  • English meanings
  • French meanings where applicable
  • Weak-point tracking

๐Ÿ“ Exams

The application includes dedicated exam areas:

  • ๐Ÿ‡ฌ๐Ÿ‡ง ECRF Exams for English
  • ๐Ÿ‡ซ๐Ÿ‡ท DELF Exams for French

The A1/A2 assessment flow connects to the same curriculum and progression system.

๐Ÿ“Š Progress

Progress is stored locally in the browser and includes:

  • Completed sentences
  • Current question
  • Maximum reached question
  • Level completion
  • Final-test pass status
  • Verb practice state

No account is required for the current local-progress system.

๐ŸŒ“ Theme System

Two complete visual themes:

  • ๐ŸŒ™ Dark โ€” deep blue/navy learning environment
  • โ˜€๏ธ Light โ€” soft white, blue-gray and pastel surfaces

The light theme intentionally avoids harsh black text and flat white panels.


How the AI checking works

Every free-text answer goes to a server-side route (/api/check-answer, /api/french/check-answer, /api/german/check-answer, /api/vocabulary/check-answer). The route tries a cheap deterministic check first and calls Gemini only when that check can't decide.

flowchart LR
    A[Student answer] --> N[Normalize: case, accents, punctuation, spaces]
    N --> L{Exact match or small edit distance?}
    L -- yes --> OK[Accepted locally, no LLM call]
    L -- no --> P[Prompt: exercise + reference answer + student answer + CEFR level]
    P --> G[Gemini with a JSON response schema]
    G --> V[Structured verdict: correct, score, feedback, correction, errorType, levelFit]
    V --> F[Feedback shown to the learner]
    G -. error or all models fail .-> FB[Local fallback verdict]
    FB --> F
Loading
  1. Prompt. A system instruction fixes the grader's role, the exercise language, the language the feedback must be written in (Arabic for English exercises, English for French and German), what to accept (synonyms, contractions, valid word order, more advanced but correct phrasing) and the learner's CEFR level. The user turn carries the task, the reference answer and the student's answer.
  2. Gemini. src/lib/gemini.js calls the Gemini generateContent endpoint with responseMimeType: application/json and a responseSchema, so the model must return a typed object, not prose.
  3. Structured verdict. The schema requires correct (boolean), score (0 to 100), feedback, correction, errorType and levelFit. The vocabulary route uses a smaller { correct, feedback, correction } schema.
  4. Feedback. The app shows the verdict and only lets the learner advance on an accepted answer.

Guardrails in the code

  • Local-first. Exact matches and small typos (edit distance of 1 to 3, depending on answer length) are accepted without an LLM call.
  • Schema-constrained output. A response that isn't valid JSON is rejected as an error rather than shown to the learner.
  • Model fallback chain. On retryable errors (404, 429, 5xx) the call moves on to the next model in the list.
  • Graceful degradation. If every model fails, the route returns a deterministic checker-unavailable verdict with the reference answer instead of an error page.
  • Server-only key. GEMINI_API_KEY is read only inside the API routes; it is never a NEXT_PUBLIC_ variable and never reaches the browser.
  • Scoped acceptance rules. The vocabulary grader is told explicitly not to accept related words, broader or narrower concepts, or opposites.

๐ŸŽจ Design Philosophy

LanguageLab is built around a few simple principles:

Soft, focused UI

The interface should help you study, not compete with the lesson.

Progressive disclosure

Don't show everything at once. Unlock complexity as the learner progresses.

Clear hierarchy

Prompt โ†’ answer โ†’ feedback โ†’ progress.

Language-aware branding

English and French share the same application architecture while retaining their own language, branding and curriculum.

No unnecessary visual noise

Soft surfaces, subtle borders, restrained gradients and purposeful color accents.


๐Ÿงฑ Tech Stack

Layer Technology
Framework Next.js 15
UI React 19
Styling Tailwind CSS 4
Language JavaScript
AI checking Google Gemini API
State React state + localStorage
Data JSON curriculum datasets
Deployment Vercel
Runtime Node.js 20

๐Ÿ“ Project Structure

LanguageLab/
โ”œโ”€โ”€ public/
โ”‚   โ”œโ”€โ”€ assets/
โ”‚   โ”‚   โ””โ”€โ”€ images/
โ”‚   โ”‚       โ””โ”€โ”€ logo/
โ”‚   โ””โ”€โ”€ data/
โ”‚       โ””โ”€โ”€ languages/
โ”‚           โ”œโ”€โ”€ en/
โ”‚           โ”‚   โ”œโ”€โ”€ curriculum.json
โ”‚           โ”‚   โ”œโ”€โ”€ grammar.json
โ”‚           โ”‚   โ””โ”€โ”€ verbs.json
โ”‚           โ””โ”€โ”€ fr/
โ”‚               โ”œโ”€โ”€ curriculum.json
โ”‚               โ”œโ”€โ”€ grammar.json
โ”‚               โ””โ”€โ”€ verbs.json
โ”‚
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/
โ”‚   โ”‚   โ”œโ”€โ”€ api/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ check-answer/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ french/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ generate-report/
โ”‚   โ”‚   โ”œโ”€โ”€ globals.css
โ”‚   โ”‚   โ”œโ”€โ”€ layout.jsx
โ”‚   โ”‚   โ””โ”€โ”€ page.jsx
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ””โ”€โ”€ LanguageLabApp.jsx
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ lib/
โ”‚       โ””โ”€โ”€ gemini.js
โ”‚
โ”œโ”€โ”€ scripts/
โ”‚   โ””โ”€โ”€ validate-curriculum.mjs
โ”‚
โ”œโ”€โ”€ .nvmrc
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ postcss.config.mjs
โ””โ”€โ”€ vercel.json

๐Ÿงฉ Multi-Language Architecture

The application is built around a language configuration registry.

Each language can define:

  • ๐Ÿท๏ธ Name and subtitle
  • ๐ŸŽจ Logo
  • ๐Ÿšฉ Language switch target
  • ๐Ÿ“š Curriculum
  • ๐Ÿ”ค Verb database
  • ๐Ÿ“– Grammar database
  • ๐Ÿค– Answer-check endpoint

Conceptually:

const CONFIG = {
  en: {
    name: "English Lab",
    curriculum: "...",
    verbs: "...",
    grammar: "...",
    check: "/api/check-answer"
  },

  fr: {
    name: "Franรงais Lab",
    curriculum: "...",
    verbs: "...",
    grammar: "...",
    check: "/api/french/check-answer"
  }
};

That makes future expansion such as:

๐Ÿ‡ฉ๐Ÿ‡ช German Lab
๐Ÿ‡ช๐Ÿ‡ธ Espaรฑol Lab
๐Ÿ‡ฎ๐Ÿ‡น Italiano Lab

possible without duplicating the entire application.


๐Ÿค– AI Architecture

Gemini is intentionally not the first line of defense.

Local layer

The local checker handles:

  • Case differences
  • Whitespace differences
  • Punctuation differences
  • Accent normalization
  • Minor spelling differences
  • Exact stored-answer matches

AI layer

Gemini handles cases where the learner gives a different but potentially valid answer, such as:

  • Natural synonyms
  • Meaning-preserving alternatives
  • Different valid word order
  • Valid contractions
  • More advanced but grammatically correct phrasing

This keeps the experience faster and reduces unnecessary AI requests.


๐Ÿ” Environment Variables

Create a local .env.local file:

GEMINI_API_KEY=your_api_key_here
GEMINI_MODEL=gemini-3.8-flash
GEMINI_FALLBACK_MODEL=gemini-3.7-flash

The Gemini API key is used server-side and should never be exposed in client-side code.

For Vercel, add the same variables under:

Project โ†’ Settings โ†’ Environment Variables


๐Ÿš€ Run Locally

1. Clone

git clone https://github.com/Nardy11/LanguageLab.git
cd LanguageLab

2. Install

npm install

3. Configure Gemini

Create .env.local and add your Gemini credentials.

4. Validate curriculum data

npm run validate:data

5. Start development

npm run dev

Open:

http://localhost:3000

6. Production build

npm run build
npm start

โ˜๏ธ Deploying to Vercel

LanguageLab is configured for Vercel/Next.js deployment.

The repository contains:

  • vercel.json
  • Node 20 configuration
  • Next.js build scripts
  • Server-side API routes
  • Public curriculum assets

Recommended deployment flow:

GitHub
   โ”‚
   โ–ผ
Vercel
   โ”‚
   โ”œโ”€โ”€ Next.js application
   โ”œโ”€โ”€ Static curriculum data
   โ””โ”€โ”€ Server-side Gemini routes

๐Ÿ“ˆ Learning Progression

Current

A1 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ A2
 โ”‚                   โ”‚
 โ”œโ”€ Sections         โ”œโ”€ Sections
 โ”œโ”€ Rules            โ”œโ”€ Rules
 โ”œโ”€ Verb Bank        โ”œโ”€ Verb Bank
 โ”œโ”€ Practice         โ”œโ”€ Practice
 โ””โ”€ Final Exam       โ””โ”€ Final Exam

Planned expansion

A1 โ†’ A2 โ†’ B1 โ†’ B2 โ†’ C1

B1, B2 and C1 are reserved in the learning-path architecture for future curriculum releases.


๐Ÿ—ƒ๏ธ Curriculum Data

The curriculum is kept outside the React component so content and application logic remain separate.

That makes it possible to:

  • Update sentences without rewriting UI code.
  • Add sections without rebuilding the learning engine.
  • Maintain separate English/French content.
  • Validate datasets independently.
  • Introduce new languages using the same application architecture.

๐Ÿ› ๏ธ Development Principles

  • Keep curriculum data separate from UI logic.
  • Prefer deterministic checks before AI.
  • Keep API keys server-side.
  • Preserve local progress when changing navigation.
  • Keep English/French structures aligned.
  • Avoid duplicating language-specific application logic.
  • Keep the UI responsive from desktop to mobile.
  • Prefer reusable components and theme tokens over one-off styling.

๐Ÿ—บ๏ธ Roadmap

  • ๐Ÿ‡ฌ๐Ÿ‡ง English A1/A2 learning path
  • ๐Ÿ‡ซ๐Ÿ‡ท French A1/A2 learning path
  • ๐Ÿ“– Grammar / Rules section
  • ๐Ÿ”ค Verb Bank
  • ๐Ÿ“Š Local progress persistence
  • ๐Ÿ” Revisit mode
  • ๐Ÿ“ Final assessments
  • ๐Ÿค– Local-first + Gemini answer checking
  • ๐ŸŒ™ Dark mode
  • โ˜€๏ธ Soft light mode
  • ๐Ÿ”€ English/French language switching
  • ๐Ÿ‡ฉ๐Ÿ‡ช German Lab
  • ๐Ÿ“š B1 curriculum
  • ๐Ÿ“š B2 curriculum
  • ๐Ÿ“š C1 curriculum
  • ๐Ÿ‘ค Optional cloud accounts
  • โ˜๏ธ Cross-device progress sync

๐Ÿท๏ธ Tags

language-learning ยท english-learning ยท french-learning ยท cefr ยท a1 ยท a2 ยท delf ยท ecrf ยท grammar ยท verb-bank ยท education ยท edtech ยท nextjs ยท react ยท tailwindcss ยท gemini-ai ยท generative-ai ยท vercel ยท javascript


๐Ÿ’ก Why this project?

Most language-learning interfaces separate grammar, vocabulary, exercises and progress into disconnected experiences.

LanguageLab brings them together into one continuous path:

Learn โ†’ Practice โ†’ Check โ†’ Improve โ†’ Progress โ†’ Test

The goal is not to make another collection of flashcards.

The goal is to build a structured language-learning environment that feels like a real course while remaining lightweight, responsive and extensible.


๐Ÿ‘จโ€๐Ÿ’ป Author

Nardy Attalla

Computer Science & Engineering ยท Full-Stack Development ยท AI/ML


๐Ÿ‡ฌ๐Ÿ‡ง LanguageLab ยท ๐Ÿ‡ซ๐Ÿ‡ท Franรงais Lab
Learn consistently. Practice actively. Track everything. ๐Ÿš€

About

Generative-AI language-learning app: CEFR paths for English, French and German, with Gemini grading free-text answers into structured verdicts and feedback.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages