A modern, type-safe Swift client for Kurrent (formerly EventStoreDB)
Built with ❤️ for Server-Side Swift and Event Sourcing
Event Sourcing is a powerful pattern for building scalable, auditable systems. KurrentDB-Swift brings this capability to the Swift ecosystem with a modern, type-safe client.
- 🎯 Native Swift - Designed for Swift from the ground up, not a wrapper
- ⚡ Modern Concurrency - Full async/await support with Swift 6 compatibility
- 🔒 Type-Safe - Leverages Swift's type system for compile-time safety
- 🚀 Production-Ready - Over 1 year of development, 425+ commits, 46 releases
- 📖 Well-Documented - Comprehensive guides on Swift Package Index
- 🔧 Actively Maintained - Regular updates and responsive to issues
Add to your Package.swift:
dependencies: [
.package(url: "https://github.com/gradyzhuo/KurrentDB-Swift.git", from: "1.11.2")
]import KurrentDB
// 1. Connect to Kurrent
let client = KurrentDBClient(settings: .localhost())
// 2. Create an event
let event = EventData(
eventType: "OrderPlaced",
model: ["orderId": "order-123", "total": 99.99] // or any Codable instance.
)
// 3. Append to stream
try await client.appendStream("orders", events: [event]) {
$0.revision(expected: .any)
}
// 4. Read events back
let events = try await client.readStream("orders") {
$0.backward().startFrom(revision: .start)
}
for try await response in events {
if let event = try response.event {
print("Event: \(event.eventType)")
}
}That's it! You're now using Event Sourcing in Swift. 🎉
Check out our comprehensive documentation on Swift Package Index:
- 📘 Getting Started Guide
- ✍️ Appending Events
- 📖 Reading Events
- 🔄 Working with Projections
- 📚 Full API Reference
- ✅ Stream operations (append, read, delete)
- ✅ Subscriptions (catch-up and persistent)
- ✅ Projections management
- ✅ Optimistic concurrency control
- ✅ TLS/SSL support
- ✅ Cluster configuration
- ✅ Connection management with auto-reconnection
- ✅ Swift 6 ready (zero data-race safety)
- Swift 6.0 or later
- macOS 15+ / iOS 18+ / Linux
- Kurrent 24.2+ (or EventStoreDB 23.10+)
We'd love to hear about your experience! Share your story in Discussions or add your project to our showcase.
Contributions are welcome! Whether it's:
- 🐛 Bug reports
- 💡 Feature requests
- 📖 Documentation improvements
- 🔧 Code contributions
Check out our Contributing Guide to get started.
- 💭 GitHub Discussions - Ask questions, share ideas
- 🐛 Issues - Report bugs
- 🐦 Dev.to - Follow for updates
MIT License - see LICENSE for details.
Built with these excellent libraries:
- grpc-swift - Swift gRPC implementation
- swift-nio - Non-blocking I/O
Inspired by official Kurrent/EventStoreDB clients.
⭐ If you find KurrentDB-Swift useful, please consider giving it a star! ⭐
Made with ❤️ by Grady Zhuo and contributors