What Programming Languages Are Used in BitChat? A Complete Technical Breakdown
BitChat is built primarily with Swift for its macOS/iOS application, core libraries, and test suite, supplemented by Python and Shell scripts for CI tooling and data processing.
The permissionlesstech/bitchat repository implements a permissionless messaging protocol targeting Apple's ecosystem. Analyzing the source code reveals a language architecture where Swift drives all production functionality—including the UI, networking stack, and cryptography—while Python and Shell (Bash) handle automation, continuous integration, and performance validation tasks.
Swift: The Core Production Language
Swift dominates the BitChat codebase, powering every aspect of the end-user application from the SwiftUI interface to cryptographic identity management. The entire production source tree, unit tests, and package definitions utilize Swift exclusively.
Application Bootstrap and SwiftUI Entry Point
The application's entry point resides in bitchat/BitchatApp.swift, which initializes the SwiftUI scene structure. This file demonstrates the modern Swift app lifecycle using the @main attribute:
// bitchat/BitchatApp.swift
import SwiftUI
@main
struct BitchatApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
The Package.swift manifest at the repository root further confirms Swift as the primary language, declaring the Swift Package Manager structure and all native dependencies.
Cryptographic Identity Management
Core security logic is implemented in Swift, as seen in bitchat/Identity/SecureIdentityStateManager.swift. This file manages SecureIdentityStateManager, handling cryptographic key generation and identity persistence using native Apple security frameworks.
Unit Testing Infrastructure
The testing suite maintains Swift exclusivity. The file bitchatTests/ChatViewModelTests.swift provides a representative example of the comprehensive Swift unit tests validating the chat view model logic. All test targets compile as Swift code alongside the main application.
Auxiliary Languages: Python and Shell
While the runtime application is pure Swift, the repository includes automation scripts written in Python and Shell for development operations and continuous integration pipelines.
Python for CI Workflow Testing
Python handles specialized testing workflows, particularly for validating relay discovery and geographic distribution logic. The file scripts/tests/test_fetch_georelays_workflow.py implements a test runner using the standard unittest framework:
# scripts/tests/test_fetch_georelays_workflow.py
import subprocess
import unittest
class TestFetchGeorelaysWorkflow(unittest.TestCase):
def test_workflow(self):
subprocess.run(
['python3', '-m', 'unittest', 'discover', '-s', 'scripts/tests', '-p', 'test_*.py', '-v'],
check=True
)
These scripts execute during CI to verify that relay fetching mechanisms function correctly across different network conditions.
Shell Scripts for Performance Validation
Bash scripts manage performance regression gating and build automation. The scripts/check-perf-floors.sh script validates that performance metrics remain above defined thresholds:
# scripts/check-perf-floors.sh
#!/usr/bin/env bash
# Usage: scripts/check-perf-floors.sh <test-output-file> [floors-file]
OUTPUT="$1"
FLOORS="${2:-floors.txt}"
# …implementation omitted for brevity…
This script parses test output files and compares results against baseline floors, failing the build if performance degrades below acceptable levels.
Summary
- Swift constitutes 100% of the production application code, UI layer, cryptographic libraries, and unit tests in the permissionlesstech/bitchat repository.
- Python provides targeted CI workflow testing, specifically for relay network validation in
scripts/tests/. - Shell (Bash) automates performance regression checks and build pipeline tasks via scripts like
scripts/check-perf-floors.sh. - No other programming languages—such as Objective-C, C++, or Rust—appear in the source tree.
Frequently Asked Questions
Is BitChat written entirely in Swift?
The end-user application and all associated libraries are written exclusively in Swift. However, the repository includes Python and Shell scripts for development tooling and CI automation. These auxiliary languages do not ship with the application but support the build and test infrastructure.
Why does BitChat use Python scripts?
BitChat uses Python specifically for continuous integration workflows, such as testing relay fetching mechanisms. The test_fetch_georelays_workflow.py script leverages Python's subprocess capabilities to orchestrate complex test scenarios that validate the network layer's geographic distribution logic independently of the Swift runtime.
What is the purpose of the Shell scripts in BitChat?
Shell scripts handle performance regression gating and build automation. The check-perf-floors.sh script parses test output to ensure performance metrics remain above defined thresholds, preventing code that degrades application speed from merging into the main branch.
Does BitChat contain any Objective-C or C++ code?
According to the source code analysis, BitChat contains no Objective-C or C++ files. The implementation relies purely on Swift for native performance, with Python and Shell reserved exclusively for auxiliary tooling scripts.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →