DEV Community

Surendra Singh Kamboj
Surendra Singh Kamboj

Posted on AI-assisted

What I learned building 400+ 3D physics and chemistry labs for the browser

I am building PractiSci, a virtual lab for Class 11 and 12 physics and chemistry students in India. It now has 400+ interactive 3D experiments that run in a normal browser tab, on a phone or a laptop, in English and Hindi. This is what I learned along the way.

The stack

The website is Next.js with three.js for the 3D scenes. The API is Express with MongoDB and JWT sessions. Every lab is a small module that exposes one function which builds the scene, a list of controls and a list of readouts. The player is generic, so a new experiment is mostly a new folder.

Lesson 1: realism is a set of small helpers, not big models

A metre bridge that looks like a real one needs a wooden base with grain, a steel strip, a brass terminal and a ruler with proper tick marks. Writing a shared helper for each of these (a wood texture, a steel material, a ruler, a glass tube, a spring) made later labs cheap to build and made all of them look like they belong to one lab bench. I now check every new scene against a photo of the real apparatus before I call it done.

Lesson 2: the physics must be right before the picture is pretty

Students will compare the readings with their textbook. Each lab has a small engine behind it: an Ohm's law lab gives real resistance values with a tolerance, a double-slit lab computes fringe width as lambda D / d, a Carnot engine lab follows the p-V cycle. I wrote unit tests for the formulas, so a visual change cannot quietly change a result.

Lesson 3: do not ship paid lab code to every visitor

The lab modules are not part of the website bundle. The API sends a lab's code only after it has checked the signed-in student's plan, so the free labs stay free and the paid ones are not sitting in a public JavaScript file.

Lesson 4: phones decide your scene budget

Most students open the labs on a phone. That meant fewer lights, small textures, and no heavy post-processing. I also made the loading screen identical for every lab, so waiting feels the same whether it is physics or chemistry.

Lesson 5: make the content findable

A great lab nobody can find is useless. Each lab has its own page with a title, a description, JSON-LD (LearningResource, FAQPage, BreadcrumbList), a sitemap entry, and chapter guides such as ray optics and current electricity that explain the formulas and link to the labs. I also publish an llms.txt so AI assistants can describe the site correctly.

What is next

More chemistry benches, a better teacher view, and more Hindi explanations. If you work on educational simulations I would like to hear how you handle realism versus performance. You can look at the labs here: practisci.in/labs.

Top comments (0)