
How Does Server Side Swift Workout in the Real World?
In 2018, I attended the try! Swift conference in New York, where I participated in a workshop titled "Build a Cloud Native Swift App."

At the time, Swift was primarily known as an iOS development language, so the concept of using it for cloud applications seemed unusual. This workshop introduced me to Kitura, but it was when I discovered Vapor that everything clicked - I found it was fast, simple, and leveraged all of Swift's advantages.
The Birth of Heartwitch
As a Nintendo Switch enthusiast who enjoys working out while gaming, I noticed something interesting in the speedrunning community - streamers often display their heart rate during runs.
This observation sparked an idea: what if we could create a system to livestream heart rate data in real-time?
The initial implementation was straightforward:
- Collect heart rate data through HealthKit
- Send data to a Vapor server via POST requests
- Transmit data to browsers through WebSockets
- Display the heart rate overlay using OBS for streaming
I named this project Heartwitch (a name I'd later reconsider), allowing streamers to share their heart rate data during gaming sessions.
The Pandemic Pivot
In early 2020, the pandemic transformed how people approach fitness. As gyms closed and home workouts became the norm, I received an interesting email from Chris, who saw potential in adapting Heartwitch's technology for fitness instruction. The idea was compelling: help instructors monitor students' heart rates during remote classes, or allow instructors to share their own metrics while teaching.
Enter gBeat
This pivot led to the creation of gBeat, a comprehensive fitness streaming platform. The core functionality includes:
- Real-time heart rate monitoring
- Instructor-student connectivity
- Automated workout session management
- Cross-platform compatibility
- Integration with various fitness platforms
Why Server-Side Swift?
Choosing Swift for both client and server offered several advantages:
- Code Sharing: Common models, networking code, and business logic can be shared between iOS, watchOS, and server components
- Type Safety: End-to-end type safety across the entire stack
- Familiar Tooling: Using Xcode and Swift Package Manager throughout the project
- Performance: Swift's strong performance characteristics on both client and server
- Apple Ecosystem Integration: Seamless integration with HealthKit, Push Notifications, and Sign in with Apple
Architecture Overview
gBeat's architecture consists of several key components:
The server handles:
- Authentication and session management
- Real-time data streaming via WebSockets
- Push notification distribution
- Workout session coordination
The client side manages:
- HealthKit integration
- Local workout tracking
- UI/UX implementation
- Real-time data synchronization
Looking Forward
The journey from a simple gaming stream overlay to a full-featured fitness platform shows how Server-Side Swift can scale from hobby projects to production applications. In the next post, we'll dive deeper into the technical implementation of authentication using sign in with apple and development challenges.