// SwiftData, for the server

Your models.
Your server.
One language.

Share @Model classes between your iOS app and your Vapor backend. The SwiftData API you already know — running on PostgreSQL, MySQL, and SQLite.

// proof of concept: this website is a Vapor app persisting with SwiftDataServer

Models/User.swift shared: iOS + server
// Works on iOS, macOS, and Linux
@Model
final class User {
    var name: String

    @Attribute(.unique)
    var email: String

    @Relationship(deleteRule: .cascade)
    var posts: [Post] = []

    init(name: String, email: String) {
        self.name = name
        self.email = email
    }
}
01PostgreSQL / MySQL / SQLite / REST 02Swift 6 ready, Swift 5.10 compatible 03Linux-native deployment 04SwiftData-compatible API

01 — One mental model

Stop translating
between two worlds.

Most full-stack Swift teams write their models twice: once in SwiftData for the app, once in an ORM dialect for the server — then keep the two in sync by hand.

SwiftDataServer removes the second world. #Predicate, FetchDescriptor, and ModelContext behave the way they do on iOS — queries compile to SQL instead of touching a local store.

Routes/Users.swift vapor
// The same query you'd write in your app
let adults = try await context.fetchAsync(
    FetchDescriptor<User>(
        predicate: #Predicate { $0.age >= 18 }
    )
    .sorted(by: SortDescriptor(propertyName: "name"))
)

// SELECT * FROM users WHERE age >= 18 ORDER BY name ASC

02 — What's in the box

Everything the app side
takes for granted.

01

100% API compatible

The same @Model, #Predicate, FetchDescriptor, and ModelContext you know from SwiftData — share model files verbatim.

02

Four backends

PostgreSQL and MySQL for production, SQLite for development and tests, and a REST backend that persists through any HTTP API instead of a database.

03

First-class Vapor

Request-scoped contexts, response helpers, pagination, and automatic migrations on boot. Swift 6 strict concurrency throughout.

04

Real relationships

One-to-many and many-to-many with automatic join tables, lazy loading, and cascade / nullify / deny delete rules that behave like the originals.

05

Automatic migrations

Schema changes are detected and applied on boot. No migration files to write, number, or argue about in review.

06

Type-safe queries

Predicates are checked by the compiler and translated to parameterized SQL — composable, injection-safe, and identical to Apple's syntax.

03 — Ship it

One codebase, finally.

A perpetual license for your whole organization. Unlimited projects, all future updates.