Taking shape, out in the open

Less wiring.
More building.

A good home for your next Swift app.

Phoenix-inspired structure. Swift from route to response. Roost brings the pieces together, so you can get on with your idea.

Built on Nexus, Spectro, and ESW.

App.swift
import Roost

@main
struct Hello: RoostApp {
    @RouteBuilder
    var routes: [Route] {
        GET("/", PageController.self, .home)
    }
}

struct PageController: Controller {
    enum Action: String, ControllerAction { case home }

    static func action(_ action: Action) -> Plug {
        switch action { case .home: home }
    }

    static func home(_ conn: Connection) async throws -> Connection {
        conn.text("Hello, Roost.")
    }
}
GET /200 OK
Hello, Roost.

One route, one action. A place to begin.

Good company.
One Swift stack.

Nexus HTTP & routing 2.0 Spectro PostgreSQL & migrations 2.1 ESW HTML, compiled to Swift 1.6

A LITTLE STRUCTURE GOES A LONG WAY

Everything has
a place.

Your logic, in a context.

Keep business operations together. Typed models and repository-backed contexts give your HTML pages and JSON API the same source of truth.

The browser belongs here.

Sessions, forms, CSRF protection, and flash messages. Validation that keeps what someone typed. The details a web app needs, connected.

A shorter path to confidence.

Test the application pipeline in process. Keep cookies between requests and inject a transaction repository to isolate database tests.

YourApp/
Sources/YourApp/
App.swift
The way in
Contexts/
Your domain
Models/
Typed data
Controllers/
HTML & JSON actions
Routes/
Route tables
Views/
Compiled templates
Migrations/Schema, with history
Tests/Room to experiment

Familiar if you know Phoenix.
Native to the way you write Swift.

FROM THE FIRST ROUTE TO THE REAL THING

Start small.
Keep going.

Generate the connections. Write the parts that make it yours.

A reading list, in a few commands.

An app, authentication, then an owner-scoped resource. The generators create models, contexts, migrations, controllers, templates, and input tests together.

The reading-list example adds its own design, filters, and a “mark as read” action.

Meet the example
Terminal
# Give your idea a home
roost new RoostExample
cd RoostExample

# Add sign up, sign in, and sign out
roost gen auth

# One context. HTML and JSON.
roost gen resource Bookmark \
  title:string url:string \
  note:text read:bool \
  --both --scope user_id

Development API preview. The renamed Roost release and ESW template updates are still being prepared. Current status

Ownership travels with the query.

The context takes a repository and an authenticated scope. Reads stay inside the current user’s collection.

BookmarksContext.swift · excerpt
func listBookmarks(scopeId: UUID) async throws -> [Bookmark] {
    try await repo.query(Bookmark.self)
        .where({ $0.userId == scopeId })
        .orderBy(\.createdAt, .asc)
        .all()
}

A change, a message, a redirect.

Update the reading state, leave a one-time flash message, and send the reader back to their queue.

BookmarkController.swift · excerpt
let params = try conn.permit(ReadParams.self)
try await BookmarksContext(repo: conn.repo())
    .setRead(id: id, read: params.read, scopeId: readerID(conn))

return conn
    .putFlash(.info, "Moved to finished")
    .redirect(to: "/bookmarks")

The same pipeline. A smaller loop.

Exercise your app without opening a port. Swift Testing and RoostTest keep a simple route test simple.

HelloTests.swift
import Testing
import RoostTest

@Test func saysHello() async throws {
    let app = try await TestApp(Hello.self)
    let response = try await app.get("/")

    #expect(response.status == .ok)
    #expect(response.text == "Hello, Roost.")
}

A SMALL APP WITH A LOT CONNECTED

Made with Roost.

A quiet place for things you want to come back to.

roost / reading queueInteractive preview
roost.A little space to read.

COLLECT YOUR CURIOSITY

The reading queue.

  • A tour of Swiftdocs.swift.org
  • Designing with contextshexdocs.pm
  • The ESW template compilergithub.com

Three good things for later.

A real application.
Small enough to follow.

The Swift example connects authentication, owner-scoped bookmarks, ESW pages, a JSON API, and Spectro migrations.

One action
Follow a form through its route, context, database, and response.
One source of truth
Browser pages and API endpoints share the same domain operations.
Your own design
Generated structure leaves the look and feel to you.

This browser-only preview lets you save and finish links. It resets on reload. The Swift app itself runs on PostgreSQL.

ROOST PLAYGROUND / BROWSER EDITION

A little Swift, live.

A counter, a greeting, a change of state. Edit a guided example and see the result, right in your browser.

Make a small change

Runs locally in your browser. No Swift compiler.

BUILT IN THE OPEN

A clear starting point.

Roost is in active development. Here’s where things stand.

The Roost falcon

A Phoenix-inspired framework.
A Swift-shaped future.

The goal is a connected development experience for server-side Swift: from the first route to an app you can understand and keep growing.

Follow development on GitHub
What works today?

Roost 2.5.0 supports generated authentication, scoped CRUD, HTML and JSON controllers, permitted parameters, form validation, per-action logs and traces, Spectro migrations, live pages, reusable form fields, key-value stores, channels, jobs kept in PostgreSQL, HTTPS, and in-process tests. The reading-list workflow has been exercised against real PostgreSQL.

How do I get started?

Start with Roost 2.5.0 and follow the README quickstart to generate your first app. The CLI connects routes, templates, data, and tests, with published dependencies resolved by SwiftPM.

Development prerequisites are Swift 6.3+, macOS 15+ or Linux, and PostgreSQL for database-backed apps. Roost uses Nexus 2.x (from 2.1.0), Spectro 2.x (from 2.3.1), and ESW 1.7.0; no companion checkouts are required.

View releases
How close is it to Phoenix?

Phoenix inspires the application structure, contexts, controllers, generators, and browser conventions. Routes name controller actions the compiler checks, and resources, controller plugs, and permitted parameters work as they do in Phoenix. Roost uses Swift’s type system and package tooling. Live pages use ESW Live for server-rendered HTML and interactive updates, with session ownership and CSRF protection. Roost does not claim feature parity with Phoenix.

What’s still taking shape?

SMTP delivery still has unfinished integration. The example uses in-memory sessions; persistent deployments can use KeyValueSessionStore with Valkey. Live page state remains process-local.

Give your next idea
a good home.

Come build with Roost