GALA Playground

July 5, 2026 ยท View on GitHub

GALA Go Docker License

A web-based playground for the GALA programming language, inspired by Go Playground. Write and run GALA code directly in your browser.

Try it live: gala-playground.fly.dev


Features

  • Browser-based code editor with line numbers, tab support, and resizable split panels
  • Instant execution -- compile and run GALA code with one click or Ctrl+Enter
  • 15 built-in examples covering all major GALA features
  • Error display -- compile errors and runtime panics shown inline
  • Share -- copy code to clipboard with one click
  • Dark theme -- developer-friendly IDE-like interface

Built-in Examples

ExampleFeatures Showcased
HelloBasic syntax, Println, func main()
Sealed TypesADTs, exhaustive pattern matching, expression functions
Pattern MatchingGuards, custom extractors (Unapply), type matching
CollectionsArray, Filter, Map, FoldLeft, functional pipelines
Option & EitherSome/None, Left/Right, safe null handling, validation
Try MonadPanic recovery, Map chaining, Recover, GetOrElse
HashMapImmutable maps, FoldLeft word counter, Sorted, MapValues
GenericsType parameters, generic structs, generic methods
Roman to IntString processing, FoldLeft, match on characters
StreamsLazy evaluation, infinite sequences, Take, Filter, Map
Named ArgumentsDefault params, named args in any order, Copy overrides
JSONJsonStringify, JsonParse, Json[T] extractor, Collect
RegexCapture groups via Unapply + Array destructuring, FindAll
IO EffectsIO[T] monad, Suspend, Map/FlatMap, Recover, AndThen
TourFull 10-section showcase with formatted output

Quick Start

Local

Requires Go 1.25+ and GALA 0.61.1+.

# Install GALA
curl -fsSL -o ~/.local/bin/gala \
  https://github.com/martianoff/gala/releases/latest/download/gala-linux-amd64
chmod +x ~/.local/bin/gala

# Clone and run
git clone https://github.com/martianoff/gala-playground.git
cd gala-playground
gala run .

Opens automatically at http://localhost:3000.

Docker (pre-built)

docker run -p 3000:3000 maxmtmn/gala-playground

Open http://localhost:3000.

Docker (build from source)

docker build -t gala-playground .
docker run -p 3000:3000 gala-playground

Architecture

gala-playground/
  main.gala          # GALA server (uses gala-server module)
  gala.mod           # GALA module file with dependencies
  static/
    index.html       # Single-page frontend (editor + output)
  examples/
    hello.gala       # 15 pre-loaded GALA examples
    sealed_types.gala
    ...
  Dockerfile         # Multi-stage build (GALA build + runtime)

The server is written entirely in GALA using the gala-server HTTP framework. Static files and examples are embedded at compile time using GALA's embed val directives.

How It Works

  1. User writes GALA code in the browser editor
  2. Clicking Run (or Ctrl+Enter) sends the code to /api/run
  3. The server writes the code to a temp directory with a gala.mod
  4. gala run transpiles the GALA code to Go and executes it
  5. Output (or errors) are returned and displayed in the output panel

API

EndpointMethodDescription
/api/runPOSTExecute GALA code. Body: {"code": "..."}. Returns: {"output", "error", "time"}
/api/examplesGETList all built-in examples. Returns: [{"name", "code"}]
/api/versionGETReturns the GALA version. Returns: {"version": "0.61.1"}
/GETServes the playground UI

Limits

  • Code size: 50 KB max
  • Execution timeout: 30 seconds
  • Single file: each run is a single main.gala with package main

Docker Details

The Dockerfile uses a multi-stage build:

StageBase ImagePurpose
buildergolang:1.25.5-alpineDownloads GALA and compiles main.gala via gala build
Runtimegolang:1.25.5-alpineRuns both the server and gala run

The runtime image includes Go because gala run invokes go build internally. The GALA stdlib and Go module cache are pre-warmed during the Docker build so the first user request is fast.

Configuration

Environment VariableDefaultDescription
BIND_ALL1 (in Docker)Bind to 0.0.0.0 instead of 127.0.0.1
PORT3000Server port

License

Apache License 2.0. See LICENSE for details.