Hello World—From, Spaceport
Spaceport is a comprehensive full-stack web application framework engineered to make building applications dynamic, fast, and scalable. Designed for rapid iteration, it features an opinionated yet flexible technology stack built upon mature and powerful components. Spaceport uniquely enhances server-client interaction with built-in capabilities like server actions, server reactivity, and server elements—directly embeddable within your HTML. These features seamlessly integrate with robust backend systems developed using powerful Groovy modules offering a cohesive front to back development experience.
View Full Documentation Table of Contents
# A dynamic stack
Spaceport is built on a robust foundation of open-source components— Groovy, Jetty, and CouchDB, ensuring long-term support and transparency for your operations.
Groovy enables rapid application development and iteration through its dynamic nature and seamless integration and full interop with the mature Java ecosystem.
As a high-performance web server platform, Jetty enables Spaceport's secure and accessible HTTP and WebSocket communications, crucial for delivering robust web applications.
CouchDB offers a flexible and scalable NoSQL database with built-in replication for reliable data backup and secure storage of evolving data structures, earning it the tagline — relax.
On the front end, Spaceport embraces the universal standards of HTML, CSS, and JavaScript. Designed to work seamlessly with these core web technologies in their vanilla form, Spaceport provides intuitive mechanisms to extend their capabilities and directly connect your front-end interactions to its powerful backend.
# Rapidly develop, quickly iterate
Build dynamic web applications using Source Modules to organize your backend logic and Routing to handle HTTP requests. Spaceport's Alert-driven Event System connects these pieces together, letting you define endpoints, business logic, and data flows in one cohesive codebase. Changes to your Groovy modules take effect immediately—no rebuilds required—so you can iterate as fast as you can type.
/// modules/Todo.groovy
import spaceport.computer.alerts.Alert
import spaceport.computer.alerts.results.*
import spaceport.computer.memory.virtual.*
import spaceport.launchpad.Launchpad
class Todo {
// Use Alerts to hook into routing events, even with dynamic parameters
@Alert('~on /todo/(.*) hit')
static _index(HttpResult r) {
// Middleware encouraged
r.context.data.'todo-list' = Cargo.fromStore('todo-lists').get(r.matches[0])
// Render UI with Launchpad templates
new Launchpad().assemble(['ui.ghtml']).launch(r)
}
// Endpoint don't have to serve fancy templates, either
@Alert('on /api/todo/get-all hit')
static _getAll(HttpResult r) {
// Provide a quick JSON API endpoint
r.writeToClient(Cargo.fromStore('todo-lists').toPrettyJSON())
}
}
Build interactive UIs with Launchpad's HTML-first templates that embed Groovy directly in your markup.
Cargo provides a universal data container for common frontend/backend patterns, while Launchpad's
.ghtml templates offer reactive data binding—when server state changes, your UI updates automatically.
Server Actions connect DOM events to server-side logic, and Class Enhancements
like .clean(), .quote(), and .if() handle common template tasks like sanitizing input, escaping strings,
and conditional rendering. Build real-time interactivity without the boilerplate, while keeping full control to
add custom JavaScript when you need it.
/// launchpad/parts/ui.ghtml
<%@ page import="spaceport.computer.memory.virtual.Cargo" %>
<script src="https://cdn.jsdelivr.net/gh/spaceport-dev/hud-core.js@latest/hud-core.js" defer></script>
<body>
/// Use the context provided by the router
<% def list = data.'todo-list' as Cargo %>
/// Reactively render the list
${{ list.combine { def item -> """
<div class="item ${ 'done'.if { item.done }}">
/// Server actions provide seamless interactivity
<span on-click=${ _{ item.toggle('done') }}>
${ item.done ? '✓' : '○' }
</span>
/// Conditional attributes, client transmissions, and input cleaning
/// provide a safe and dynamic user experience
<input ${ 'disabled'.if { item.done }}
on-blur=${ _{ t -> item.text = t.value.clean() }}
value=${ item.getString('text').quote() }>
</div>
""" }
}}
<button on-click="${ _{ list.setNext() }}">Add New</button>
</body>
This combined example shows how Spaceport's systems work together: Cargo simplifies state, Server Actions
handle events like on-click and on-blur, and Class Enhancements provide utilities like
.clean(), .quote(), .if(), and .combine() for cleaner templates. The Alert system wires routes to
handlers, while Launchpad's reactive block ${{ }} syntax makes your UI reactive to server changes. Beyond what's shown
here, Spaceport also provides Documents for database persistence, Server Elements for
reusable components, Docking Sessions & Client Management for authentication, and more.
Ready to dive in? Start with Getting Started or jump straight to building your first app with
the Tic-Tac-Toe Tutorial.
# Getting Started
If you're a new to Spaceport development, we have a developer onboarding guide that will help you set up your development environment. This guide will walk you through the process of installing Java, CouchDB, and suggest other tools that will help you get started and launching.
New to Groovy? Check out the Groovy Luminary Certification for a comprehensive guide from basics of Groovy to some more advanced core concepts, and their interop with Spaceport. If you are familiar with Java or Javascript, you'll find Groovy easy to pick up.
## Your First Application
Before diving into a full starter kit, some cadets may prefer to get a feel for Spaceport by building something simple. These short, step-by-step tutorials will guide you through creating a complete, interactive application. You'll touch on many of the core concepts—from routing and templating to server-side state and UI updates—with only two files.
Build a Tic-Tac-Toe Game
Or, if you prefer a business application, instead:
Build a Meeting Room Booker
## Starter Kits
Once you have your development environment in place, Spaceport offers two Starter Kits to establish an initial scaffold for your application, giving you a starting point for your project with lots of room for customization.
Port-Echo Starter Kit
Port-Echo offers a basic scaffold and minimal boilerplate to get your application up and going without any additional assumptions.
Port-Mercury Starter Kit
Port-Mercury is a Spaceport starter kit that provides a basic app structure and configuration for building a single-tenant Spaceport application with some key Spaceport features. If you are just getting started with Spaceport, consider using this Starter Kit.
# Other Pre-requisites
- Java 8 SE or higher (Amazon Corretto 11 (LTS) or Azul Zulu 11 (LTS) recommended)
- See Java Compatibility Notes for version-specific configuration
- CouchDB 2.0 or higher (3.5.X+ Recommended)
- Learn more about working with CouchDB in the Documents documentation
# Get Spaceport Now
Don't have Spaceport yet? You can download it from the Spaceport Build Repository. Or, use the following command to grab the latest version:
curl -L https://spaceport.com.co/builds/spaceport-latest.jar -o spaceport.jar
# CLI Startup
To start Spaceport, run the following command:
java -jar spaceport.jar --start config.spaceport
This will start the application using the configuration file config.spaceport. You can also use the --no-manifest argument to assume a default configuration, or learn more
about the Spaceport Manifest file to customize your Spaceport startup sequence.
Check out the Compatibility Notes for any Java version-specific configuration that may be required.
## Additional CLI Commands
Spaceport also includes some command-line tools to help you manage your application. Check out the Spaceport CLI Documentation for more details. In addition to starting the server, you can:
- Run one-off scripts and maintenance tasks with Migrations
- Create a default scaffold with a prompted walkthrough using
--createflag - Make changes to the database without having to log into the CouchDB Fauxton UI using the
--dbflag
# Explore the Documentation
Ready to dive deeper? Here are some key areas to explore:
Core Features
- Alerts - Event-driven architecture and HTTP routing
- Source Modules - Organize your application logic
- Launchpad - Build dynamic, reactive UIs
- Cargo - Flexible data structures with reactivity
- Documents - ORM-like interface for CouchDB
Building UIs
- Server Elements - Create reusable full-stack components
- Transmissions - Handle client-server communication
- Sessions & Clients - Manage user authentication and state
Reference
- Class Enhancements - Groovy extensions for web development
- Routing - Deep dive into HTTP request handling
- Groovy Luminary Certification - Comprehensive Groovy and Spaceport guide
📚 View Full Documentation Table of Contents
SPACEPORT DOCS