A Kotlin API for generating .kt source files.
4.1k
Stars
312
Forks
68
Open issues
30
Contributors
AI Analysis
KotlinPoet is a Kotlin and Java API for programmatically generating .kt source files, serving developers who build code generators, annotation processors, and metaprogramming tools. It is purpose-built for the code-generation niche and is most valuable for library authors, framework developers, and tooling engineers rather than general application developers. Mainstream adoption within the JVM ecosystem but specialized in function.
Inferred from signals mentioned in the README (tests, CI, type safety) — not a review of the actual code.
AI's overall editorial judgment — not an average of the bars above, can weigh other factors too.
Kotlin code generation library for programmatic .kt file creation
KotlinPoet is a Java and Kotlin API that enables programmatic generation of Kotlin source code files. Built by Square in 2017, it targets developers building code generators, annotation processors, and metaprogramming tools. Adoption appears concentrated among library authors and framework builders rather than end-application developers. The project is actively maintained with steady but modest growth, suggesting established, stable usage within a specialized niche.
KotlinPoet originated at Square in 2017 as a Kotlin equivalent to JavaPoet, Square's earlier Java code generation library. It emerged during Kotlin's rapid adoption period and has evolved alongside Kotlin's ecosystem maturation, particularly with the rise of annotation processing and code generation patterns in Android and JVM development.
The repository shows consistent but gradual growth (4,142 stars over 9 years, 1 star in the last week). Growth pattern suggests adoption plateaued after reaching libraries and frameworks that depend on it—not a viral/trending project, but steady integration into build pipelines. The relatively stable star count despite 311 forks indicates deep, narrow adoption rather than broad awareness.
Adoption not verified through provided metadata. README lacks case studies, known users list, or quantified production deployment evidence. However, the existence of 311 forks and 4,142 stars over 9 years, combined with Square's reputation, suggests real but undocumented usage. The stable star trajectory suggests integration into established libraries rather than new projects.
Based on README, KotlinPoet appears to provide a fluent API for constructing Kotlin language constructs (functions, classes, properties, etc.) programmatically. Likely uses builder/DSL patterns typical of code generation libraries. README does not detail architecture beyond high-level positioning.
Not documented in README. No visibility into test suite size, coverage metrics, or testing strategy from provided metadata.
Last push on 2026-06-24 (2 days before analysis date) indicates active maintenance. Project is not abandoned. However, sparse growth metrics (1 star/week) and lack of detailed release notes in README suggest this is a stable, mature project receiving incremental updates rather than rapid feature development or optimization cycles.
ADOPT IF: you are building code generators, annotation processors, or metaprogramming tools that emit Kotlin code and need type-safe, maintainable generation APIs. AVOID IF: you need a general-purpose code templating system, require cutting-edge performance optimizations, or need extensive documentation and tutorials beyond the README. MONITOR IF: you are evaluating annotation processing strategies—KSP is ascendant in newer Kotlin projects, and KotlinPoet's relevance may shift as KSP adoption grows.
Independent dimensions
Mainstream potential
3/10
Technical importance
7/10
Adoption evidence
4/10
- KSP adoption may reduce demand for lower-level code generation libraries; KotlinPoet may become a dependency rather than a first-choice tool.
- Sparse documentation and examples (README is minimal) may increase adoption friction for new users unfamiliar with code generation patterns.
- Slow growth rate and lack of visible community could indicate difficulty attracting contributors or users learning the tool independently.
- No evidence of Kotlin language feature parity—likelihood that library lags Kotlin spec evolution is unverified.
- Maintenance by Square but no evidence of dedicated team or public roadmap; risk of becoming legacy if priorities shift.
KotlinPoet will likely remain a stable, foundational library for Kotlin code generation but is unlikely to grow beyond its current niche of framework and tool builders. It may gradually become less visible as KSP-based tools emerge as the canonical pattern, but it will probably persist as a lower-level utility within the broader annotation processing ecosystem.
Explore similar
Newsletter
Get analyses like this every Monday
Free weekly digest of the most interesting open-source discoveries.
Languages
Information
- Language
- Kotlin
- License
- Apache-2.0
- Last updated
- 13h ago
- Created
- 114mo ago
- Analyzed with
- anthropic/claude-haiku-4-5
Stars over time
Contributors over time
Top 100 contributors only — repos with more will plateau at 100.
Open issues
Disallow "inline class" syntax
No TypeParameter found for index T
Subclasses of `TypeName` return `TypeName` from `copy`
KSTypeReference.toTypeName losses parameter annotations
FunSpec (Builder): Add throwsKDoc
Top contributors
Recent releases
Similar repos
Kotlin/kotlinx-kover
Kover is a JetBrains-maintained code coverage toolset specifically for Kotlin...
| Repository | Stars | Week Δ | Language | Score | Updated |
|---|---|---|---|---|---|
|
|
4.1k | — | Kotlin | 8/10 | 13h ago |
|
|
3.5k | — | Kotlin | 8/10 | 13h ago |
|
|
3.8k | — | Kotlin | 8/10 | 3d ago |
|
|
53.1k | — | Kotlin | 10/10 | 11h ago |
|
|
1.6k | — | Kotlin | 8/10 | 1w ago |
|
|
10.1k | — | Kotlin | 8/10 | 14h ago |
KSP (Kotlin Symbol Processing) is a newer (post-2020) annotation processing framework that can perform code generation. Differs in scope: KSP is a compiler plugin framework, while KotlinPoet is a code-generation utility library. KotlinPoet is often used *within* KSP-based processors.
KotlinPoet's spiritual predecessor for Java. Serves the same niche for Java code generation. KotlinPoet is the Kotlin-native equivalent and has likely achieved parity or better integration with Kotlin tooling.
Dokka generates documentation, not code. Different problem space. Not a direct competitor, though both operate in Kotlin ecosystem tooling.
KotlinPoet competes against hand-written or template-based code generation. Offers type safety, IDE support, and maintainability advantages for complex generation scenarios.