Skip to content
CAI
Software that uses CAICheck a score

E-xyza/zigler

69.1

Adequate · 23 October 2026

7.7k

lines of production code

Elixir

with Zig

7

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Zigler is an Elixir and Erlang library that enables the creation of Native Implemented Functions (NIFs) using the Zig programming language. It provides a comprehensive toolchain for compiling Zig code into BEAM-compatible binaries, handling complex tasks such as type marshalling, memory management, and concurrency models like dirty CPU/IO and threaded execution. The system supports seamless interoperability between Zig and the BEAM, including C interop, resource management, and lifecycle callbacks, while automating the Zig compiler installation and build process.

How it got here

2019 — Initial project setup and architecture

7 changes.

This period established the foundational configuration, documentation, and tooling for the Zigler project, including static analysis and formatting standards. It introduced the core Zig module interface and refactored the Erlang integration by separating compilation logic into dedicated modules. The work also removed legacy NIF adapter templates and expanded test coverage to validate the new configuration and integration systems.

2020–2023 — Zig NIF integration architecture

9 changes.

This period established the core architecture for integrating Zig with the Erlang/BEAM platform, introducing a comprehensive NIF layer with custom memory management and type marshaling. It defined the library's module structure, concurrency models, and code generation templates to facilitate seamless Elixir-to-Zig interoperability. The work also included building the Zig compiler installer and extensive test suites to validate compilation, error handling, and integration scenarios.

2024–2025 — comprehensive test coverage expansion

10 changes.

This period focused on significantly expanding the test suite to cover core Zigler functionalities, including the type system, concurrency, C interop, and resource management. The work involved adding extensive integration and unit tests for NIFs, allocators, and edge-case configurations to ensure robust compiler behavior and memory safety.

Features

Initial project configuration and documentation setup

The repository now includes essential configuration files to standardize development and deployment. A \.credo.exs\ file is added to configure the Credo static analysis tool with specific checks for consistency, design, readability, and warnings. Code formatting is standardized via a new \.formatter.exs\ that includes inputs for Elixir and Zig files and registers the \Zig.Formatter\ and \MarkdownFormatter\ plugins. Tool versions for Erlang, Elixir, and Zig are explicitly defined in \.tool-versions\. The project license is established in \LICENSE\, and \VERSIONS.md\ provides a detailed history of Zig and Zigler version compatibility. Additionally, \.gitignore\ is updated to exclude build artifacts, Zig downloads, and test-specific files, while \README.md\ is expanded with comprehensive installation instructions for Elixir and Erlang, platform support details, and code examples for NIFs, type marshalling, memory allocation, and C library integration.

(repo-wide) · high confidence

Introduces BEAM integration layer with Zig-based NIF helpers

Adds a new \priv/beam\ directory containing a Zig implementation for interfacing with the Erlang/BEAM NIF API. This includes a custom memory allocator (\allocator.zig\) that wraps \enif\_alloc\/\enif\_free\ to support Zig's memory management, a comprehensive type marshaling system (\get.zig\, \make.zig\) for converting between Zig types and BEAM terms (integers, enums, structs, maps, etc.), and BEAM-specific I/O handling (\io.zig\) that adapts the standard library to respect BEAM's time and threading models. The module also provides utilities for binary handling, cleanup, and mutex synchronization, effectively creating a new idiomatic Zig layer for writing NIFs.

priv/beam · high confidence

Introduces Zigler library architecture and build system

This change establishes the core library structure for Zigler, introducing the \Zig.Module\, \Zig.Nif\, \Zig.C\, and \Zig.Builder\ modules that handle option normalization, semantic analysis, and Zig build file generation. It adds Mix tasks for precompiling Zig modules across multiple platforms and retrieving the Zig version, along with supporting modules for error resolution, command execution, and attribute handling to enable seamless Elixir-to-Zig NIF integration.

lib/zig · high confidence

Introduction of Zig module and refactoring of Erlang integration

The library now includes a new \Zig\ module, providing a dedicated interface for Elixir users to define inline NIFs using the \use Zig\ macro and \sigil\_Z\. Concurrently, the existing Erlang integration has been refactored: the \Zigler\ module has been renamed to \:zigler\ to function as an Erlang parse transform, and its implementation now delegates core compilation logic to the new \Zig.Compiler\ and \Zig.EasyC\ modules, separating the Erlang-specific AST transformation from the underlying Zig compilation process.

lib · high confidence

New Zig NIF templates for basic, threaded, and build logic

The library now ships a comprehensive set of new EEx templates in lib/zig/templates that generate the Zig source code for NIFs. These templates include basic and threaded execution paths (basic.zig.eex, threaded.zig.eex) with support for custom allocators and memory leak detection, build system scaffolding (build.zig.zon.eex, build\_mod.zig.eex, build\_c.zig.eex, build\_extra\_mod.zig.eex), and lifecycle callback handlers (on\_load.zig.eex, on\_upgrade.zig.eex, on\_unload.zig.eex). Additional templates handle resource management (resources.zig.eex), module entry points (module.zig.eex), and raw term wrappers (raw\_beam\_term.zig.eex, raw\_erl\_nif\_term.zig.eex), providing the foundational code generation for the Zig NIF runtime.

lib/zig/templates · high confidence

New Zig type system for Elixir and Erlang interoperability

