scalacenter/scastie
56.7
Adequate · 20 September 2026
17.3k
lines of production code
Scala
primary language
1
measurement over time
What this system is
This system is Scastie, a web-based playground for writing, running, and sharing Scala code snippets. It provides a browser-based editor with intelligent code completion and syntax highlighting powered by the Metals language server, supporting both SBT and Scala CLI build tools. The platform manages snippet persistence via file storage or MongoDB and executes code in isolated remote runners, exposing results and diagnostics through a REST API and real-time WebSocket connections.
How it got here
2012–2017 — infrastructure modernization and UI redesign
18 changes.
The project underwent a major overhaul of its build and deployment infrastructure, migrating from legacy OpenShift hooks to a modern Docker-based system with SBT project matrix support. Concurrently, the codebase was updated to Scala 3, the client interface received a complete visual redesign with dark/light themes, and new instrumentation and demo features were added to enhance the developer experience.
2018–2025 — Scala CLI integration and infrastructure modernization
25 changes.
The project expanded its execution capabilities by introducing a dedicated Scala CLI runner and integrating the Metals language server for advanced code assistance features like autocompletion and diagnostics. Concurrently, the backend was modernized with a persistent storage layer, a migration to Akka HTTP, and comprehensive test coverage for the new components.
Features
Add hands-on Scala.js oscilloscope and raycasting demos
New interactive demo scripts have been added to the hands-on Scala.js section: an oscilloscope visualization that renders animated sine and absolute-value waveforms on an HTML5 canvas, and a raycasting engine that renders a 3D scene with spheres, planes, and lighting effects. These files provide concrete examples of using Scala.js to interact with the DOM and perform real-time graphics rendering in the browser.
demo/hands-on-scala-js · high confidence
Add local scalafmt wrapper and CI cache management scripts
The repository now includes a set of shell scripts in the \bin/\ directory to support code formatting and CI optimization. A local \scalafmt\ wrapper is added, which uses Coursier to download and bootstrap \scalafmt-cli\_2.12:1.5.1\ if not already present, enabling consistent formatting checks via a pre-commit hook. Additionally, \before\_cache.sh\ and \copy\_cache.sh\ are introduced to manage and optimize CI caching by cleaning up \.sbt\ lock files and \.ivy2/cache\ properties, while \hooks.sh\ automates the installation of the pre-commit hook.
bin · high confidence
Add runtime configuration and utility infrastructure
This change introduces a new default configuration file (reference.conf) that sets the server hostname and Akka port via environment variables, and defines timeouts for runner reload, compilation, and execution (defaulting to 30s each), alongside Akka process dispatcher settings. It also adds several utility components: a Base64UUID generator for creating URL-safe unique identifiers, file handling utilities for reading/writing content and managing process ID files, and Akka Stream GraphStage components to forward stream elements to a coordinator actor.
utils/src/main · high confidence
Added Brazilian Portuguese and Japanese language support
The application now supports Brazilian Portuguese (pt-BR) and Japanese (ja) in addition to English. This change introduces the client-side internationalization infrastructure, including a new I18n module for parsing and managing translations, and registers the new language packs so users can switch their interface language to these options.
client/src/main/scala/org/scastie/client/i18n · high confidence
Added Fira Code and Font Awesome 4.7.0 font resources
The client now includes the necessary CSS and font files to support the Fira Code monospaced font and the Font Awesome 4.7.0 icon library. This change adds the \fira\_code.css\ stylesheet for the Fira Code typeface and the \font-awesome.css\ and \font-awesome.min.css\ files for Font Awesome, enabling the application to render these specific fonts and icons correctly.
client/src/main/resources/fonts · high confidence
Added Japanese and Brazilian Portuguese translations
The client now includes translation files for Japanese (ja.po) and Brazilian Portuguese (pt-BR.po), making the interface available in these languages alongside the existing English version. These files provide localized strings for the topbar, sidebar, editor, and login components, allowing users to switch their preferred language via the language selector.
client/src/main/resources/locales · high confidence
Added Scala CLI support for runner and migration tooling
The runner now supports execution via Scala CLI, introducing a new entry point in the runner module that handles class loading and exception printing with colored output options. Additionally, a new string escaping utility has been added to the runtime API to handle special characters and control codes consistently. A migration script has also been introduced to facilitate data transfer between storage versions, leveraging the new API structures and ensuring compatibility during the transition.
runner, runtime-api, scripts · high confidence
Editor gains intelligent code assistance and precise syntax highlighting
The code editor now provides real-time autocompletion, hover documentation, and signature help powered by the Metals language server, with debouncing to prevent spam and caching for performance. It also features accurate, tree-sitter-based syntax highlighting that replaces the previous mode-based approach, ensuring correct colorization of Scala code. Additionally, actionable diagnostics are displayed directly in the editor, and type decorations are rendered inline to show variable types as you type.
client/src/main/scala/org/scastie/client/components/editor · high confidence
Initial project scaffolding and configuration
The repository is initialized with essential configuration files including .gitmodules for the tree-sitter-scala submodule, .sbtopts for JVM and GC tuning, and .scalafmt/.scalafix.conf for code formatting and linting. A new Vite build configuration (vite.config.js) is introduced to replace the previous build system, alongside a Nix development environment (default.nix) and updated documentation (README.md, CONTRIBUTING.md).
(repo-wide) · high confidence
Initial server configuration and logging setup
The server now includes its foundational configuration files, introducing a Logback logging setup that outputs to the console and configures Akka logging levels. A new reference.conf defines default settings for the application, including file-based snippet storage, MongoDB connection details, OAuth2 credentials, and Akka cluster/remote settings using the Artery protocol. Additionally, an application.conf is provided to enable production mode.
server/src/main/resources · high confidence
Introduce Scala CLI runner service
Added a new standalone Scala CLI runner component that executes Scala code snippets via the Scala CLI tool. This service uses Akka actors to manage task execution, including compilation and runtime phases, and communicates with the main application via Akka remote actors. It supports configurable timeouts for compilation, reloading, and running, as well as environment-based configuration for hostname, port, and production mode. The runner also includes logging configuration via Logback and handles error reporting and progress updates back to the client.
scala-cli-runner/src/main · high confidence
Introduce filesystem and MongoDB storage backends for snippets and users
The storage module now provides concrete implementations for persisting user data and code snippets using both a local filesystem and MongoDB, replacing the previous in-memory-only approach. Users can now have their snippets and privacy policy settings persisted across restarts via the new FilesystemContainer and MongoDBContainer classes, which implement the SnippetsContainer and UsersContainer traits to handle creation, listing, updating, and deletion of snippets as well as user management.
storage · high confidence
Introduce structured API models for diagnostics, completions, and runner state
The API layer now uses a comprehensive set of new case classes to represent code analysis and runner status, replacing previous ad-hoc structures. This includes structured \Problem\ and \Severity\ types for diagnostics, \CompletionItemDTO\ and \SignatureHelpDTO\ for code completion and signature help, and \RunnerState\ for tracking the status of SBT and Scala-CLI runners. Additionally, \ConsoleOutput\ is now a sealed trait distinguishing between SBT, Scala-CLI, and user output, and \BaseInputs\ is formalized to support both SBT and Scala-CLI configurations with worksheet mode and library dependencies.
repository · high confidence
Introduction of core API interface and Scala version management
This change introduces the foundational API layer for the application, defining the \RestApi\ trait which specifies the contract for snippet operations (run, save, update, fork, delete, format, fetch) and user data retrieval. It also adds \RuntimeCodecs\ for serializing runtime errors and rendering states, and a comprehensive \ScalaVersions\ object that hardcodes a wide range of supported Scala versions (including Scala 2.10–2.13 and Scala 3.0–3.8.x) alongside build-time version info, enabling the API to correctly identify and suggest available compiler versions to users.
api · high confidence
New Metals-based interactive code features
This change introduces a new backend service (metals-runner) that integrates the Metals presentation compiler to provide interactive coding capabilities. For users, this enables real-time code completion, signature help tooltips, hover documentation, and actionable diagnostics (including code actions) within the editor. The implementation supports Scala 2.12, 2.13, and 3, and includes per-user caching of presentation compilers to improve performance and resource usage.
metals-runner/src/main/scala · high confidence
New demo snippets for Scala 3, graphics, and UI
The demo section now includes several new example snippets: \dotty.scala\ demonstrates Scala 3 union types; \reftree.scala\ and \scrimage.scala\ showcase image generation and manipulation libraries; \snellen.scala\ renders an eye chart using HTML/CSS; \color-full.scala\ adds colored console output; \cats.scala\ provides a basic Cats typeclass example; \dodge.scala\ tests Scala.js DOM interaction and error handling; and \bug.scala\ illustrates complex SVG rendering with the Doodle library.
demo · high confidence
New deployment infrastructure and operational tooling
This change introduces a complete set of deployment scripts and configuration files to manage the Scastie application across local, staging, and production environments. The new \deploy.sh\ script automates the Docker-based rollout for SBT, Metals, and Scala-CLI runners, handling image tagging, container replacement, and startup. Configuration is now environment-specific via \local.conf\, \staging.conf\, and \production.conf\, defining distinct hostnames, port ranges, and storage backends (file vs. MongoDB) for each stage. Operational support is enhanced with \log.sh\ for tailing container logs, \logback.xml\ for structured logging with Sentry integration, and \announce.scala\ for managing beta access waves. A \test.sh\ script is also provided for local verification of the runner setup.
deployment · high confidence
New instrumentation system with DOM attachment and Scala 3 support
The instrumentation module now includes a new system that supports Scala 3 syntax and attaches DOM elements for Scala.js applications. Users will see instrumented code that wraps statements in \scala.Predef.locally\ blocks with precise position tracking, enabling better error highlighting and state management. For Scala.js, the generated code now includes \DomHook\ integration to properly attach rendered DOM elements, and the instrumented value is renamed to \$t\ to avoid recursive type issues. The system also handles empty snippets and various edge cases like multiline expressions and comments.
instrumentation · high confidence
New runtime instrumentation and DOM attachment support for Scala.js
The runtime-scala module now includes a new instrumentation framework (InstrumentationRecorder) that tracks code execution statements and binders, allowing the system to capture and serialize runtime results as JSON. For Scala.js targets, a new DomHook mechanism attaches unique UUIDs to rendered DOM elements, enabling the frontend to identify and manage specific UI components. The Runtime object has been split into platform-specific implementations: Scala.js now handles HTMLElement attachment and error reporting via ScalaJsResult, while JVM targets (2.12, 2.13, 3) provide image processing capabilities (converting files to base64 HTML) and type-aware rendering.
runtime-scala · high confidence
Support for Scala CLI runners and status tracking
The platform now supports running Scala snippets using Scala CLI in addition to the existing SBT support. This change introduces dedicated dispatcher components (ScalaCliDispatcher and SbtDispatcher) in the balancer service to manage and load-balance connections to remote Scala CLI and SBT runners, handling server connectivity, task distribution, and status updates. On the client side, the UI components have been updated to include reusability definitions for Scala CLI runner states, enabling the frontend to display the status of Scala CLI execution alongside SBT results.
balancer/src/main/scala, client/src/main/scala/org/scastie/client/components · high confidence
Support for Scala CLI with quoted dependency parsing and nightly version resolution
The client now supports Scala CLI as a build target, allowing users to specify Scala versions and dependencies via code headers (e.g., \//\> using scala\, \//\> using dep\). This includes support for quoted dependency directives and automatic resolution of nightly Scala versions (2.12, 2.13, and 3) by fetching the latest build from the server API with a one-hour cache. Additionally, switching between SBT and Scala CLI targets now preserves existing library dependencies, converting them into the appropriate format for the new target.
client/src/main/scala/org/scastie/client/scalacli · high confidence
Removals
Removal of OpenShift-specific configuration file
The \conf/openshift.conf\ file has been deleted, removing the application's specific configuration for the OpenShift platform. This eliminates the hardcoded secret key and the commented-out database connection settings (MySQL and H2) that were previously defined for that environment.
conf · high confidence
Removal of legacy OpenShift action hooks and cron templates
The deployment automation scripts located in the \.openshift\ directory have been removed. This includes the \action\_hooks\ (build, deploy, load\_config, post\_deploy, pre\_build, start, stop) that previously managed the Play application lifecycle, as well as the \cron\ directory containing scheduled job templates and documentation. Users will no longer have these default shell scripts available to customize build, start, stop, or periodic background tasks on OpenShift.
.openshift · high confidence
Behavioural changes
Client application restructured with new core modules and API support
The client-side codebase has been reorganized into a new modular structure, introducing dedicated files for ANSI color formatting, HTML escaping, event streams (WebSocket and EventSource), global state management, local storage persistence, and REST API communication. This change adds support for fetching the latest version of a snippet via a new \/latest\ endpoint in the API client and establishes the foundational routing and entry-point logic for the main application and embedded modes.
client/src/main/scala/org/scastie/client · high confidence
Complete visual redesign with new dark/light themes and embedded mode support
The client interface has been completely restyled with a new visual identity, introducing dedicated dark and light themes (using Solarized color palettes) that apply consistently across the sidebar, topbar, editor, and build settings. A new changelog modal has been added to display update history, and the embedded snippet view now features a distinct overlay menu and styling to ensure it integrates cleanly into external websites. Additionally, ANSI terminal output in the console is now properly colorized, and the editor's CodeMirror integration has been updated with custom scrollbar and tooltip styling.
client/src/main/resources/sass · high confidence
Configurable Metals runner settings via environment variables
A new configuration file for the Metals runner has been added, defining default values for cache expiration (180 seconds), port (8000), and Docker mode (false). These settings can now be overridden at runtime using the environment variables CACHE\_EXPIRE\_IN\_SECONDS, PORT, and IS\_DOCKER, allowing users to customize the runner's behavior without modifying the source code.
metals-runner/src/main/resources · high confidence
Improved error reporting and isolated execution for Scala code
The SBT plugin now provides more precise compiler diagnostics by including exact line and column ranges for errors and warnings, allowing the UI to highlight specific error locations. Additionally, runtime errors and standard output are now captured and sent as structured JSON messages, enabling better display of exceptions and console logs. The plugin also implements an isolated execution environment that traps System.exit calls, preventing user code from terminating the entire JVM session.
sbt-scastie · high confidence
Initial balancer configuration for snippet storage and remote ports
A new reference configuration file is introduced for the balancer service, defining default settings for snippet storage (file-based) and remote execution environments. It specifies local paths for current and old snippets, sets the remote hostname to localhost, and allocates specific port ranges for remote SBT (starting at 5150) and Scala CLI (starting at 5250) instances, while also disabling a specific Akka serialization warning.
balancer/src/main/resources · high confidence
Major build infrastructure overhaul and runner deployment refactor
The project's build system has been significantly restructured to support modern deployment workflows and improved developer experience. SBT has been upgraded to version 1.13.0, and the build now utilizes \sbt-projectmatrix\ for cross-compilation. A new \Deployment\ module in the \project/\ directory introduces dedicated tasks for publishing and deploying Docker containers for SBT, Scala-CLI, and Metals runners, including support for shared Docker caches and local/staging/production environments. The build also adds a \Welcome\ plugin to display useful task hints and updates core Scala versions, including Scala 3.9.0 as the stable LTS and Scala 3.10.0-RC1 as the latest next release.
project · high confidence
Migration to Vite build system with new entry points
The client application has migrated its build process to use Vite, introducing new entry point files (main.js and embedded.js) and an updated index.html. This change updates how the application initializes, specifically by importing the Scala.js output via a 'scalajs:main.js' protocol and configuring the Sentry error tracking client with a specific DSN and trace sample rate. The embedded variant now exposes the Tree-sitter parser globally, while the main entry point initializes the Scastie application and Sentry monitoring.
client/src/main/resources/prod · high confidence
New Vite-based development entry points with Tree-sitter integration
The development environment now uses new HTML and JavaScript entry points (index.html, main.js, embed.html, embedded.js) to bootstrap the application via Vite. This change introduces web-tree-sitter for syntax highlighting and configures the client to initialize the main Scastie application and embedded playground instances, replacing the previous development setup.
client/src/main/resources/dev · high confidence
SbtRunner migration to Akka Remote Artery with configurable connection settings
The SbtRunner now uses Akka Remote Artery for communication, replacing the previous remoting mechanism. This change introduces a new application.conf with configurable hostname and port settings (overridable via environment variables like RUNNER\_HOSTNAME and RUNNER\_PORT), enables cluster provider mode, and increases the maximum frame size to 5 MiB to support larger payloads. The runner also supports a reconnect mode and includes updated logging configuration via logback.xml.
sbt-runner/src/main · high confidence
Server-side architecture refactored to Akka HTTP with new OAuth and API endpoints
The server implementation has been rewritten to use Akka HTTP, introducing a modular route structure that includes REST API endpoints for snippet management (run, save, update, fork, delete, format), a new /latest endpoint for fetching the most recent snippet version, and a dedicated route for nightly Scala version resolution. Authentication is now handled via a new GitHub OAuth2 flow that supports organization-based user switching, allowing users to toggle between accounts. The server also exposes real-time status and progress updates via Server-Sent Events (SSE) and WebSockets, with status details hidden from non-admin users. Additionally, a temporary route for the scala-lang frontpage and improved download functionality have been added.
server/src/main/scala · high confidence
Test coverage
Added integration and unit tests for the code execution balancer; Added test configuration for local actor provider; Added test suite for Scala CLI runner; Added tests for Metals dispatcher caching and server completions; Added tests for ProcessActor shell interaction; Added tests for SBT runner actor behavior and configuration; Added tests for snippet ID route matching; New static HTML pages for testing embedded Scastie instances.
Dependencies
Initial dependency configuration for Scastie build and client
This change introduces the foundational dependency manifests for the Scastie project. The Scala build configuration (build.sbt) defines the core library versions, including Akka 2.6.19, Akka HTTP 10.2.9, Metals 1.6.7, and ScalaTest 3.2.17, while also configuring Docker image generation for the SBT runner, Metals runner, and Scala CLI runner. On the client side, package.json establishes the frontend dependency tree, specifying Vite 5.0.10 as the build tool, CodeMirror 6.x for the editor, and Sentry 7.x for error tracking, with the corresponding versions locked in yarn.lock.
(dependencies) · high confidence
Updated SBT plugins and build configuration
The build configuration in project/project has been updated to use sbt-projectmatrix 0.11.0, sbt-scalajs 1.7.1, and sbt-buildinfo 0.11.0. Additionally, a soft link was created to share the SbtShared.scala file between the build and build-build directories.
project/project · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Baseline
- First survey — no prior run to compare against. CAI 57.
Lenses
- Code Health 95
- Architecture 95
- Maturity 59
- Readiness 57
- Security 77
- Accessibility 47
Changes since last survey
- 300 commits — 243 feature/other, 57 fixes
By area
- (root) — 109 commits
- client/src — 52 commits
- api/src — 38 commits
- project/SbtShared.scala — 27 commits
- (repo) — 25 commits
- metals-runner/src — 9 commits
- instrumentation/src — 8 commits
- .github/workflows — 6 commits
- sbt-runner/src — 5 commits
- scala-cli-runner/src — 5 commits
- balancer/src — 4 commits
- project/Deployment.scala — 3 commits
- project/plugins.sbt — 3 commits
- server/src — 2 commits
- .github/dependabot.yml — 1 commit
- deployment/logback.xml — 1 commit
- project/project — 1 commit
- utils/src — 1 commit
Notable commits
- fix: Add latest RC, fix version selector (#748)
- fix: Deployment fixes (#1175)
- fix: Fix autocomplete (#1217)
- fix: Fix cli parsing (#1216)
- fix: Fix dot autocompletion (#962)
- fix: Fix expected in MetalsServer, SbtActor tests (#1119)
- fix: Fix multiple issues with autocompletions (#885)
- fix: Fix non scrollable tooltips (#963)
- fix: Fix pipe in SSH (#757)
- fix: Fix syntax highlight (#1218)
- fix: Fix tab (#1000)
- fix: Fix version mismatch (#1016)
- fix: FormatActorTest: fix using old method signature (#1118)
- fix: Revert "Bump vite from 5.0.10 to 5.1.6" (#1149)
- fix: Snippet loading fix (#1017)
- fix: Try to fix metals inifinite compilation (#999)
- fix: fix last line comment (#926)
- fix: fix sbtActor tests
- fix: fix ssh again (#759)
- fix: fix(embedded): respect user targetType instead of defaulting to scala-cli (#1196)
- …and 280 more
Architecture
- 0 containers · 1 bounded contexts · 0 dependency edges (baseline)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
scalacenter/scastie was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 073a9c4b07fadd8f60ec86421e016d9d056bb155 — the exact code this score is about.
- Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.