{"id":33108981,"url":"https://github.com/cufyorg/graphkt","last_synced_at":"2026-01-18T02:14:54.825Z","repository":{"id":41246211,"uuid":"505209108","full_name":"cufyorg/graphkt","owner":"cufyorg","description":"A DSL based graphql server library for kotlin backed by graphql-java.","archived":false,"fork":false,"pushed_at":"2024-04-14T06:16:54.000Z","size":418,"stargazers_count":9,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-06T22:33:58.840Z","etag":null,"topics":["graphql","graphql-server","kotlin","ktor","ktor-server","subscription","websocket","websocket-server"],"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/cufyorg.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}},"created_at":"2022-06-19T20:10:35.000Z","updated_at":"2023-02-21T10:43:23.000Z","dependencies_parsed_at":"2024-04-14T04:30:23.457Z","dependency_job_id":"855d8657-0966-486c-8396-cc44973647ee","html_url":"https://github.com/cufyorg/graphkt","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/cufyorg/graphkt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cufyorg%2Fgraphkt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cufyorg%2Fgraphkt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cufyorg%2Fgraphkt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cufyorg%2Fgraphkt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cufyorg","download_url":"https://codeload.github.com/cufyorg/graphkt/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cufyorg%2Fgraphkt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28526569,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"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":["graphql","graphql-server","kotlin","ktor","ktor-server","subscription","websocket","websocket-server"],"created_at":"2025-11-15T01:00:22.740Z","updated_at":"2026-01-18T02:14:54.818Z","avatar_url":"https://github.com/cufyorg.png","language":"Kotlin","readme":"# Graphkt [![](https://jitpack.io/v/org.cufy/graphkt.svg)](https://jitpack.io/#org.cufy/graphkt)\n\nA GraphQL library based on\n[graphql-java](http://github.com/graphql-java/graphql-java)\nwith kotlin-friendly builders and ktor routing extensions.\n\n### Install\n\nThe main way of installing this library is\nusing `jitpack.io`\n\n```kts\nrepositories {\n    // ...\n    mavenCentral()\n    maven { url = uri(\"https://jitpack.io\") }\n}\n\ndependencies {\n    // Replace TAG with the desired version\n    val graphkt_version = \"TAG\"\n    implementation(\"org.cufy.graphkt:graphkt-core:$graphkt_version\")\n    implementation(\"org.cufy.graphkt:graphkt-ktor:$graphkt_version\")\n    implementation(\"org.cufy.graphkt:graphkt-graphql-java:$graphkt_version\")\n}\n```\n\n### How to set up on ktor\n\nThe following is an example of using it.\n\n```kotlin\ndata class Entity(\n    val name: String\n)\n\nval EntityObjectType: GraphQLObjectType\u003cEntity\u003e = GraphQLObjectType {\n    name = \"Entity\"\n    description = \"Some entity.\"\n\n    field(Entity::name) {\n        description = \"The name of the entity.\"\n        type { GraphQLStringType }\n    }\n\n    field(\"nameWithCustomVar\") {\n        description = \"The name of the entity with the customVar in the context.\"\n        type { GraphQLStringType.Nullable }\n\n        get {\n            it.name + context[\"myCustomVar\"]\n        }\n    }\n}\n\nval EntitiesFlow = MutableSharedFlow\u003cEntity\u003e()\n\nfun Application.configureGraphQL() {\n    // you can choose any of these IDEs\n    // graphiql()\n    // apolloSandbox()\n    graphqlPlayground() // recommended\n\n    graphql {\n        // add import org.cufy.graphkt.java.`graphql-java`\n        `graphql-java` {\n            // engine-specific configuration\n        }\n\n        before {\n            context[\"myCustomVar\"] = Math.random()\n        }\n\n        schema {\n            query {\n                description = \"The root query.\"\n\n                field(\"getEntityWithName\") {\n                    description = \"Get an entity instance.\"\n                    type { EntityObjectType }\n\n                    val nameArg = argument\u003cString\u003e(\"name\") {\n                        description = \"The name of the entity.\"\n                        type { GraphQLStringType }\n                    }\n\n                    get { Entity(nameArg()) }\n                }\n            }\n            mutation {\n                description = \"The root mutation\"\n\n                field(\"pushEntity\") {\n                    description = \"Push an entity to subscribers\"\n                    type { EntityObjectType }\n\n                    val nameArg = argument\u003cString\u003e(\"name\") {\n                        description = \"The name of the entity.\"\n                        type { GraphQLStringType }\n                    }\n\n                    get {\n                        val entity = Entity(nameArg())\n                        EntitiesFlow.emit(entity)\n                        entity\n                    }\n                }\n            }\n            subscription {\n                description = \"The root subscription\"\n\n                field(\"subscribeToEntities\") {\n                    description = \"Subscribe to pushed entities\"\n                    type { EntityObjectType }\n\n                    getFlow { EntitiesFlow }\n                }\n            }\n        }\n    }\n}\n```\n","funding_links":[],"categories":["Implementations"],"sub_categories":["Kotlin"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcufyorg%2Fgraphkt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcufyorg%2Fgraphkt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcufyorg%2Fgraphkt/lists"}