
Gravitae
- Next.js
- React
- TypeScript
- Tailwind CSS
- Gemini
- Vercel AI SDK
About this project
Gravitae teaches Newton’s law of universal gravitation by letting the reader change the parameters of a system, predict what will happen, and check the reasoning behind each prediction with Atomy, a tutor powered by Gemini. It then moves to the three-body problem: six periodic orbits integrated in the browser and an orbit search that tries to find a new closed solution from a starting seed.
The lesson, the gallery, and the search also work in reduced mode, without a language model. The app detects a missing API key or a lost connection to Gemini and falls back automatically while keeping the reader’s progress.
Key features
- Interactive gravitation lesson — change masses, distance, and other parameters in SVG simulations, then answer checkpoints with Atomy’s feedback.
- Periodic three-body gallery — six closed orbits computed with a Dormand–Prince 5(4) integrator using the initial conditions published by Li and Liao (2017), each with its own shareable URL.
- Orbit search — a Levenberg–Marquardt fit in a Web Worker closes a new orbit from a seed while the page stays responsive; changing the seed cancels the previous calculation immediately.
- Atomy, an LLM tutor — streaming chat and reasoning checks on top of Gemini, with a fallback chain of models when the free-tier quota is exhausted and a server-only API key.
Evaluating the tutor
The eval suite runs correct, boundary, and adversarial cases through the real production route handlers against Gemini, repeating each case several times to account for nondeterministic answers. Each check has its own threshold: 90% for code-checked properties, 95% for “no false correct” verdicts, and 80% for LLM-judge criteria. The judge is validated against human labels, and the report shows 95% confidence intervals alongside the previous run.
Stack
Next.js 16 with TypeScript strict, Tailwind CSS 4, SVG simulations, Vercel AI
SDK with @ai-sdk/google, Vitest, Testing Library, and Playwright.