Skip to content

A Swift framework for static sites and server-side rendering.

License

Notifications You must be signed in to change notification settings

raptor-build/raptor

Repository files navigation

Shows a black logo in light color mode and a white one in dark color mode.

a Swift framework for static sites and server-side rendering

Twitter: @jptoro


What Is Raptor?

Raptor is a Swift-first static site generator designed for developers who want the safety, structure, and expressiveness of Swift—without writing HTML or CSS.

Raptor provides a purpose-built API for generating websites at compile time. Its syntax will feel familiar if you’ve used SwiftUI, but it is not a SwiftUI-to-HTML converter. Instead, Raptor embraces the constraints of the web and models them explicitly in Swift.

The result: fast builds, predictable output, and websites whose structure is validated by the compiler.


Design Philosophy

Raptor is built around a few core principles:

1. Swift, Not Templates

Websites are authored entirely in Swift. Pages, layouts, and themes are expressed as types, not text files or templates.

2. Compile-Time Structure

Invalid layouts, missing content, and incompatible configurations are caught during compilation—not at runtime or in the browser.

3. Separation by Default

Content, structure, and presentation are distinct layers:

  • Content lives in Markdown
  • Structure lives in Swift
  • Presentation lives in themes and styles

This keeps large sites maintainable as they grow.

4. Web-Specific APIs

Raptor borrows ideas from SwiftUI where they make sense, but its APIs are designed specifically for static site generation—not UI rendering.


Core Capabilities

  • Declarative page composition using Swift
  • Markdown posts with YAML front matter
  • Layout and theme systems with light/dark support
  • Localization with locale-specific content
  • Syntax highlighting with configurable themes
  • Post widgets defined in Swift and embedded in Markdown
  • Built-in site search
  • Optional Vapor integration for server-side rendering
  • Self-contained output (no Bootstrap or external CSS frameworks)
  • Strong type safety across layouts and content

For a full breakdown of features and APIs, see the documentation at
👉 https://raptor.build


What Raptor Code Looks Like

Pages and components are written using a declarative Swift syntax:

Text("Swift for the web")
   .font(.title1)

Text(markdown: "Supports *inline* Markdown")
   .foregroundStyle(.secondary)

Link("Learn Swift", destination: "https://www.swift.org")
   .linkStyle(.button)

Image("hero.jpg", description: "Site hero image")
   .frame(maxHeight: 400)

Layouts define structure independently of content:

struct MyLayout: Layout {
   var body: some Document {
       Navigation {
           InlineText("RAPTOR")
               .navigationItemRole(.logo)
       }

       Main {
           content
           SubscribeForm()
       }
   }
}

Interactive behavior is modeled declaratively:

Disclosure("Advanced Settings") {
   Text("Configuration options here")
}

Button("Subscribe", action: .showModal("newsletter"))
   .buttonStyle(.primary)

Content with Markdown

Markdown files are used for long-form content and posts, with YAML front matter for metadata:

---
title: Welcome to Raptor
date: 2026-01-07
tags: swift, web, static-sites
---

Your Markdown content here, with support for code blocks,
images, and custom Swift-defined widgets.

Project Structure

A Raptor site follows a simple, conventional layout:

MySite/
├── Assets/          # Images, fonts, static files
├── Posts/           # Markdown content
├── Sources/         # Swift code (pages, layouts, themes)
│   └── Resources/   # Localized strings (optional)
└── Build/           # Generated output

For multilingual sites, organize posts by locale:

Posts/
├── en-us/
│   └── welcome.md
└── it/
   └── welcome.md

This structure is created automatically when you generate a new site.


Getting Started

Install the Raptor command-line tool:

git clone https://github.com/raptor-build/raptor
cd raptor
make
make install

Create a new site:

raptor new MySite
cd MySite
open Package.swift

Build and preview your site:

raptor build
raptor run --preview

The preview server is designed for an Xcode workflow—build with Cmd+R, then refresh your browser to see changes instantly.

Detailed guides and workflows are available at
👉 https://raptor.build/getting-started


Contributing

Contributions are welcome and appreciated.

  • Small improvements (tests, documentation, comments, minor fixes) can be submitted directly.
  • Larger changes (features, refactors, behavioral changes) should begin with an issue to discuss approach and scope.

Please spend time using Raptor before attempting significant contributions—understanding its design goals will lead to better results for everyone.


Project Status

Raptor is currently in early beta.

The core architecture is stable, but some APIs may evolve as the project matures. During this period, we recommend pinning dependency versions when using Raptor in production.


License

Raptor is licensed under the GNU General Public License v3+ (GPLv3+).

Copyright © 2026 J.P. Toro

You may freely build and publish any kind of website—personal or commercial—and all generated output is entirely yours. Raptor itself may be used as a dependency in GPLv3-compatible open-source projects. Separate licensing is available for proprietary use.

See the LICENSE file for full details.

About

A Swift framework for static sites and server-side rendering.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •