# LearnForAll: open educational workspace

LearnForAll is a Next.js and React educational MVP. It offers useful native learning tools without account creation, paid tiers, or a subscription interface. The 38 reference products describe educational feature inspirations and external resources; their code, content, trademarks and commercial APIs have not been copied or represented as licensed integrations.

## Request and data flow

```mermaid
flowchart TD
  A[User notes, text or PDF] --> B[Browser extraction and explicit submission]
  B --> C[Next.js study AI endpoint]
  C --> D[Project AI service]
  D --> E[Validated study output]
  E --> F[Local flashcard deck]
  E --> G[Summary and concept visual]
  F --> H[Flashcards, Learn, Test and Match]
  F --> I[On-device quiz challenges]
  H --> J[SM-2 scheduling and local XP]
  K[Manual tasks or ICS calendar] --> L[Workload planner]
  L --> M[Capacity warnings and reading estimates]
  N[Simulation parameters] --> O[Native STEM calculations and diagrams]
  P[Code draft] --> Q[Short-lived browser worker]
  R[Drawing strokes] --> S[Creative canvas and PNG export]
  J --> T[Local workspace storage]
  M --> T
  Q --> T
  T --> U[Dashboard and daily rhythm]
  V[External educational directory] --> W[Third-party websites in new tabs]
```

All frontend pages and API routes share one Next.js service on port 3000. A container builds the app in standalone mode and serves `/api/health` for readiness. Application secrets are resolved only server-side from the project runtime environment. Locally hosted fonts prevent runtime font requests to Google. Site settings disable optional platform analytics; application source contains no advertising trackers. Platform operational processing remains outside the application's direct control.

## Page content and connected user flows

### Open-access portal: `/`

The portal introduces the promise “Every tool. Zero paywalls. Universal mastery.” A book-and-planet illustration balances editorial copy with playful learning cues. The main CTA opens AI Studio. The universal intake dialog accepts pasted notes and local text files, while directing PDF extraction to the studio. Unsupported audio, video and CAD workflows are not disguised as completed parsers.

Eight tool launchers, filterable by study, explore, create, play and plan, connect the major modules. The daily rail reads the same tasks used by the planner. Completing a task updates the local workspace, daily progress and recorded completed study hours. Learning metrics are actual on-device counters rather than fictional live global totals. Suggested seed decks and tasks are identified as starter material.

### Student dashboard: `/dashboard`

The dashboard summarizes locally earned XP, review count, streak and completed planned hours. Its study collection links to the user's local decks. Profile editing changes a name and avatar color on-device; it is not a simulated login. A user can move from daily tasks to a week view, launch study review, or continue into the native labs.

### Content studio: `/studio`

Users supply notes or extract text from a PDF in the browser, give the output a name, and explicitly request AI conversion. Text is submitted to `/api/study-ai`, not uploaded silently. The output includes a validated deck, a summary, and concepts used in deterministic visual cards. Saving a deck writes to the shared local state and opens its study route. Markdown output renders through a safe React Markdown renderer and can be downloaded. Unsupported or image-only documents report extraction limitations instead of pretending OCR succeeded.

### Study hub: `/study` and `/study/[deck_id]`

The library supports starter decks and locally created decks. The study workspace exposes Flashcards, Learn, Test and Match activities. Ratings map to Forgot, Hard, Good and Easy and update SM-2-inspired card fields: ease, repetitions, interval and due date. The implementation defaults ease to 2.5, never reduces it below 1.3, uses initial successful intervals of 1 and 6 days, and thereafter multiplies the interval by ease. A failed rating resets repetition progress.

Sparky receives only the selected deck context and user question through a server-side AI request. The assistant is instructed to acknowledge missing information rather than invent answers. Chat and conversion have visible pending and failure states. Starter repair content prioritizes disconnecting power and model-specific safety guidance.

### Gamified arena: `/arena`

The arena is on-device quiz practice, not a fake multiplayer lobby. Questions derive from the user's selected deck. Knowledge Economy awards virtual coins and offers a real double-reward upgrade and a one-miss shield. Curiosity Quest provides self-paced questions. The 60-second Spark uses a timed challenge. Correct answers earn local XP. No real money, paid powerups, or purchasable learning advantages exist.

### Workload planner: `/planner`

Task fields include a title, subject, allocated study date and estimated hours. A seven-day calendar supports previous/next weeks and completion toggles. Daily demands exceeding configured capacity surface warnings. Reading time is `word count / reading WPM`, rounded up to minutes. The estimate can become a study task. Calendar import accepts ICS events with SUMMARY and DTSTART; imported events receive a clearly disclosed one-hour estimate. The MVP does not silently redistribute tasks or sync Canvas/Google Classroom accounts.

