Documentation
VLabs — Lab System Overview
VLabs is a Next.js application for interactive 3D electronics education. The lab system supports multiple experiment modes and has two key layers you can extend independently:
- Experiment definitions — TypeScript data files organised into semesters and subjects. Each experiment contains a circuit definition, lab content (aim, theory, apparatus, procedure, observations, conclusion), and metadata. Designed to be generated by AI.
- Component builders — Three.js geometry functions that turn a component instance into a 3D mesh. Each component type lives in its own folder under
src/components/.
The renderer (LabScene.tsx) is fully data-driven through a component registry — a plain object that maps type strings to builder functions. Adding a new component type requires creating a new folder in src/components/ and adding a registry entry.
How the pieces fit together
src/
components/ ← shared physical component library (Three.js geometry)
breadboard/ ← one folder per component type
resistor/
led/
ic/
diode/
bjt/
mosfet/
op-amp/
oscilloscope/
...28 component types
shared/ ← materials, primitives, helpers
index.ts ← barrel export
labs/
types.ts ← ComponentInstance union + Circuit type
lab-content.types.ts ← LabContent, TheorySection, ApparatusSection, etc.
LabScene.tsx ← Renderer + COMPONENT_REGISTRY
ApparatusScene.tsx ← 3D apparatus viewer
TheoryScene.tsx ← 3D schematic overlay
builder.ts ← CB fluent API for building circuits
coords.ts ← hole() / railHole() coordinate helpers
semesters/ ← experiment catalog
catalog.ts ← SEMESTER_SUBJECTS master registry
semester-01/
01-analog-electronics/
ohms-law/
01-aim.ts
02-theory.ts
03-apparatus.ts
04-procedure/
05-observations.ts
06-conclusion.ts
components.ts ← circuit definition
index.ts ← barrel export
...11 experiments
02-computer-application/
03-analog-electronics-advanced/
semester-02/
semester-03/
semester-04/
circuits/
index.ts ← re-exports SEMESTER_CIRCUITS as ALL_CIRCUITS
experiments/
types.ts ← ExperimentDefinition type
build.ts ← experiment building helpersLab modes
Experiments can use different rendering modes via the labType field:
| Mode | Description |
|---|---|
'breadboard' | Interactive 3D breadboard scene (default) |
'text' | Theory/text-only lab — no 3D scene |
'code' | Code editor / programming lab (e.g. 8085 assembly) |
'simulation' | Circuit simulation without physical breadboard |
Quick orientation
| Task | Files to edit |
|---|---|
| Add a new experiment | semesters/<sem>/<subject>/<name>/ (new folder with aim, theory, apparatus, procedure, observations, conclusion, components, index) + semesters/catalog.ts |
| Add a new component type (new physical part) | src/components/<name>/ (new folder) + src/components/index.ts + LabScene.tsx (one registry entry) |
| Add a new circuit (new wiring of existing parts) | Create components.ts in the experiment folder using the CB builder or manual Circuit object |
| Generate an experiment with AI | Paste src/labs/COMPONENTS.md into Claude, prompt, save output into the experiment folder structure |
Using AI to generate experiments
Paste src/labs/COMPONENTS.md into Claude, describe the experiment, and have it generate the full folder structure (aim, theory, apparatus, procedure, observations, conclusion, and circuit definition). Register the result in semesters/catalog.ts.
Pages in this guide
- Quickstart — add your first experiment in 5 minutes
- Video tutorial — watch a step-by-step walkthrough of adding an experiment
- Component types — every renderable type and its props
- Writing geometry — how to build a new Three.js component
- Registry & renderer — how
COMPONENT_REGISTRYworks - Circuit schema — the full
Circuittype - Pin references — every
PinRefvariant explained - Steps & highlighting — authoring step-by-step assembly
- Column layout guide — placement rules for breadboard columns
- TypeScript types — full type reference
- Constraints & rules — what the renderer expects