Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 1, 2026·3 min de lecture

Kitura — Server-Side Swift Web Framework

Kitura is a server-side Swift web framework originally developed by IBM that provides an expressive router, Codable-based JSON handling, and middleware support for building REST APIs and web applications on Linux and macOS.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Kitura Framework
Commande d'installation directe
npx -y tokrepo@latest install e708c36a-7568-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

Kitura is a server-side Swift web framework that brings the safety and expressiveness of Swift to backend development. Originally created by IBM, it provides a performant HTTP server, a flexible router, and Codable routing that maps JSON payloads directly to Swift structs.

What Kitura Does

  • Routes HTTP requests to handler closures with typed parameters
  • Serializes and deserializes JSON payloads via Swift's Codable protocol
  • Supports pluggable middleware for sessions, compression, and authentication
  • Serves static files and renders templates through Stencil or Markdown engines
  • Runs on both Linux and macOS using Swift's cross-platform Foundation layer

Architecture Overview

Kitura is built on top of a custom non-blocking I/O layer (BlueSocket/NIO). Incoming connections are dispatched through a middleware chain, matched against the router's path tree, and handled by registered closures. Codable routing eliminates manual JSON parsing by decoding request bodies and encoding responses using Swift's built-in Codable machinery.

Self-Hosting & Configuration

  • Requires Swift 5.2+ on Linux (Ubuntu, RHEL) or macOS
  • Add Kitura as a Swift Package Manager dependency in Package.swift
  • Bind host and port with Kitura.addHTTPServer(onPort:)
  • Enable HTTPS by passing SSLConfig with certificate and key paths
  • Deploy as a compiled binary behind Nginx or in a Docker container

Key Features

  • Codable routing maps request/response bodies directly to Swift structs
  • Type-safe route parameters reduce runtime errors
  • Middleware pipeline supports CORS, helmet-style security headers, and sessions
  • Built-in support for OpenAPI spec generation from route definitions
  • Compatible with the broader Swift on Server ecosystem (SwiftNIO, Swift-Log)

Comparison with Similar Tools

  • Vapor — the most popular Swift server framework; Kitura offers Codable routing as a differentiator
  • Perfect — another early Swift server framework; Kitura has stronger middleware composition
  • Hummingbird — lightweight Swift server; Kitura provides more built-in features
  • Express (Node.js) — similar middleware model; Kitura uses Swift's type system for safety
  • Actix Web (Rust) — compile-time safety like Swift; Kitura is easier to pick up for iOS developers

FAQ

Q: Is Kitura still maintained? A: IBM transferred Kitura to the community. It receives maintenance updates but active feature development has slowed.

Q: Can I share code between an iOS app and a Kitura backend? A: Yes. Shared Swift packages work across iOS and server targets, which is a key advantage of server-side Swift.

Q: Does Kitura support WebSockets? A: Yes. The Kitura-WebSocket package provides WebSocket server support.

Q: How does performance compare to Vapor? A: Both are comparable for typical API workloads. Vapor has moved to SwiftNIO while Kitura uses its own I/O layer.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires