{"id":13611303,"url":"https://github.com/rjaros/kilua","last_synced_at":"2025-04-12T23:39:31.299Z","repository":{"id":201058266,"uuid":"706876956","full_name":"rjaros/kilua","owner":"rjaros","description":"Composable web framework for Kotlin/Wasm and Kotlin/JS","archived":false,"fork":false,"pushed_at":"2025-04-07T17:24:03.000Z","size":87151,"stargazers_count":251,"open_issues_count":5,"forks_count":10,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-12T23:39:19.153Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://kilua.dev","language":"Kotlin","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/rjaros.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-10-18T19:41:05.000Z","updated_at":"2025-04-11T01:32:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"a8b25b4d-abda-4edd-b52c-72f09406f46c","html_url":"https://github.com/rjaros/kilua","commit_stats":{"total_commits":571,"total_committers":1,"mean_commits":571.0,"dds":0.0,"last_synced_commit":"98423301eb4b44ff87943e2e08078a3bfff4ea00"},"previous_names":["rjaros/kilua"],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rjaros%2Fkilua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rjaros%2Fkilua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rjaros%2Fkilua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rjaros%2Fkilua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rjaros","download_url":"https://codeload.github.com/rjaros/kilua/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248647255,"owners_count":21139081,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-01T19:01:53.972Z","updated_at":"2025-04-12T23:39:31.280Z","avatar_url":"https://github.com/rjaros.png","language":"Kotlin","funding_links":[],"categories":["开发框架","Kotlin"],"sub_categories":["Web框架"],"readme":"# Kilua\n\nComposable web framework for Kotlin/Wasm and Kotlin/JS.\n\n[![Maven Central](https://img.shields.io/maven-central/v/dev.kilua/kilua.svg?label=Maven%20Central)](https://central.sonatype.com/search?namespace=dev.kilua\u0026name=kilua)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nKilua allows you to build modern web applications with the [Kotlin](https://kotlinlang.org) language. \n\nIt is powered by the Compose Runtime and is similar to the [compose-html](https://github.com/JetBrains/compose-multiplatform#compose-html)\nlibrary. It gives you clean, modular API to create declarative UI components and manage their state. \nUnlike compose-html, Kilua supports both Kotlin/Wasm and Kotlin/JS targets. It also provides a lot\nof ready to use components for many typical web application use cases.\n\nKilua is a kind of successor to my [KVision](https://kvision.io) framework. Writing Kilua applications should be \nfamiliar to both Compose users (`@Composable` functions, state management, coroutines/flow integration) and \nKVision users (component based API, allowing some imperative, direct ways to interact with the UI components).\n\n## Features\n\n- Use powerful Compose programming model and state management to develop web applications.\n- Choose from the wide range of ready to use components and form inputs.\n- Compile the same application code for Kotlin/Wasm and Kotlin/JS targets.\n- Create fullstack applications with [Kilua RPC](https://github.com/rjaros/kilua-rpc) library.\n- Translate your application to other languages with [Gettext](https://github.com/rjaros/kilua-gettext) - \none of the most widely used tool for i18n.\n- Deploy your application with full SSR (Server Side Rendering) for better \nSEO performance and user experience.\n- Export your application as a set of static HTML files for more affordable hosting solutions.\n\n## Project status\n\nKilua is being actively developed. Please create an issue for any bugs or feature requests. \nContributions and PRs are welcomed. All artifacts are published to Maven Central.\n\n## Documentation and examples\n\nThe official guide is published at [https://kilua.gitbook.io/kilua-guide](https://kilua.gitbook.io/kilua-guide). \nIt's still a work in progress and may be incomplete.\n\nCurrent API documentation is published at [https://rjaros.github.io/kilua/api/](https://rjaros.github.io/kilua/api/).\n\nDifferent example applications can be found in the [examples directory](https://github.com/rjaros/kilua/tree/main/examples), \nincluding fully compatible TodoMVC and Realworld.io (with SSR) implementations.\n\nMore documentation, including tutorials and guides, is planned for the future.\n\n## Building and running the examples\n\nTo build the examples, you need to have JDK 21 or later installed.\n\nThe following tasks are available from the root project level:\n\n- `./gradlew -t :examples:[exampleName]:jsBrowserDevelopmentRun` - run the webpack dev server in continuous build mode for JS target on `http://localhost:3000`\n- `./gradlew -t :examples:[exampleName]:wasmJsBrowserDevelopmentRun` - run the webpack dev server in continuous build mode for Wasm target on `http://localhost:3000`\n- `./gradlew :examples:[exampleName]:jsBrowserDistribution` - build production application for JS target to `examples/[exampleName]/build/dist/js/productionExecutable` directory\n- `./gradlew :examples:[exampleName]:wasmJsBrowserDistribution` - build production application for Wasm target to `examples/[exampleName]/build/dist/wasmJs/productionExecutable` directory\n\nFor fullstack and SSR examples additional tasks are available:\n\n- `./gradlew :examples:[exampleName]:jvmRun` - run the backend application for development on `http://localhost:8080` \n- `./gradlew :examples:[exampleName]:jarWithJs` - build and package the production application with JS frontend to `examples/[exampleName]/build/libs` directory\n- `./gradlew :examples:[exampleName]:jarWithWasmJs` - build and package the production application with Wasm frontend to `examples/[exampleName]/build/libs` directory\n- `./gradlew :examples:[exampleName]:exportWithJs` - export static site with JS frontend to `examples/[exampleName]/build/site` directory\n- `./gradlew :examples:[exampleName]:exportWithWasmJs` - export static site with Wasm frontend to `examples/[exampleName]/build/site` directory\n\nTo run packaged fullstack or SSR example just use `java -jar [exampleName]-[version].jar` command.\n\nNote: use `gradlew.bat` instead of `./gradlew` on Windows operating system.\n\nIf you want to start your own project, just copy the [Kilua template](https://github.com/rjaros/kilua/tree/main/templates/template) project.\n\n## Code sample\n\nThis is a simple \"Hello, world!\" application written in Kilua:\n\n```kotlin\nimport androidx.compose.runtime.getValue\nimport androidx.compose.runtime.mutableStateOf\nimport androidx.compose.runtime.remember\nimport androidx.compose.runtime.setValue\nimport dev.kilua.Application\nimport dev.kilua.CoreModule\nimport dev.kilua.compose.root\nimport dev.kilua.html.button\nimport dev.kilua.html.div\nimport dev.kilua.html.unaryPlus\nimport dev.kilua.startApplication\n\nclass App : Application() {\n\n    override fun start() {\n        root(\"root\") {\n            var state by remember { mutableStateOf(\"Hello, world!\") }\n\n            div {\n                +state\n            }\n            button(\"Add an exclamation mark\") {\n                onClick {\n                    state += \"!\"\n                }\n            }\n        }\n    }\n}\n\nfun main() {\n    startApplication(::App, CoreModule)\n}\n```\n## SSR (Server-Side Rendering)\n\nKilua is the first Kotlin/Wasm and Kotlin/JS web framework supporting true Server-Side Rendering. \nSSR is a crucial concept in modern web development that enhances user experience \nand boosts SEO performance. Kilua SSR support is based on the possibility to run exactly the same \napplication code both in the browser and in NodeJs environment. What's more, you can easily use \nWASM compilation target for much better performance.  \n\n### SSR Features\n\n- Preparing application for SSR is as easy as changing the router class.\n- Ability to use external API calls and fullstack RPC services.\n- Automatically extracting CSS styles from JS bundle and injecting them into the HTML document before sending to the browser.\n- Serialization of the application state from the server to the client side.\n\n### Current limitations\n\n- The URL address and the browser preferred locale need to be the only source of the application state.\n- Using browser APIs directly is not recommended.\n- Advanced JS components (like RichText, Tabulator etc.) are rendered on the server\nas simple HTML placeholders.\n- Rendering authenticated content is not supported at the moment.\n- The \"hydration\" is implemented in a very primitive way (by replacing the rendered content).\n\n## Leave a star\n\nIf you like this project, please give it a star on GitHub. Thank you!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frjaros%2Fkilua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frjaros%2Fkilua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frjaros%2Fkilua/lists"}