Sign inSign up

3squaredcircles/pactum

By 3squaredcircles

•Updated 6 months ago

Automates the generation of type-safe, native API client layers for mobile applications.

Image
Languages & frameworks
Developer tools
0

1.0K

3squaredcircles/pactum repository overview

Visit https://docs.3squaredcircles.com⁠ for a deep dive into configuration.

Feedback welcomed at https://www.linkedin.com/company/3-squared-circles/⁠

The Self-Writing API Client for Mobile.

3SC Pactum is a CI/CD-native tool that automates the generation of type-safe, native API client layers for mobile applications (iOS and Android). It performs a deep static analysis of your backend source code (e.g., .NET, Java, Go) to discover data transfer objects (DTOs) and generates corresponding native models (e.g., Swift structs, Kotlin data classes) and the boilerplate code required to serialize them.

Pactum eliminates one of the most tedious, error-prone, and time-consuming tasks in mobile development: manually writing and maintaining API client code that perfectly mirrors the backend.

⁠A Note on the Name

Pactum is the Latin word for "agreement," "contract," or "pact." This name was chosen because the tool transforms the implicit, trust-based understanding between backend and mobile teams into an explicit, verifiable, and machine-enforced contract. It ensures both sides adhere to the same data agreement.


⁠For the Manager & Mobile Lead

As a leader responsible for delivering high-quality mobile applications on schedule, you need to minimize friction between your backend and mobile teams. Data contract mismatches are a common source of bugs, delays, and wasted developer hours. Pactum automates and governs this entire synchronization process.

Pactum answers your critical questions:

  • "How can we stop wasting developer time on manually writing and updating boilerplate API client code?"
  • "How do we prevent the endless cycle of 'the API response changed' bugs that break our mobile apps?"
  • "How can we ensure our iOS and Android apps are always perfectly in sync with the latest backend API changes?"
  • "How do we accelerate the process of building new mobile features that depend on new backend APIs?"
⁠Key Business Values:
  • Eliminate a Whole Category of Bugs: By automatically generating the data models from the backend source, Pactum eradicates data parsing errors, decodingError.dataCorrupted crashes, and other common issues caused by manual data contract drift.
  • Increase Developer Velocity: Frees up senior mobile and backend developers from the tedious, low-value work of writing and maintaining API client layers, allowing them to focus on building features.
  • Govern the Mobile Contract: The interactive UI provides a central "Governance Hub" for architects and leads to define exactly which backend types are exposed to mobile and how they are mapped.
  • Improve Cross-Team Collaboration: The pactum/config.json file becomes the version-controlled source of truth for the mobile data contract. Mobile developers simply git pull to receive the latest, type-safe client, eliminating miscommunications.

⁠For the Architect, Mobile & Backend Engineer

Pactum creates a seamless, "define in UI, run in CI" workflow that separates the concerns of backend development, architectural governance, and mobile development.

⁠The Workflow
  1. Backend Development (No Changes): Backend developers continue to build their services and DTOs as they normally would.
  2. Architectural Governance (Interactive UI): An architect or mobile lead runs Pactum in interactive mode. This launches a local web UI—the Governance Hub.
    • Discover: The user points the UI at a backend project. Pactum analyzes the source and displays all discoverable classes.
    • Define Scope: The user selects which classes and enums are part of the mobile data contract.
    • Configure Mappings: The user defines global type mappings (e.g., System.DateTime -> Date) and can override names and types for specific properties.
    • Save & Commit: The user saves this configuration, which generates a pactum/config.json file, and commits it.
  3. CI Automation (execute mode): The CI/CD pipeline runs Pactum's execute command, which reads the config file, regenerates the native Swift and Kotlin client code, and commits it back to the repository.
  4. Mobile Development: Mobile developers git pull to receive the latest, type-safe API client layer.

⁠For the Platform Engineer (DevOps, SRE)

As an operator, you require tools that are secure, automatable, and consistent. Pactum is a containerized, self-hosted application designed for safe and seamless integration into any CI/CD pipeline.

⁠Execution Modes:
  • execute The primary CI mode. It reads a checked-in pactum/config.json file, generates the native mobile client files, and commits them back to the repository.
  • interactive: Starts the local web-based "Governance Hub" UI used to create and manage the pactum/config.json file.
  • serve-docs: Starts a lightweight server to display embedded tool documentation.

Verifying Image Signatures All published images are signed with Cosign. To verify:

Install cosign: https://docs.sigstore.dev/cosign/system_config/installation/⁠ Download our public key: curl -O https://www.3squaredsquaredcircles.com/keys/3squaredcircles.pub⁠ Verify: cosign verify --key 3squaredcircles.pub 3squaredcircles/pactum:latest

Tag summary

Content type

Image

Digest

sha256:cd2555e7c…

Size

348.5 MB

Last updated

6 months ago

docker pull 3squaredcircles/pactum