Spaceport Documentation — Table of Contents
Getting Started
- Introduction — What Spaceport is, key features, quick start guide, and how the documentation is organized.
- Developer Onboarding — Set up your development environment with Java, CouchDB, and recommended tools.
- Groovy Luminary Certification — Learn Groovy from basics to advanced concepts, with Spaceport-specific patterns.
Tutorials
- Tutorial: Tic-Tac-Toe — Build a complete interactive game in two files to learn routing, templating, and server actions.
- Tutorial: Meeting Room Booker — Build a business application covering data persistence, sessions, and reactive UI.
Core Architecture
Alerts (Event System)
Spaceport's unified publish-subscribe event system for HTTP routing, WebSocket messaging, lifecycle hooks, and custom events.
- Alerts Overview — What Alerts are, event strings, result types, priority, and cancellation.
- Alerts API Reference — Complete reference for the
@Alertannotation,HttpResult,SocketResult,Result, and event string syntax. - Alerts Internals — How the dispatcher works, handler discovery, threading model, weak references, and hot-reload behavior.
- Alerts Examples — Real-world patterns for routing, middleware, authentication guards, and document event handling.
Source Modules
Hot-reloadable Groovy classes that contain your application logic.
- Source Modules Overview — What source modules are, directory structure, auto-discovery, and hot-reload behavior.
- Source Modules API Reference — Configuration options, module lifecycle, class loading rules, and manifest settings.
- Source Modules Internals — How Spaceport compiles, loads, and reloads Groovy classes at runtime.
- Source Modules Examples — Patterns for organizing multi-module applications, shared utilities, and module dependencies.
Routing (HTTP Handling)
HTTP request handling, URL patterns, and response writing.
- Routing Overview — How HTTP requests flow through Spaceport, URL matching, and response patterns.
- Routing API Reference — Complete reference for URL patterns, HTTP methods, query parameters, headers, cookies, and response writing.
- Routing Internals — How Jetty dispatches requests into the Alert system, context objects, and the request lifecycle.
- Routing Examples — Patterns for REST APIs, file uploads, redirects, error pages, and middleware chains.
Guides
- Forms Guide — Traditional forms vs. server action forms, file uploads, validation, the transmission object, and common patterns.
Data Management
Cargo (Reactive Data Containers)
Reactive data structures that bridge server state and client UI.
- Cargo Overview — What Cargo is, session-scoped vs. document-backed Cargo, and reactive binding integration.
- Cargo API Reference — Complete reference for
Cargomethods: get/set, lists, push/pop, combine, JSON serialization, and store operations. - Cargo Internals — How Cargo tracks changes, notifies Launchpad bindings, and persists to CouchDB.
- Cargo Examples — Patterns for shopping carts, form state, real-time lists, and shared data across sessions.
Documents (CouchDB ORM)
ORM-style interface for CouchDB document storage and retrieval.
- Documents Overview — What Documents are, defining document types, CRUD operations, and views.
- Documents API Reference — Complete reference for
Documentclass methods, field types, views, lifecycle hooks, and database operations. - Documents Internals — How Spaceport communicates with CouchDB, document caching, revision handling, and conflict resolution.
- Documents Examples — Patterns for user profiles, content management, relational-style queries, and bulk operations.
Sessions & Client Management
User authentication, session state, and client tracking.
- Sessions Overview — What sessions and clients are, the
spaceport-uuidcookie, authentication flow, and session-scoped data. - Sessions API Reference — Complete reference for
Clientclass methods, authentication, session data, and WebSocket client tracking. - Sessions Internals — How Spaceport manages client objects, cookie lifecycle, WebSocket session binding, and memory management.
- Sessions Examples — Patterns for login/logout, role-based access, per-user state, and multi-device session handling.
UI & Templating
Launchpad (Templating Engine)
Server-side templating with reactive bindings and server actions.
- Launchpad Overview — What Launchpad is, GHTML templates, assemble/launch pattern, reactive bindings, and server actions.
- Launchpad API Reference — Complete reference for
Launchpadclass, template syntax,<g:*>generators, built-in variables, and transmission API. - Launchpad Internals — How template preprocessing, the Catch proxy, reactive binding tracking, and WebSocket update dispatch work.
- Launchpad Examples — Patterns for page composition, conditional rendering, reactive lists, form handling, and nested templates.
HUD-Core.js (Client-Side Library)
Lightweight JavaScript library for WebSocket communication, event binding, and DOM patching.
- HUD-Core Overview — What HUD-Core does, how to include it, and its role in the reactive update pipeline.
- HUD-Core API Reference — Complete reference for client-side APIs, WebSocket lifecycle, event binding, DOM operations, and configuration.
- HUD-Core Internals — How HUD-Core manages the WebSocket connection, processes server messages, and patches the DOM.
- HUD-Core Examples — Patterns for custom client-side behavior, manual WebSocket messaging, and integration with third-party JavaScript.
Transmissions (Client-Server Communication)
The data pipeline that carries client-side data to server actions and returns responses.
- Transmissions Overview — What transmissions are, how form data and element values flow to server closures, and response types.
- Transmissions API Reference — Complete reference for transmission objects, data accessors, response formats, and DOM targeting.
- Transmissions Internals — How HUD-Core serializes client data, the WebSocket message protocol, and server-side deserialization.
- Transmissions Examples — Patterns for form submission, multi-element updates, file handling, and redirect responses.
Server Elements (Reusable Components)
Encapsulated, reusable full-stack components with their own templates and server logic.
- Server Elements Overview — What server elements are, how to define and use them, and component composition.
- Server Elements API Reference — Complete reference for element definition syntax, attributes, slots, and lifecycle.
- Server Elements Internals — How Spaceport discovers, compiles, and renders server element templates.
- Server Elements Examples — Patterns for navigation bars, form components, data tables, and nested element composition.
Static Assets
Serving images, CSS, JavaScript, fonts, and other static files.
- Static Assets Overview — How Spaceport serves static files, directory conventions, and MIME type handling.
- Static Assets API Reference — Configuration options, caching, path resolution, and custom asset handling.
Developer Tools
Spaceport CLI
Command-line interface for starting Spaceport and running migrations, including unattended execution.
- CLI Overview — Available commands, flags, and common workflows.
- CLI API Reference — Complete reference for all CLI commands, arguments, and configuration flags.
Scaffolds
Project structure templates and starter kits for new applications.
- Scaffolds Overview — What scaffolds are, available starter kits (Port-Echo, Port-Mercury), and project directory structure.
- Scaffolds API Reference — Configuration options, directory conventions, and customization.
- Scaffolds Internals — Scaffold ownership and existing project configuration.
Manifest Configuration
The .spaceport configuration file that controls application startup and behavior.
- Manifest Overview — What the manifest file is, key configuration sections, and common settings.
- Manifest API Reference — Complete reference for all manifest keys, values, and their effects.
- Manifest Examples — Configuration patterns for development, production, multi-module, and custom setups.
Migrations
One-off scripts for database maintenance, data transformations, and administrative tasks.
- Migrations Overview — What migrations are, when to use them, and how to run them via the CLI.
- Migrations API Reference — Complete reference for migration script structure, available APIs, and execution context.
- Migrations Examples — Patterns for database seeding, schema evolution, data cleanup, and bulk operations.
Class Enhancements
Groovy metaclass extensions that add utility methods to standard types.
- Class Enhancements Overview — What class enhancements are, available extensions like
.clean(),.quote(),.if(), and.combine(). - Class Enhancements API Reference — Complete reference for all enhanced methods, their signatures, and behavior.
- Class Enhancements Internals — How Spaceport registers metaclass extensions and when they are available.
Stowaway JARs
Managing external Java library dependencies.
- Stowaways Overview — What stowaway JARs are, how to include external libraries, and classpath management.
- Stowaways API Reference — Configuration options, directory conventions, and classloader behavior.
HTTP Client
Built-in utility for making outbound HTTP requests to external APIs and services.
- HTTP Client Overview — What the HTTP client is, when to use it, and quick examples.
- HTTP Client API Reference — Complete reference for all methods, options, response format, and error handling.
Reference
- Compatibility Notes — Java version compatibility, JVM flags, and platform-specific configuration.
- Logging Overview — Application logging configuration and output.
- Ignition Scripts Overview — Startup scripts that run during application initialization.
Walkthroughs and live examples
- Rapid iteration: a Todo application — combine routing, Cargo, and reactive templates.
Make the docs better.Edit this page on GitHub