Skip to main content

Build powerful church apps with CongregationKit

A Swift SDK designed for The King’s Temple Church that provides type-safe access to Salesforce church data with async/await support for macOS and iOS.

Quick start

Get up and running with CongregationKit in minutes

1

Add CongregationKit to your project

Add the package to your Package.swift dependencies:
Package.swift
dependencies: [
    .package(url: "https://github.com/tktchurch/CongregationKit.git", from: "1.0.0")
]
Or in Xcode: File → Add Package Dependencies and enter the repository URL.
2

Set up your Salesforce credentials

Create a SalesforceCredentials instance with your Salesforce OAuth credentials:
import CongregationKit

let credentials = SalesforceCredentials(
    clientId: "your_client_id",
    clientSecret: "your_client_secret",
    username: "your_salesforce_username",
    password: "your_salesforce_password"
)
You’ll need to obtain these credentials from your Salesforce connected app configuration.
3

Initialize the CongregationKit client

Create an HTTP client and initialize CongregationKit:
import AsyncHTTPClient

let httpClient = HTTPClient.shared
let congregation = try await CongregationKit(
    httpClient: httpClient,
    credentials: credentials
)
The client will automatically authenticate with Salesforce during initialization.
4

Fetch member data

Use field expansion to fetch only the data you need:
let response = try await congregation.members.fetchAll(
    expanded: [
        .contactInformation,
        .employmentInformation,
        .discipleshipInformation
    ]
)

for member in response.members {
    print(member.memberName)
    print(member.contactInformation?.email)
    print(member.discipleshipInformation?.waterBaptism?.date)
}
The Member struct contains all requested expanded fields. Unexpanded fields will be nil:
Member(
    id: "a001234567890abc",
    memberId: MemberID("TKT123456"),
    firstName: "John",
    lastName: "Doe",
    contactInformation: ContactInformation(
        email: "[email protected]",
        phoneNumber: "+1234567890"
    ),
    discipleshipInformation: DiscipleshipInformation(
        waterBaptism: WaterBaptism(received: true, date: "2023-01-15")
    )
)

Explore the SDK

Discover what you can build with CongregationKit

Member management

Fetch, filter, and manage church member data with type-safe field expansion

Family relationships

Track family structures, relationships, and suggested connections

Seeker tracking

Manage visitors and new attendees in your congregation

File operations

Download files and content from Salesforce records

Authentication

Secure Salesforce OAuth authentication with async/await

Error handling

Handle errors gracefully with type-safe error types

Why CongregationKit?

Built specifically for church management with Swift best practices

Type-safe

Strongly-typed Swift models with compile-time safety and validation

Modern Swift

Built with async/await, Swift 6.0+, and follows Swift concurrency best practices

Field expansion

Fetch only the data you need with granular field expansion for optimal performance

Server-ready

Works seamlessly with Vapor and Hummingbird server frameworks

Resources

Learn more about CongregationKit and get support

GitHub

View source code and contribute

Swift Package Index

Package documentation and versions

Report an issue

Found a bug? Let us know

Ready to get started?

Follow our quickstart guide to integrate CongregationKit into your Swift app in minutes

View Quickstart Guide

Build docs developers (and LLMs) love