{"id":20856992,"url":"https://github.com/jdekim43/kotlin-protobuf","last_synced_at":"2026-05-15T20:31:42.396Z","repository":{"id":160901981,"uuid":"635698376","full_name":"jdekim43/kotlin-protobuf","owner":"jdekim43","description":"Protobuf Generator for Kotlin","archived":false,"fork":false,"pushed_at":"2024-10-15T08:11:45.000Z","size":840,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-15T13:26:22.178Z","etag":null,"topics":["grpc","kotlin","kotlin-library","kotlin-multiplatform","protoc","protubuf"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jdekim43.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-03T09:06:59.000Z","updated_at":"2025-05-22T18:43:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"412287a3-eab8-4b92-bbd9-edfaa32f8a63","html_url":"https://github.com/jdekim43/kotlin-protobuf","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/jdekim43/kotlin-protobuf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdekim43%2Fkotlin-protobuf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdekim43%2Fkotlin-protobuf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdekim43%2Fkotlin-protobuf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdekim43%2Fkotlin-protobuf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdekim43","download_url":"https://codeload.github.com/jdekim43/kotlin-protobuf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdekim43%2Fkotlin-protobuf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33078898,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T20:25:35.270Z","status":"ssl_error","status_checked_at":"2026-05-15T20:25:34.732Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["grpc","kotlin","kotlin-library","kotlin-multiplatform","protoc","protubuf"],"created_at":"2024-11-18T04:35:37.016Z","updated_at":"2026-05-15T20:31:42.354Z","avatar_url":"https://github.com/jdekim43.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kotlin Protobuf\n[![Maven Central](https://img.shields.io/maven-central/v/kr.jadekim/kotlin-protobuf)](https://search.maven.org/artifact/kr.jadekim/kotlin-protobuf)\n\nProtocol Buffer generator for kotlin multiplatform or single platform.\n\n## Overview\n### Features\n* Support data types\n  * optional, repeated, map, oneof features\n* Support service type (grpc)\n* Support JSON format\n* Export type registry\n* google.api (Grpc Gateway)\n* Plugin\n  * kotlinx-serialization adapter (You can use protobuf serializer with ProtobufFormat)\n\n### Backlog\n* Gradle Plugin\n* Customize generating files for Extension (e.g. Modify field type)\n* Add option infos of protobuf to generated files.\n* Utilities\n  * ProtobufMessage.toAny : optimize toAny usage\n* Improve kotlin type mapping\n  * google.protobuf.Any to kotlin.Any\n  * google.protobuf.Empty to kotlin.Unit\n  * some prebuilt types\n  * Kotlinx serialization annotations\n* Kotlin/JS\n* Kotlin/Native\n* Plain kotlin serializer\n* Grpc Web\n\n### Note\n* This will use 'package' option in proto file. (Not using java_package or other option)\n\n### Examples\n* [JVM Example](example/build.gradle.kts)\n* [Multiplatform Example](example-multiplatform/build.gradle.kts)\n\n## Usage\n### Gradle :: JVM\n#### build.gradle.kts\n```\nplugins {\n    kotlin(\"jvm\") version \"1.9.23\"\n    kotlin(\"plugin.serialization\") version \"1.9.23\" //optional\n    id(\"com.google.protobuf\") version \"0.9.4\"\n}\n\nsourceSets {\n    main {\n        proto {\n            srcDir(File(project.projectDir, \"src/main/proto\"))\n        }\n    }\n}\n\nprotobuf {\n    plugins {\n        //If you want without kotlinx-serialization.\n        //id(\"kotlin-protobuf-kotlin\") {\n        //    artifact = \"kr.jadekim:kotlin-protobuf-generator:$kotlinProtobufVersion\"\n        //}\n        id(\"kotlin-protobuf-kotlinx\") {\n            artifact = \"kr.jadekim:kotlin-protobuf-generator-kotlinx:$kotlinProtobufVersion\"\n        }\n        id(\"kotlin-protobuf-converter-jvm\") {\n            artifact = \"kr.jadekim:kotlin-protobuf-generator-converter-jvm:$kotlinProtobufVersion\"\n        }\n        \n        id(\"grpc\") {\n            artifact = \"io.grpc:protoc-gen-grpc-java:$grpcVersion\"\n        }\n        id(\"kotlin-protobuf-grpc-jvm\") {\n            artifact = \"kr.jadekim:kotlin-protobuf-generator-grpc-jvm:$kotlinProtobufVersion\"\n        }\n    }\n    \n    generateProtoTasks {\n        all().forEach {\n            it.plugins {\n                id(\"kotlin-protobuf-kotlinx\")\n                id(\"kotlin-protobuf-converter-jvm\")\n\n                id(\"grpc\")\n                id(\"kotlin-protobuf-grpc-jvm\")\n            }\n        }\n    }\n}\n\ndependencies {\n    implementation(\"kr.jadekim:kotlin-protobuf:$kotlinProtobufVersion\")\n    implementation(\"kr.jadekim:kotlin-protobuf-kotlinx:$kotlinProtobufVersion\")\n    implementation(\"kr.jadekim:kotlin-protobuf-grpc:$kotlinProtobufVersion\")\n\n    implementation(\"com.google.protobuf:protobuf-java:$protobufVersion\")\n    implementation(\"io.grpc:grpc-protobuf:$grpcVersion\")\n    implementation(\"io.grpc:grpc-stub:$grpcVersion\")\n    implementation(\"io.grpc:grpc-kotlin-stub:$grpcKotlinVersion\")\n\n    implementation(\"org.jetbrains.kotlinx:kotlinx-serialization-core:$kotlinxSerializationVersion\")\n}\n```\n\n### Gradle :: Multiplatform\n#### build.gradle.kts\n```\nplugins {\n    kotlin(\"multiplatform\") version \"1.9.23\"\n    kotlin(\"plugin.serialization\") version \"1.9.23\" //optional\n    id(\"com.google.protobuf\") version \"0.9.4\"\n    `java-library`\n}\n\nsourceSets {\n    main {\n        proto {\n            srcDir(File(project.projectDir, \"src/main/proto\"))\n        }\n    }\n}\n\nprotobuf {\n    plugins {\n        //If you want without kotlinx-serialization.\n        //id(\"kotlin-protobuf-kotlin\") {\n        //    artifact = \"kr.jadekim:kotlin-protobuf-generator:$kotlinProtobufVersion\"\n        //}\n        id(\"kotlin-protobuf-kotlinx\") {\n            artifact = \"kr.jadekim:kotlin-protobuf-generator-kotlinx:$kotlinProtobufVersion\"\n        }\n        id(\"kotlin-protobuf-converter-multiplatform\") {\n            artifact = \"kr.jadekim:kotlin-protobuf-generator-multiplatform:$kotlinProtobufVersion\"\n        }\n        id(\"kotlin-protobuf-converter-multiplatform-jvm\") {\n            artifact = \"kr.jadekim:kotlin-protobuf-generator-multiplatform-jvm:$kotlinProtobufVersion\"\n        }\n        \n        id(\"grpc\") {\n            artifact = \"io.grpc:protoc-gen-grpc-java:$grpcVersion\"\n        }\n        id(\"kotlin-protobuf-grpc-multiplatform\") {\n            artifact = \"kr.jadekim:kotlin-protobuf-generator-grpc-multiplatform:$kotlinProtobufVersion\"\n        }\n        id(\"kotlin-protobuf-grpc-multiplatform-jvm\") {\n            artifact = \"kr.jadekim:kotlin-protobuf-generator-grpc-multiplatform-jvm:$kotlinProtobufVersion\"\n        }\n    }\n    \n    generateProtoTasks {\n        all().forEach {\n            it.plugins {\n                id(\"kotlin-protobuf-kotlinx\")\n                id(\"kotlin-protobuf-converter-multiplatform\")\n                id(\"kotlin-protobuf-converter-multiplatform-jvm\")\n\n                id(\"grpc\")\n                id(\"kotlin-protobuf-grpc-multiplatform\")\n                id(\"kotlin-protobuf-grpc-multiplatform-jvm\")\n            }\n        }\n    }\n}\n\nkotlin {\n    jvm {\n        withJava()\n    }\n    \n    sourceSets {\n        val commonMain by getting {\n            kotlin.srcDir(File(buildDir, \"generated/source/proto/main/kotlin-protobuf-kotlinx\"))\n            kotlin.srcDir(File(buildDir, \"generated/source/proto/main/kotlin-protobuf-converter-multiplatform\"))\n            kotlin.srcDir(File(buildDir, \"generated/source/proto/main/kotlin-protobuf-grpc-multiplatform\"))\n\n            dependencies {\n                implementation(\"kr.jadekim:kotlin-protobuf:$kotlinProtobufVersion\")\n                implementation(\"kr.jadekim:kotlin-protobuf-kotlinx:$kotlinProtobufVersion\")\n                implementation(\"kr.jadekim:kotlin-protobuf-grpc:$kotlinProtobufVersion\")\n                \n                implementation(\"org.jetbrains.kotlinx:kotlinx-serialization-core:$kotlinxSerializationVersion\")\n            }\n        }\n\n        val jvmMain by getting {\n            kotlin.srcDir(File(buildDir, \"generated/source/proto/main/java\"))\n            kotlin.srcDir(File(buildDir, \"generated/source/proto/main/grpc\"))\n            kotlin.srcDir(File(buildDir, \"generated/source/proto/main/kotlin-protobuf-converter-multiplatform-jvm\"))\n            kotlin.srcDir(File(buildDir, \"generated/source/proto/main/kotlin-protobuf-grpc-multiplatform-jvm\"))\n\n            dependencies {\n                implementation(\"com.google.protobuf:protobuf-java:$protobufVersion\")\n                implementation(\"io.grpc:grpc-protobuf:$grpcVersion\")\n                implementation(\"io.grpc:grpc-stub:$grpcVersion\")\n                implementation(\"io.grpc:grpc-kotlin-stub:$grpcKotlinVersion\")\n            }\n        }\n    }\n}\n```\n\n### Options\n* Set prefix to type url : `kotlin-protobuf.prefix=[some_prefix]`\n* Generate TypeRegistry : `kotlin-protobuf.type_registry=[output class]`\n* Generate JvmTypeRegistry : `kotlin-protobuf.jvm_type_registry=[output class]`\n* Generate Kotlinx SerializersModules : `kotlin-protobuf.serializers_modules=[output class]`\n\n#### Note\nOption value can't have ','.\n\n#### How to apply options\n```\nprotobuf {\n  ...\n  generateProtoTasks {\n    all().forEach {\n      it.plugins {\n        id(...) {\n          option(\"[option string]\")\n        }\n      }\n    }\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdekim43%2Fkotlin-protobuf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdekim43%2Fkotlin-protobuf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdekim43%2Fkotlin-protobuf/lists"}