A Swift helper for LiveKit Server APIs in Vapor.

This is not a Server SDK. LiveKit has a variety of Server SDKs.


Add LiveKitVapor to your Vapor Package.swift. It should look like this:

// swift-tools-version:5.5
import PackageDescription

let package = Package(
    name: "my-app",
    dependencies: [
         // Other dependencies...
        .package(url: "", from: "0.0.4")
    targets: [
        .target(name: "App", dependencies: [
            // Other dependencies...
            .product(name: "LiveKitVapor", package: "LiveKitVapor")
        // Other targets...


LiveKitVapor requires a working instance of LiveKit.



On your code:

import LiveKitVapor

# returns 'token'
let videoGrant = VideoGrant(
            roomName: "myRoom",
            canCreateRoom: true,
            canListRooms: true,
            canJoinRoom: true,
            isRoomAdmin: true
let token = try LiveKit.shared.generateToken(videoGrant: videoGrant)
return token

// Use your own api-key and api-secret
// in your configure
public func configure(_ app: Application) throws {
    // Other Configurations
    LiveKit.shared.apiKey = "myOtherDevKey"
    LiveKit.shared.secret = "my-256-bit-secret"

LiveKit Server APIs. For more information refer to the APIs docs.

LiveKit Server APIs (twirp) LiveKitVapor
CreateRoom createRoom
ListRooms getAllRoom
DeleteRoom deleteRoom
ListParticipants getAllParticipants
GetParticipant getParticipant
RemoveParticipant removeParticipant
MutePublishedTrack muteTrack
UpdateParticipant updateParticipant
UpdateSubscriptions updateSubscriptions
UpdateRoomMetadata updateRoomMetadata
SendData sendData


Before running tests, run:


and then:

liveKit-cli join-room \
     --room TestRoom \
     --identity CLITestUser \
     --api-key devkey \
     --api-secret secret \

Test not implemented:

  • sendData
  • updateSubscriptions
  • removeParticipant

Test with an issue:

  • muteParticipant

To Do

  • Make codable structs mirror those of LiveKit swift client sdk.
  • Enums for track type and quality.
  • Test LiveKitVapor on Linux.
  • Something else.


Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.


Run wild. Do as you wish.


View Github