This change introduces a comprehensive type system in \lib/zig/type\ to handle Zig types during compilation and marshalling. It adds modules for core types including integers, floats, booleans, arrays, slices, pointers, cpointers, manypointers, structs, enums, tuples, errors, optionals, and resources. These modules implement logic to render Zig type representations, generate Elixir and Erlang type specs, and define marshalling rules for parameters and return values, enabling the library to correctly interpret and pass data between Zig and the BEAM.

lib/zig/type · high confidence

New \`mix zig.get\` installer command for the Zig compiler toolchain

The installer package now includes a new \mix zig.get\ Mix task that automatically downloads and extracts the Zig compiler toolchain. This command detects the operating system and architecture, defaults to version 0.16.0, and supports options to specify a custom version, local file source, or override OS/architecture settings. It includes hash verification for downloaded archives and respects the \ZIG\_ARCHIVE\_PATH\ environment variable for custom installation locations.

installer · high confidence

Removals

Removed local Erlang NIF header file

The local copy of the Erlang NIF header file (erl\_nif.h) has been removed from the priv/include directory. This file previously defined types, structures, and function prototypes for the NIF interface; its removal suggests the project now relies on the system or Erlang/OTP provided headers instead of maintaining a local duplicate.

priv/include · high confidence

Architecture

Refactor Zig code generation into the 'code' module

The monolithic \Zigler.Compiler\ and \Zigler.Zig\ modules have been removed and their responsibilities moved to a new \code\ module. This change restructures how Zig NIF code is generated, parsed, and assembled, separating the compilation logic from the code generation utilities to improve maintainability and clarity of the build process.

lib/zigler · high confidence

Behavioural changes

New concurrency and marshalling infrastructure for Zig NIFs

The library introduces a structured concurrency model and refined marshalling logic for Zig NIFs. Users can now define NIFs with specific execution contexts—\dirty\_cpu\, \dirty\_io\, \synchronous\, and \threaded\—which are handled by new dedicated modules (\Zig.Nif.DirtyCpu\, \Zig.Nif.DirtyIo\, \Zig.Nif.Synchronous\, \Zig.Nif.Threaded\) implementing the \Zig.Nif.Concurrency\ behaviour. The \Zig.Nif.Basic\ module now manages parameter and return marshalling, specifically handling large integers (\>64 bits) and error types, while the \Threaded\ implementation generates code that launches NIFs asynchronously and waits for results via message passing.

lib/zig/nif · high confidence

Removal of legacy NIF adapter templates

The EEx template files used to generate NIF adapters, exports, headers, and footers have been removed from the assets directory. This eliminates the previous code-generation mechanism for Erlang NIF bindings, indicating a shift to a different approach for handling NIF integration.

assets · high confidence

Test coverage

Added C interop test suite for Zigler; Added comprehensive type system tests; Added concurrency and sigil integration tests; Added integration tests for Erlang NIFs; Added integration tests for Zig resource management; Added precompiled Zig module for testing; Added test suite for custom build flags and C integration; Added test support utilities for compiling, integration, and documentation verification; Added tests for compiler error scenarios; Added tests for corner-case Zigler configurations and build behaviors; Added tests for on\_load, on\_unload, and on\_upgrade callback signatures; Added tests for raw NIF arity, parameter validation, and typespec generation; Added tests for the beam allocator integration; Expanded test coverage for Zigler module and NIF options.

Dependencies

Zigler v0.16.0 release with Zig 0.16.0 support and dependency updates

This release updates the Zigler library to version 0.16.0, raising the minimum Elixir requirement to 1.15 and introducing support for the Zig 0.16.0 toolchain via the new \zig\_version\ configuration. The project now bundles the \zig\_get\ installer (v0.16.0) to handle automatic Zig compiler downloads, and updates core dependencies including \zig\_parser\ (v0.7.0), \protoss\ (v1.0), and \zig\_doc\ (v0.7.0). The lockfiles reflect these changes, pinning \ex\_doc\ to 0.39.1 and \jason\ to 1.4.5.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 67 → 69 (+2.4)

Lenses

  • Code Health 98 → 98 (+0.1)
  • Architecture 100 → 100 (+0.0)
  • Maturity 53 → 60 (+6.4)
  • Readiness 58 → 58 (-0.4)
  • Security 99 → 99 (+0.0)

Resolved (3)

  • Documentation: no architecture or design documentation (README.md)
  • Orphaned files with no living knowledge
  • Workflow token permissions not restricted

New (7)

  • Documentation: no contributor guidance (README.md)
  • Documentation: no installation or build instructions (README.md)
  • Floating source dependency: translate_c
  • Workflow token permissions not restricted (.github/workflows/freebsd.yml)
  • Workflow token permissions not restricted (.github/workflows/linux.yml)
  • Workflow token permissions not restricted (.github/workflows/macos.yml)
  • Workflow token permissions not restricted (.github/workflows/windows.yml)

Changes since last survey

  • 1 commits — 1 feature/other, 0 fixes

By area

  • priv/beam — 1 commit

Notable commits

  • change: Zig 0.17.0 support (#597)

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

E-xyza/zigler was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 23 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit feb80162d597ede227e9d4d5c9798a42beee9695 — the exact code this score is about.
  • Scored under rubric-2026.10.5 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer measure-2026.10.6+preprod-d36780c2d857.