For compile time code generation, the strongest matches are dotnet/roslyn (Roslyn provides the core compiler infrastructure for), hey-api/openapi-ts (This tool automates the creation of type-safe TypeScript SDKs) and astahmer/openapi-zod-client (This tool automates the generation of type-safe TypeScript clients). apple/swift-openapi-generator and sqlc-dev/sqlc round out the shortlist. Each is ranked by relevance to your query, popularity and recent activity.
Explore the best compile-time code generation tools for your project. Compare top-rated libraries by activity and features to find the best fit.
The .NET Compiler Platform is a collection of open-source APIs for C# and Visual Basic that provides deep code analysis, refactoring, and automated source code generation. It serves as the core infrastructure for building development tools, offering a platform to inspect, modify, and understand source code through immutable syntax trees and semantic models. The platform distinguishes itself by providing full-fidelity syntax trees that preserve every character of source code, including whitespace and comments, alongside an incremental compilation pipeline that enables near-instant feedback dur
Roslyn provides the core compiler infrastructure for .NET, including the Source Generators API which allows for type-safe, incremental code generation directly within the build process using full-fidelity syntax trees.
openapi-ts is a tool and orchestrator used to convert OpenAPI specifications into type-safe TypeScript SDKs and HTTP client implementations. It automatically generates typed interfaces and request functions from API definitions to ensure consistency between the server and the client. The project employs a transport-agnostic client interface, decoupling high-level API calls from the underlying network library. It uses a plugin-based generation pipeline and a custom plugin architecture to allow for the customization of output types and validation schemas. The system provides capabilities for n
This tool automates the creation of type-safe TypeScript SDKs from OpenAPI specifications during the build process, serving as a specialized code generation framework that reduces boilerplate for API integrations.
This project is a command-line tool that automates the creation of type-safe TypeScript HTTP clients directly from OpenAPI specifications. By transforming service definitions into structured source code, it ensures end-to-end type synchronization and enforces runtime data integrity across network boundaries. The generator distinguishes itself by mapping OpenAPI data structures into Zod validation schemas, allowing for consistent schema-driven type mapping and response validation. It supports deduplicated source synthesis to minimize redundancy in the generated output and provides template cus
This tool automates the generation of type-safe TypeScript clients from OpenAPI specifications during the build process, effectively reducing boilerplate and ensuring schema synchronization.
The Swift OpenAPI Generator is a build-time tool that produces type-safe Swift client and server code directly from OpenAPI specification documents. By integrating with build systems through native plugins, it automates the creation of strongly-typed interfaces and protocol stubs that map network operations to native methods, ensuring that application code remains strictly consistent with defined data schemas. The project distinguishes itself through a protocol-oriented architecture that decouples business logic from specific transport implementations. It utilizes a pluggable transport layer
This tool automates the creation of type-safe Swift code from OpenAPI specifications during the build process, directly fulfilling the requirement for compile-time code generation integrated into the build system.
sqlc is a code generation tool that compiles raw SQL queries into type-safe application code. By analyzing SQL statements against database schema definitions during the build process, it eliminates the need for manual data mapping and prevents runtime type errors. The project functions as a schema-aware generator that translates database column types into native language primitives. It distinguishes itself through a modular, plugin-based architecture that allows for the extension of the generation pipeline to support diverse programming languages and custom frameworks beyond its default capab
sqlc is a specialized compile-time code generator that automates the creation of type-safe data access layers by analyzing SQL schemas, fitting the requirement for build-time boilerplate reduction.
Nim is a statically typed, compiled systems programming language designed for high performance and cross-platform development. It translates high-level source code into C, C++, or JavaScript, allowing developers to produce efficient native binaries or web-compatible scripts from a single codebase. The language emphasizes a clean, indentation-based syntax that simplifies code hierarchy while maintaining the power of a full-featured systems language. What distinguishes Nim is its robust metaprogramming framework, which allows developers to inspect, modify, and generate code structures during th
Nim is a systems programming language that features a powerful macro system for AST manipulation and compile-time code generation, making it a robust tool for automating boilerplate reduction during the build process.
Twirp is a Protocol Buffers RPC framework designed for implementing type-safe, distributed microservices communication over HTTP. It functions as a microservices communication framework and API code generator that produces strongly typed client stubs and server interfaces from schema definitions to eliminate manual network boilerplate. The framework ensures compatibility with existing web infrastructure by executing remote procedure calls over standard HTTP transport. It uses schema-driven contracts as a single source of truth to enable cross-language interoperability and decouple business lo
Twirp is a schema-driven RPC framework that automates the generation of type-safe client and server code from Protobuf definitions, effectively reducing boilerplate during the build process.
This project is a type-safe GraphQL client generator and TypeScript schema compiler. It transforms GraphQL schema definitions and operation documents into static TypeScript types to ensure compile-time validation and data consistency between an API and a frontend application. The system functions as a customizable GraphQL plugin framework. It uses a plugin-based architecture and a custom pipeline to generate tailored API clients and request functions, eliminating the need for manual type declarations. The project covers GraphQL client automation, type generation, and workflow optimization. I
This tool automates the generation of type-safe TypeScript code from GraphQL schemas and operations, functioning as a specialized compile-time code generation framework that integrates directly into build pipelines.
flutterrustbridge is a code generation tool that automatically creates type‑safe Dart bindings for Rust functions, enabling direct cross‑language calls between Flutter and a Rust backend. It provides an async FFI adapter that transforms synchronous Rust functions into Dart async methods with background thread management, a cross‑language object manager that wraps persistent Rust structs as Dart objects preserving state across calls, and trait object interop that converts Rust traits into Dart abstract classes for seamless bidirectional use. The project handles the full lifecycle of integrat
This tool automates the generation of type-safe FFI bindings between Dart and Rust during the build process, serving as a specialized compile-time code generation framework for cross-language interoperability.
thiserror is a Rust error handling library and procedural macro designed to define custom error types. It functions as a trait implementation automator that generates the necessary code for standard library error traits at compile time. The library focuses on eliminating boilerplate by using derive macros to automatically implement display and source methods. It allows for the creation of custom error structs and enums that can map low-level errors to high-level variants while preserving the original cause and backtrace information. Its capabilities cover custom error formatting through temp
This library uses procedural macros to automate the generation of boilerplate code for error handling at compile time, fitting the category of a code generation framework for Rust.
Ajv is a high-performance data validation framework that compiles JSON schemas into optimized, standalone JavaScript functions. By transforming declarative schema definitions into executable code, it eliminates runtime interpretation overhead and provides a secure, efficient way to enforce data integrity across both browser and server environments. The library distinguishes itself through its focus on performance and type safety. It employs advanced compilation techniques, including abstract syntax tree optimization and function caching, to ensure rapid validation. Beyond standard checks, it
Ajv is a high-performance validation library that functions as a compile-time code generator by transforming JSON schemas into optimized, standalone JavaScript functions to eliminate runtime overhead.
Elixir is a functional, concurrent programming language designed for building scalable and maintainable applications. It operates on the Erlang virtual machine, leveraging a distributed, fault-tolerant runtime environment that manages lightweight processes to ensure system reliability. By utilizing an actor-model supervision strategy, the language enables the creation of high-concurrency backend systems that automatically recover from failures and maintain stability under heavy loads. The language distinguishes itself through a powerful metaprogramming environment that allows developers to ex
Elixir is a programming language with a robust metaprogramming system and macro capabilities that allow for extensive compile-time code generation and AST manipulation, fitting the requirements for a framework that automates code creation during the build process.
Zig is a general-purpose systems programming language designed for high-performance applications that require manual memory management and direct control over hardware resources. It prioritizes predictable execution by enforcing explicit control flow and requiring functions to accept explicit memory allocators, ensuring that all heap operations and logic paths remain visible to the developer. The language distinguishes itself through a powerful compile-time metaprogramming engine that allows for arbitrary code execution during the build process, enabling advanced reflection and the generation
Zig features a powerful compile-time execution engine that allows for arbitrary code generation and metaprogramming directly within the build process, making it a robust tool for reducing boilerplate through compile-time logic.
CXX is a code generator that produces a safe, zero-overhead FFI bridge between Rust and C++. It lets functions and data types from either language be used directly in the other, with static type safety enforced at compile time and no copying, serialization, or runtime checks across the boundary. The bridge supports the full range of cross-language interactions: Rust can call C++ functions and use C++ types, and C++ can call Rust functions and use Rust types. Standard library types like strings, vectors, and smart pointers are mapped automatically between the two languages, while opaque types
This tool automates the generation of safe FFI bridge code between Rust and C++ during the build process, providing the type-safe metaprogramming and build system integration required for compile-time code generation.
This library is a header-only C++ framework that performs regular expression evaluation and static string analysis during the compilation phase. By leveraging template metaprogramming and constant expression evaluation, it transforms pattern matching logic into static state machines, effectively shifting the cost of parsing and validation from runtime to build time. The project distinguishes itself by encoding text data directly into the type system, allowing for the validation and extraction of string content before a program ever executes. This approach ensures that regular expression patte
This library is a compile-time framework that uses template metaprogramming to transform regular expressions into static state machines, effectively automating the generation of optimized parsing code during the build process.
Moshi is a JSON serialization library and parser for Kotlin and Java. It functions as a reflectionless JSON encoder that converts typed objects to JSON strings and parses JSON data back into language objects. The library distinguishes itself through compile-time adapter generation, which removes the performance overhead associated with runtime reflection. It also provides a polymorphic JSON mapper that uses type identifiers to resolve and instantiate specific subclasses of a common base type. The framework supports custom adapter definitions for specialized type conversion, including nullabi
Moshi is a JSON serialization library that uses compile-time code generation to create type-safe adapters, effectively automating the boilerplate of mapping objects to JSON without the performance cost of reflection.
Orval is an OpenAPI-to-TypeScript code generator that produces fully typed API clients, data-fetching hooks, mock data, validation schemas, and server handlers from OpenAPI or Swagger specifications. It reads any YAML or JSON API specification and generates TypeScript interfaces, HTTP request functions, and framework-specific integration code that ensures compile-time correctness for all API calls. The project distinguishes itself by generating production-ready data-fetching hooks for React Query, Vue Query, Svelte Query, Solid Query, Angular, and SWR, complete with automatic cache invalidati
Orval is a specialized code generation tool that automates the creation of type-safe API clients and hooks from OpenAPI specifications, integrating directly into the build process to eliminate boilerplate.
Ent is a statically typed entity framework for Go that models database structures as a graph of nodes and edges. It functions as a code generation engine that transforms schema definitions into type-safe database clients, query builders, and migration scripts. By representing data as interconnected entities, the framework enables intuitive traversal of complex relationships and ensures that database interactions remain consistent with the application model at compile time. The framework distinguishes itself through its graph-based approach to data modeling and its reliance on compile-time cod
Ent is a code generation framework that transforms schema definitions into type-safe Go code during the build process, directly addressing the need to reduce boilerplate and ensure type safety in database interactions.
Templ is a type-safe HTML templating engine and UI framework for Go. It provides a system for building reusable HTML components that compile into Go code for server-side rendering, ensuring type safety and compile-time validation of data and logic. The project features a dedicated language server that provides autocomplete and syntax validation for template files within supported code editors. It employs compile-time code generation to transform a custom template language into Go source code, enabling the creation of modular HTML fragments and logic blocks. The framework includes automated s
Templ is a compile-time code generation tool that transforms custom HTML templates into type-safe Go code, directly addressing the need to automate boilerplate and ensure type safety during the build process.
This project is a command-line schema-to-code converter designed to transform diverse data specifications into type-safe Python data structures. It functions as a generator for Pydantic models, dataclasses, and typed dictionaries, enabling developers to maintain synchronization between evolving data contracts and application code. By parsing formats such as JSON Schema, OpenAPI, AsyncAPI, Protobuf, and Avro, the tool automates the creation of native classes that reflect the constraints and metadata defined in the source specifications. The generator distinguishes itself through a highly confi
This tool automates the creation of type-safe Python data structures from schema specifications, serving as a specialized code generator that integrates into development workflows to reduce boilerplate.
This project is a command-line tool and template-based scaffolding engine that transforms API interface specifications into functional client libraries and server stubs. By automating the creation of type-safe SDKs and boilerplate code, it bridges the gap between service definitions and implementation, allowing developers to maintain synchronized codebases across many programming languages. The tool distinguishes itself through a portable execution model that utilizes containerized build isolation to ensure identical output regardless of the host environment. It features a modular, plugin-bas
This tool automates the creation of boilerplate code by transforming API specifications into functional source code, serving as a specialized code generation engine that integrates directly into build pipelines.
This project is a framework for the efficient serialization and deserialization of data structures. It provides a unified, macro-based interface that automates the conversion of complex internal objects into standardized formats and reconstructs them from raw input streams or buffers. By leveraging compile-time code generation, the library minimizes manual implementation overhead while ensuring consistent logic across diverse data types. The framework distinguishes itself through a format-agnostic data model and a visitor-based parsing architecture that decouples data structures from specific
Serde is a powerful framework that uses Rust's procedural macro system to automate the generation of serialization and deserialization code at compile-time, effectively reducing boilerplate for data structure conversion.
MessagePack-CSharp is a high-performance binary serializer for .NET that converts C# objects to and from the compact MessagePack format. It uses compile-time source generation to produce AOT-safe formatters and resolvers, eliminating runtime reflection and enabling ahead-of-time compilation scenarios. The serializer encodes object fields as integer indices instead of string keys, producing compact binary output with deterministic field ordering, and provides stack-allocated reader and writer structs for direct encoding and decoding of MessagePack primitives without heap allocations. The libra
This library provides a specialized compile-time source generator for high-performance serialization in .NET, directly automating the creation of boilerplate-free, AOT-safe code during the build process.
Apollo Kotlin is a strongly-typed GraphQL client and code generation library designed for Kotlin and JVM applications. It functions as a comprehensive development tool that transforms GraphQL schema definitions and query documents into type-safe models during the build process, ensuring that data access errors are identified at compile time rather than at runtime. The project distinguishes itself through its multiplatform runtime abstraction, which allows developers to share data fetching and caching logic across Android, iOS, and desktop environments. It provides a normalized local caching s
Apollo Kotlin is a specialized code generation framework that transforms GraphQL schemas and queries into type-safe Kotlin models during the build process, directly addressing the need to reduce boilerplate and ensure type safety.
protobuf.js is a JavaScript and TypeScript library for encoding and decoding structured data using the Protocol Buffers binary format. It functions as a dynamic parser that can load and process schemas at runtime, a JSON transcoder for converting messages to human-readable formats, and a framework for building transport-agnostic remote procedure call clients. The project distinguishes itself by offering both dynamic message handling and a static code generator that produces TypeScript declarations and JavaScript modules to reduce runtime overhead. It also provides a reflection API for definin
This library provides a static code generator that produces TypeScript and JavaScript modules from Protocol Buffer schemas, effectively automating boilerplate creation during the build process.
Riverpod is a reactive state management framework for Dart that manages application state through providers which automatically track dependencies and rebuild dependents when values change. It functions as an asynchronous data caching library, caching results of async operations and exposing loading, error, and data states to widgets without manual future handling. The framework includes a provider composition system that combines multiple providers into derived values that recompute automatically when any dependency changes, along with code generation for state providers that reduces boilerpl
Riverpod is a state management framework that includes a dedicated code generation tool to automate the creation of boilerplate-heavy provider classes, fitting the requirement for compile-time code generation within the Dart ecosystem.
Typia is a compile-time code generator that transforms TypeScript type annotations into runtime validation, serialization, and schema functions without requiring decorators or separate schema files. It generates optimized validation and serialization code during TypeScript compilation, producing dedicated functions for each type that eliminate runtime schema objects for faster execution. The project extends this core capability into several integrated areas. It generates fully typed client SDKs from NestJS controller source code, keeping server and client types synchronized automatically. It
Typia is a compile-time code generation framework that leverages TypeScript's compiler to transform type annotations into optimized runtime functions, directly addressing the need to automate boilerplate code creation during the build process.
Quarkus is a Kubernetes-native Java framework designed for building high-performance, memory-efficient applications. It utilizes ahead-of-time native compilation to transform Java code into standalone, optimized binaries that eliminate the need for a virtual machine, enabling rapid startup and reduced memory consumption. By performing code augmentation during the build phase, it shifts heavy processing tasks away from runtime, ensuring that applications are optimized for cloud-native environments. The framework distinguishes itself through a unified approach to reactive and imperative program
Quarkus is a Java framework that performs extensive build-time code augmentation and ahead-of-time compilation to optimize applications, effectively serving as a compile-time code generation engine for cloud-native development.
This library provides a procedural macro utility for Rust that automates the implementation of type-safe builder patterns. By leveraging the compiler to enforce structural integrity, it ensures that all mandatory fields are initialized and that objects are constructed in a valid state before the program executes. The project distinguishes itself by using typestate-based tracking and marker types to encode the initialization progress of an object directly into the type system. This approach allows for a zero-cost abstraction layer where all validation logic and state checks are resolved during
This library provides a procedural macro for Rust that automates the generation of type-safe builder patterns at compile time, directly addressing the need to reduce boilerplate code.
Groovy is a JVM programming language and metaprogramming framework that provides a Java compatible environment for building applications. It functions as a dynamic scripting language and a tool for authoring domain-specific languages, allowing for the execution of custom scripts and the creation of specialized mini-languages with concise syntax. The project is distinguished by its ability to modify program behavior and class definitions through both compile-time and runtime metaprogramming. It utilizes a hybrid typing model that combines dynamic method resolution with optional static type che
Groovy provides robust compile-time metaprogramming through its Abstract Syntax Tree (AST) transformation framework, allowing you to inject or modify code during the compilation process to reduce boilerplate.
Entitas is a data-oriented Entity Component System framework for Unity. It is designed to separate game state into components and logic into systems, utilizing a data-oriented design to optimize CPU cache usage, memory usage, and processing speed. The framework includes a C# source code generator that automatically produces boilerplate classes, entity accessors, and context singletons to reduce manual coding. It also provides a Unity editor debugging tool for real-time runtime state visualization, system performance monitoring, and visual entity inspection. The system manages entity lifecycl
This framework provides a specialized code generation tool for Unity that automates the creation of boilerplate components and accessors, directly addressing the need for compile-time code generation to reduce manual effort.
| Repository | Stars | Sprache | Lizenz | Letzter Push |
|---|---|---|---|---|
| dotnet/roslyn | 20.2K | C# | mit | |
| hey-api/openapi-ts | 4.1K | TypeScript | mit | |
| astahmer/openapi-zod-client | 1.2K | TypeScript | — | |
| apple/swift-openapi-generator | 1.9K | Swift | Apache-2.0 | |
| sqlc-dev/sqlc | 17.9K | Go | MIT | |
| nim-lang/nim | 18.1K | Nim | NOASSERTION | |
| twitchtv/twirp | 7.5K | Go | Apache-2.0 | |
| dotansimha/graphql-code-generator | 11.3K | TypeScript | MIT | |
| fzyzcjy/flutter_rust_bridge | 5.1K | Dart | mit | |
| dtolnay/thiserror | 5.5K | Rust | Apache-2.0 |