{"id":49026944,"url":"https://github.com/kreuzberg-dev/alef","last_synced_at":"2026-06-17T07:01:23.311Z","repository":{"id":350654475,"uuid":"1197540366","full_name":"kreuzberg-dev/alef","owner":"kreuzberg-dev","description":"Generate fully-typed, lint-clean language bindings for Rust libraries across 16 languages","archived":false,"fork":false,"pushed_at":"2026-06-12T12:47:34.000Z","size":46874,"stargazers_count":68,"open_issues_count":11,"forks_count":10,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-12T13:26:10.072Z","etag":null,"topics":["bindgen","c","c-ffi","code-generation","csharp","elixir","ffi","golang","java","language-bindings","napi-rs","php","polyglot","pyo3","python","r","ruby","rust","typescript","wasm"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kreuzberg-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-31T17:01:28.000Z","updated_at":"2026-06-12T12:47:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"b87613eb-4c6a-4602-891b-65900643e1cd","html_url":"https://github.com/kreuzberg-dev/alef","commit_stats":null,"previous_names":["kreuzberg-dev/alef"],"tags_count":477,"template":false,"template_full_name":null,"purl":"pkg:github/kreuzberg-dev/alef","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kreuzberg-dev%2Falef","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kreuzberg-dev%2Falef/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kreuzberg-dev%2Falef/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kreuzberg-dev%2Falef/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kreuzberg-dev","download_url":"https://codeload.github.com/kreuzberg-dev/alef/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kreuzberg-dev%2Falef/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34437451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-17T02:00:05.408Z","response_time":127,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bindgen","c","c-ffi","code-generation","csharp","elixir","ffi","golang","java","language-bindings","napi-rs","php","polyglot","pyo3","python","r","ruby","rust","typescript","wasm"],"created_at":"2026-04-19T07:10:21.134Z","updated_at":"2026-06-17T07:01:23.298Z","avatar_url":"https://github.com/kreuzberg-dev.png","language":"Rust","funding_links":[],"categories":["c"],"sub_categories":[],"readme":"# Alef\n\n\u003cdiv align=\"center\" style=\"display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 20px 0;\"\u003e\n  \u003ca href=\"https://crates.io/crates/alef\"\u003e\n    \u003cimg src=\"https://img.shields.io/crates/v/alef?label=Crates.io\u0026color=007ec6\" alt=\"Crates.io\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://docs.rs/alef\"\u003e\n    \u003cimg src=\"https://img.shields.io/docsrs/alef?label=docs.rs\u0026color=007ec6\" alt=\"docs.rs\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/kreuzberg-dev/alef/actions/workflows/ci.yml\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/actions/workflow/status/kreuzberg-dev/alef/ci.yml?branch=main\u0026label=CI\u0026color=007ec6\" alt=\"CI\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/kreuzberg-dev/alef/blob/main/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/License-MIT-007ec6\" alt=\"License\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.rust-lang.org\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Rust-1.85%2B-007ec6?logo=rust\u0026logoColor=white\" alt=\"Rust 1.85+\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"#supported-targets\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/Targets-18-007ec6\" alt=\"18 targets\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\" style=\"margin: 28px 0 18px;\"\u003e\n  \u003cdiv style=\"font-size: 72px; line-height: 1;\"\u003eא\u003c/div\u003e\n  \u003cstrong\u003eRust in. Native bindings out.\u003c/strong\u003e\n\u003c/div\u003e\n\n\u003cdiv align=\"center\" style=\"display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 24px 0;\"\u003e\n  \u003ca href=\"https://github.com/kreuzberg-dev/alef\"\u003e\n    \u003cimg height=\"22\" src=\"https://img.shields.io/badge/GitHub-kreuzberg--dev%2Falef-007ec6?logo=github\u0026logoColor=white\" alt=\"GitHub\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://discord.gg/xt9WY3GnKR\"\u003e\n    \u003cimg height=\"22\" src=\"https://img.shields.io/badge/Discord-Chat-007ec6?logo=discord\u0026logoColor=white\" alt=\"Discord\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\nAlef is the polyglot binding generator behind Kreuzberg.dev projects. It extracts a Rust API surface\nand emits language-native bindings, package scaffolding, type stubs, README files, API docs, e2e\ntests, and release metadata from one `alef.toml`.\n\n**[Installation](#installation)** | **[Quick Start](#quick-start)** | **[Supported Targets](#supported-targets)** |\n**[CLI Reference](#cli-reference)**\n\n## Key Features\n\n- **One source of truth** - Configure a Rust workspace once and generate every enabled language target from it.\n- **Language-native bindings** - Emit host-language types, docs, errors, async wrappers, callbacks, and package files.\n- **Multi-crate workspaces** - Drive multiple independently published binding packages from a shared workspace config.\n- **End-to-end fixtures** - Generate cross-language test suites and registry-mode test apps from shared JSON fixtures.\n- **Release-aware packaging** - Sync versions, generate registry metadata, build artifacts, and validate publication state.\n- **Configurable pipelines** - Run setup, update, format, lint, test, clean, build, and publish commands per language.\n- **Pluggable extension surface** - Author domain-specific codegen logic via the `Extension` trait; ship as linked binaries, dynamic libraries, or template-only declarations.\n- **Staleness checks** - Cache inputs, embed generation hashes, and verify whether generated files are up to date.\n\n## Installation\n\nAlef requires Rust 1.85 or newer.\n\n```bash\ncargo install alef --locked\n```\n\nIf you use [`cargo-binstall`](https://github.com/cargo-bins/cargo-binstall), Alef also publishes\nbinary-install metadata:\n\n```bash\ncargo binstall alef\n```\n\n## Quick Start\n\nCreate or edit `alef.toml` in your Rust workspace:\n\n```toml\n[workspace]\nlanguages = [\"python\", \"node\", \"ffi\", \"go\"]\nalef_version = \"0.24.12\"\n\n[[crates]]\nname = \"sample_core\"\nsources = [\"src/lib.rs\"]\nversion_from = \"Cargo.toml\"\n```\n\nThen generate the language packages:\n\n```bash\nalef generate --format\nalef scaffold\nalef readme\nalef docs --output docs/reference\nalef verify --exit-code\n```\n\nFor a new project, Alef can create the initial config and first generated files:\n\n```bash\nalef init --lang python,node,ffi\n```\n\nFor the full local generation pass, use:\n\n```bash\nalef all --format\n```\n\nUse `--lang python,node` to restrict commands to selected targets and `--crate \u003cname\u003e` to restrict\ncommands to one configured crate.\n\n## Supported Targets\n\n| Target | Backend / package style |\n| ------ | ----------------------- |\n| Python | PyO3 bindings with Python type stubs |\n| TypeScript / Node.js | NAPI-RS native addon with `.d.ts` output |\n| WebAssembly | wasm-bindgen package for browser and JS runtimes |\n| Ruby | Magnus native extension |\n| PHP | Native PHP extension |\n| Elixir | Rustler NIF package |\n| R | extendr package |\n| Go | cgo package over the generated C FFI layer |\n| Java | JVM package over the generated native library |\n| Kotlin | Kotlin/JVM package over generated native bindings |\n| Kotlin Android | Android package with generated JNI shims |\n| C# | .NET package using P/Invoke |\n| Dart / Flutter | flutter_rust_bridge package |\n| Swift | Swift package with Rust bridge support |\n| Zig | Zig package over the generated C ABI |\n| Gleam | Gleam package backed by Rustler |\n| C FFI | C ABI, header, and shared-library glue |\n| JNI | Rust JNI shim crate exercised by both kotlin_android (Android AAR) and host-JVM tests |\n\nCanonical language slugs are `python`, `node`, `wasm`, `ruby`, `php`, `elixir`, `r`, `go`,\n`java`, `csharp`, `kotlin`, `kotlin_android`, `swift`, `dart`, `gleam`, `zig`, `ffi`, and `jni`.\n\n## Configuration Model\n\nAlef uses the current multi-crate schema:\n\n- `[workspace]` stores shared target languages, tool preferences, and pipeline defaults.\n- `[[crates]]` describes each Rust API surface that should become one or more published packages.\n- `[crates.\u003clanguage\u003e]` sections customize module names, package names, feature flags, output paths,\n  field naming, dependency extras, and language-specific generation behavior.\n- `[[crates.adapters]]`, trait bridge config, service API config, and e2e config opt into higher-level\n  generated wrappers when a target supports them.\n\nGenerated binding files carry Alef hashes and are overwritten by generation commands. Scaffolded\npackage files are generated once unless the command explicitly opts into overwrite behavior; generated\nREADME and API doc files are owned by `alef readme` and `alef docs`.\n\n## Extending Alef\n\nAlef is opinionated about codegen and neutral about domain. The `Extension` trait lets you ship domain-specific generation logic (HTTP service APIs, plugin registries, custom bindings) without bloat in alef.\n\n### Linked Extension\n\nConsumer crate implements `alef::Extension`, ships a thin CLI binary:\n\n```rust\nfn main() {\n    alef::run_with_extensions(vec![Box::new(MyDomainExtension)])\n}\n```\n\nFull type safety. Recommended for frameworks like spikard's HTTP service API.\n\n### Dynamic Extension\n\nLoad a compiled `.so`/`.dylib`/`.dll` declaring a C-ABI factory function. Works when you can't ship a Rust binary.\n\n```rust\nextern \"C\" fn alef_extension_factory() -\u003e Box\u003cdyn alef::Extension\u003e {\n    Box::new(MyExtension)\n}\n```\n\n### Template-only Extension\n\nDeclare `[[extensions.template]]` blocks in `alef.toml` pointing to Jinja templates. Alef's built-in `TemplateExtension` emits them — no Rust required.\n\nFor the full walkthrough, trait reference, and per-language emission patterns, see [Extending Alef](docs/extending.md).\n\n## CLI Reference\n\n| Command | Purpose |\n| ------- | ------- |\n| `alef init` | Create `alef.toml`, generate initial bindings, and scaffold package files. |\n| `alef extract` | Extract Rust source into Alef IR JSON. |\n| `alef generate` | Generate bindings, service API wrappers, public API wrappers, and type stubs. |\n| `alef stubs` | Generate type stubs only. |\n| `alef scaffold` | Generate package manifests, native build files, and package scaffolding. |\n| `alef readme` | Generate per-language README files. |\n| `alef docs` | Generate Markdown API reference pages. |\n| `alef setup` | Install per-language development dependencies. |\n| `alef fmt` / `alef lint` | Run configured formatters, linters, and type checks. |\n| `alef test` | Run configured unit, integration, e2e, or coverage test commands. |\n| `alef build` | Build language bindings using native tools. |\n| `alef verify` | Check generated files and optional compile/lint state for CI. |\n| `alef diff` | Show what generation would change without writing files. |\n| `alef e2e` | Initialize, scaffold, validate, list, or generate local e2e suites. |\n| `alef test-apps` | Generate and run standalone registry-mode test applications. |\n| `alef publish` | Prepare, build, package, and validate release artifacts. |\n| `alef all` | Run the full generation workflow in one command. |\n\nRun `alef --help` or `alef \u003ccommand\u003e --help` for the full option set.\n\n## Development\n\nThis repository uses `task` for common workflows:\n\n```bash\ntask setup\ntask build\ntask test\ntask lint\n```\n\nThe most useful targeted commands while working on Alef itself are:\n\n```bash\ncargo test \u003cmodule_or_test_name\u003e\ncargo insta review\nprek run --all-files\n```\n\n## Part of Kreuzberg.dev\n\n- [Kreuzberg](https://github.com/kreuzberg-dev/kreuzberg) - document intelligence for text,\n  tables, metadata, OCR, and code intelligence.\n- [Kreuzberg Cloud](https://github.com/kreuzberg-dev/kreuzberg-cloud) - managed extraction API\n  with SDKs, dashboards, and observability.\n- [kreuzcrawl](https://github.com/kreuzberg-dev/kreuzcrawl) - web crawling and scraping with\n  HTML-to-Markdown and headless Chrome fallback.\n- [html-to-markdown](https://github.com/kreuzberg-dev/html-to-markdown) - fast, lossless\n  HTML-to-Markdown conversion.\n- [liter-llm](https://github.com/kreuzberg-dev/liter-llm) - universal LLM API client with native\n  bindings.\n- [tree-sitter-language-pack](https://github.com/kreuzberg-dev/tree-sitter-language-pack) -\n  tree-sitter grammars and code-intelligence primitives.\n- [Discord](https://discord.gg/xt9WY3GnKR) - community, roadmap, and release discussion.\n\n## License\n\nMIT - see [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkreuzberg-dev%2Falef","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkreuzberg-dev%2Falef","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkreuzberg-dev%2Falef/lists"}