Quickstart: JavaScript runtime
PsyCloud experiments execute in a browser runtime — a JavaScript engine that loads a compiled Study Bundle and runs its trials, screens, and timing. You rarely hand-write that runtime code: you author a study (in Studio, the Python or R SDK, or the CoffeeScript DSL), the CLI compiles it to a bundle, and the runtime plays it back.
This quickstart is the local development loop for that runtime: serve a study from source, watch it reload as you edit, and build a standalone HTML file when you are done.
A clone of the PsyCloud repository and Node.js. The psycloud CLI ships with the repo — no
separate install. Run npm install once at the repo root.
- Install dependencies
git clone https://github.com/bbuchsbaum/psycloud cd psycloud npm installThis makes the
psycloudcommand available vianode bin/psycloud(and thenpm run servewrapper below). - Serve an example with live reload
The repo ships runnable examples under
examples/canonical/. Serve the minimal keypress study:node bin/psycloud serve examples/canonical/hello-keypress/coffee/author.coffeeThe dev server starts on http://localhost:3333, opens your browser, and rebuilds on every save. Use
-pto pick another port and--no-opento skip launching a browser. - Run once, without the watch loop
To play a study a single time (handy in scripts or CI):
node bin/psycloud run local examples/canonical/hello-keypress/coffee/author.coffeerun localaccepts an authoring script (.coffee/.ts);runon its own also accepts an already-compiledbundle.jsonorbundle.zip. - Build a standalone HTML file
When you want a single file you can host anywhere or hand to a participant offline:
node bin/psycloud build examples/canonical/hello-keypress/coffee/author.coffee -o experiment.htmlAssets are inlined by default; pass
--separateto keep JS/CSS as sidecar files and--minifyto compress.
Choosing a build size
serve and build accept -b <type> to control how much of the runtime is bundled:
minimal, standard, full, or auto (the default, which picks the smallest bundle that
covers the components your study actually uses). Start with auto.
How the pieces fit
Studio, the SDKs, or a .coffee script produce the canonical design / screen / bindings
programs.
psycloud compile (a project bundle) or psycloud run/serve (a script) turns authoring into a
runnable Study Bundle.
The browser runtime (src/flow.ts, src/factory.ts) loads the bundle and executes the flow.
Each run emits telemetry events you can export and analyze.
If you are writing the study itself rather than running an existing one, the CoffeeScript DSL quickstart shows the canonical authoring surface, and the Python and R quickstarts cover the SDKs.