### STEM and repair labs: `/stem-labs`

Native parameter-driven pendulum and circuit activities connect controls to actual calculated results. The small-angle pendulum model uses `T = 2π√(L/g)`. The resistive circuit uses `I = V/R` and `P = VI`. Unit conversion provides a practical math utility. Repair content points to model-specific iFixit guidance; JavaLab and Servier resources are labeled external. Native demos are educational illustrations, not engineering safety certifications or production CAD solvers.

### Code studio: `/code-studio`

JavaScript drafts persist on-device. Execution takes place inside a short-lived browser Web Worker with console capture, error reporting and a bounded timeout. It never evaluates user code in the application server process. This is browser execution, not a production security-isolated cloud container. Python, hardware generation, 3D visual programming and external coding education are resource routes or future integrations rather than simulated runtimes.

### Creative lab: `/creative-lab`

The creative workspace offers pointer-based drawing, pen and eraser controls, colors, stroke width, clearing and PNG export. Visual effect controls act on the rendered workspace where provided. The screen diagnostic view uses flat colors and always offers a visible exit and Escape support. Screen checks help a user visually inspect a display; they cannot certify hardware health. No broken-screen stress effect implies real hardware damage.

### Research and directory: `/research`, `/resources`

The research interface builds an external Class Central search from a user topic and opens NIH RePORTER's public search interface. Results, university data and grant totals are not fabricated. The full 38-item directory distinguishes actual external URLs from named inspirations without a source URL. External providers may have fees, terms, account requirements or access limits even though LearnForAll's native tools have no paywall.

## Workspace state and offline behavior

The `lfa-workspace-v1` localStorage record contains decks, tasks, profile, code draft and appearance mode. Each card stores ID, front, back, ease, interval, repetitions and ISO due timestamp. Each deck stores ID, title, description, subject, color and cards. Each task stores estimated hours and a date. Study activity increments local review and XP counters. The streak is based on successive study dates; starter activity is never credited as actual achievement.

A production serviceworker caches successful same-origin page and asset responses. It avoids AI APIs and React Server Component responses. Previously visited pages and cached code can be reopened offline; uncached resources and external sites require a network. AI requests require connectivity and provider availability. Browser storage may be cleared by user action, private browsing or quota pressure, so it is not a cloud backup.

## Accessibility and privacy

The workspace offers light, dark, high-contrast and dyslexia-friendly reading modes. Navigation has a skip link, icon buttons have accessible labels, modal dialogs trap focus and close on Escape, and animations honor reduced-motion preferences. Color is accompanied by text and state labels for learning tasks and answers. No accessibility mode substitutes for individualized accessibility evaluation.

AI processing sends user-chosen notes and questions to the project's AI provider. The app does not sell learning data or create advertising profiles. The MVP has not undergone FERPA/COPPA auditing and does not collect children's institutional records under a falsely asserted compliance guarantee. A real school deployment requires a privacy assessment, consent flow, retention policy, data processing agreements and access controls.

## Database and future integrations

`prisma/schema.prisma` contains the requested PostgreSQL model blueprint with User, Deck, Card, TaskSchedule, GameRoom, CodeProject and StemLabProject. It includes explicit ownership relations and useful indexes. It is not an active database connection. Production accounts require a protected PostgreSQL/Supabase connection, Prisma migrations, real authentication, ownership enforcement and cross-site-compatible session cookies when using embedded Preview.

A production multiplayer service would validate answers server-side, isolate lobby state, enforce room ownership and broadcast through WebSockets. Redis may cache reconstructible game states and queues but must not become the sole store of learning records. Cloud code execution needs separate hardened containers, resource limits and network policies. OCR, media transcription, advanced CAD and generative floorplans require actual provider APIs, terms verification, explicit user processing consent and lifecycle/error handling.

## API surface

`GET /api/health` returns a successful application status. `POST /api/study-ai` accepts bounded conversion or grounded-chat requests. Requests use project-managed AI credentials. Provider errors, missing credentials, absent content and malformed model output are treated as failures; an empty response is not a successful generation. AI availability and provider-side project credits are operational constraints, not a premium user tier.

Source educational Earth imagery: NASA Science, https://science.nasa.gov/earth/facts/. Other resource URLs come from the supplied feature brief or the conventional public site of a named platform and are not implied to be embedded dependencies. Third-party names belong to their respective owners.
