trak
StudioNEW

trak studio

Aliases:trak uitrak dashboardtrak web

Launches the local Trak Studio Web Dashboard and mounts an embedded visual IDE directly in your default browser.

$ trak studio [-p, --port <port>]

Command Overview

Starts an in-memory virtual HTTP server on port 8200 (or custom port via -p/--port) and mounts an embedded Single Page Application connected to your local curriculum workspace via a high-performance REST bridge. Features an interactive curriculum roadmap, integrated Monaco Code Editor with live disk sync, real-time assertion test runner, multi-workspace hub, and documentation viewer. If launched within an active track directory (containing trak.json), Studio immediately displays your Track Dashboard; if launched outside, it routes to the Workspaces Hub to manage and switch between local tracks.

Execution Lifecycle

1
Workspace Detection — Inspects current directory for trak.json manifest and module hierarchy
2
Dynamic Port Binding — Binds to TCP port 8200 (or custom port via --port) with fallback checks
3
Virtual Filesystem Mounting — Serves embedded Single Page Application via Go's virtual filesystem (embed.FS)
4
HTTP Bridge Initialization — Binds local REST endpoints (/api/workspace, /api/file, /api/verify, /api/workspaces)
5
Browser Auto-Launch — Opens default system browser to /#/dashboard (if in track) or /#/workspaces (if uninitialized)
6
Graceful Shutdown — Cleanly terminates server and unbinds port upon Ctrl+C

Available Flags

-p, --portType: string • Default: 8200

Custom HTTP port for Trak Studio (e.g. 8500, 3000).

-h, --helpType: boolean • Default: false

Display studio command help and options.

Usage Examples

Launch Studio for Current Workspace
$trak studio

Launches the embedded Web Studio and opens http://localhost:8200 in your default browser.

Launch on Custom Port
$trak studio --port 8500

Runs Studio on port 8500 if the default port 8200 is already occupied.

Shorthand Port Flag
$trak studio -p 3000

Binds Trak Studio to port 3000 using shorthand flag.

Important Technical Guidelines

Zero External Dependencies (Zero npm install for users)

Trak Studio is compiled directly into the single trak binary using Go's embed.FS virtual filesystem. Learners don't need Node.js, npm, or an internet connection to run Studio.

Smart Routing: Workspace Hub vs Curriculum Dashboard

If you run 'trak studio' inside an initialized track folder (like ./learn-go), Studio opens directly to your active module roadmap and Monaco editor. If run from a parent folder, it opens the Workspaces Hub to let you manage and switch between all your tracks.

Live Bi-Directional Disk Synchronization

Files saved in Trak Studio's Monaco editor are immediately synced to your physical disk. Conversely, any edits made in VS Code or external tools are reflected in Studio upon refresh.

Frequently Asked Questions (FAQ)

Q:Do I need to install Node.js to use trak studio?
No. The entire Trak Studio frontend is pre-compiled and embedded inside the Trak CLI Go binary. Running 'trak studio' is completely self-contained.
Q:Can I run tests inside Trak Studio?
Yes! Trak Studio includes an integrated Test Runner with live output and pass/fail indicators that runs your local toolchains (Go, Rust, Python, TypeScript, JavaScript, C, C++) just like 'trak verify'.
Q:How do I stop Trak Studio?
Press Ctrl+C in the terminal where 'trak studio' is running to cleanly shut down the server.