{"id":13459453,"url":"https://github.com/javalin/javalin","last_synced_at":"2026-02-08T13:21:46.041Z","repository":{"id":37012341,"uuid":"87012358","full_name":"javalin/javalin","owner":"javalin","description":"A simple and modern Java and Kotlin web framework","archived":false,"fork":false,"pushed_at":"2025-05-01T10:13:56.000Z","size":5243,"stargazers_count":7864,"open_issues_count":42,"forks_count":613,"subscribers_count":108,"default_branch":"master","last_synced_at":"2025-05-05T22:42:45.271Z","etag":null,"topics":["hacktoberfest","java","javalin","jetty","kotlin","microservice","rest-api","servlet","web-framework"],"latest_commit_sha":null,"homepage":"https://javalin.io","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/javalin.png","metadata":{"files":{"readme":".github/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,"zenodo":null},"funding":{"github":["tipsy"]}},"created_at":"2017-04-02T20:01:28.000Z","updated_at":"2025-05-04T01:48:26.000Z","dependencies_parsed_at":"2023-11-25T04:22:20.655Z","dependency_job_id":"925cad9d-ff53-45e4-bc4f-5030360bb551","html_url":"https://github.com/javalin/javalin","commit_stats":null,"previous_names":["tipsy/javalin"],"tags_count":152,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javalin%2Fjavalin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javalin%2Fjavalin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javalin%2Fjavalin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javalin%2Fjavalin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javalin","download_url":"https://codeload.github.com/javalin/javalin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253969226,"owners_count":21992262,"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":["hacktoberfest","java","javalin","jetty","kotlin","microservice","rest-api","servlet","web-framework"],"created_at":"2024-07-31T09:01:22.880Z","updated_at":"2026-01-11T17:36:56.769Z","avatar_url":"https://github.com/javalin.png","language":"Kotlin","funding_links":["https://github.com/sponsors/tipsy","https://github.com/sponsors/barbarysoftware"],"categories":["Kotlin","开发框架","Back-End Development","hacktoberfest","\u003ca name=\"Kotlin\"\u003e\u003c/a\u003eKotlin"],"sub_categories":[],"readme":"\u003ca name=\"readme-top\"\u003e\u003c/a\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n  \u003c!--Logo--\u003e\n  \u003ca href=\"https://github.com/javalin/javalin\"\u003e\n    \u003cimg src=\"img/javalin.png\" alt=\"Logo\" width=\"70%\"\u003e\n  \u003c/a\u003e\n\n  \u003c!--Title--\u003e\n\u003ch3 align=\"center\"\u003eA simple web framework for Java and Kotlin\u003c/h3\u003e\n\n  \u003ch2\u003e\n    \u003ca href=\"https://javalin.io/documentation\"\u003e\u003cstrong\u003eView the documentation →\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr\u003e\n    \u003cbr\u003e\n  \u003c/h2\u003e\n  \u003cbr\u003e\n\n  \u003c!--License badge--\u003e\n  \u003ca href=\"https://github.com/javalin/javalin/blob/master/LICENSE\"\u003e\n    \u003cimg alt=\"Static Badge\" src=\"https://img.shields.io/badge/License-Apache_2.0-blue\"\u003e\n  \u003c/a\u003e\n  \u003c!--Maven central stable version badge--\u003e\n  \u003ca href=\"https://central.sonatype.com/artifact/io.javalin/javalin\"\u003e\n    \u003cimg alt=\"Stable Version\" src=\"https://img.shields.io/maven-central/v/io.javalin/javalin?label=stable\"\u003e\n  \u003c/a\u003e\n  \u003c!--Reposilite snapshot version badge--\u003e\n  \u003ca href=\"https://repo.reposilite.com/#/snapshots/io/javalin/javalin\"\u003e\n    \u003cimg alt=\"Snapshot Version\" src=\"https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo.reposilite.com%2Fsnapshots%2Fio%2Fjavalin%2Fjavalin%2Fmaven-metadata.xml\u0026label=snapshot\"\u003e\n  \u003c/a\u003e  \n  \u003c!--Discord badge--\u003e\n  \u003ca href=\"https://discord.gg/sgak4e5NKv\"\u003e\n    \u003cimg alt=\"Discord Link\" src=\"https://img.shields.io/discord/804862058528505896?label=discord%20chat\u0026logo=discord\u0026logoColor=white\"\u003e\n  \u003c/a\u003e\n  \u003c!--Codecov badge--\u003e\n  \u003ca href=\"https://codecov.io/gh/javalin/javalin\" \u003e\n    \u003cimg src=\"https://codecov.io/gh/javalin/javalin/graph/badge.svg?token=3L3CvpyMPI\"/\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n#  \n\nJavalin is a very lightweight web framework for Kotlin and Java which supports WebSockets, HTTP2 and async requests. \nJavalin’s main goals are simplicity, a great developer experience, and first class interoperability between Kotlin and Java.\n\nJavalin is more of a library than a framework. Some key points:\n\n* You don't need to extend anything\n* There are no @Annotations\n* There is no reflection\n* There is no other magic; just code.\n\n#### General information\n\n* The project webpage is [javalin.io](https://javalin.io) (the source is at [javalin/javalin.github.io](https://github.com/javalin/javalin.github.io)).\n* Read the documentation on: [javalin.io/documentation](https://javalin.io/documentation)\n* A summary of the license can be found at [TLDR Legal](https://tldrlegal.com/license/apache-license-2.0-(apache-2.0))\n* [Interesting issues](https://github.com/javalin/javalin/issues?q=is%3Aissue+label%3AINFO)\n\n#### Community\n\nWe have a very active [Discord](https://discord.gg/sgak4e5NKv) server where you can get help quickly. We also have a (much less\nactive) [Slack](https://join.slack.com/t/javalin-io/shared_invite/zt-1hwdevskx-ftMobDhGxhW0I268B7Ub~w) if you prefer that.\n\nContributions are very welcome, you can read more about contributing in our guide:\n[CONTRIBUTING](https://github.com/javalin/javalin/contribute)\n\nPlease consider [:heart: Sponsoring](https://github.com/sponsors/tipsy) or starring Javalin if you want to support the project.\n\n## Quickstart\n\n### Add dependency\n\n#### Maven\n\n```xml\n\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.javalin\u003c/groupId\u003e\n    \u003cartifactId\u003ejavalin\u003c/artifactId\u003e\n    \u003cversion\u003e6.7.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n#### Gradle\n\n```kotlin\nimplementation(\"io.javalin:javalin:6.7.0\")\n```\n\n### Start programming (Java)\n\n```java\nimport io.javalin.Javalin;\n\npublic class HelloWorld {\n    public static void main(String[] args) {\n        var app = Javalin.create(/*config*/)\n            .get(\"/\", ctx -\u003e ctx.result(\"Hello World\"))\n            .start(7070);\n    }\n}\n```\n\n### Start programming (Kotlin)\n\n```kotlin\nimport io.javalin.Javalin\n\nfun main() {\n    val app = Javalin.create(/*config*/)\n        .get(\"/\") { it.result(\"Hello World\") }\n        .start(7070)\n}\n```\n\n## Examples\n\nThis section contains a few examples, mostly just extracted from the [docs](https://javalin.io/documentation).\nAll examples are in Kotlin, but you can find them in Java in the documentation (it's just syntax changes).\n\nYou can find more examples in the [javalin-samples](https://github.com/javalin/javalin-samples) repository.\n\n### Api structure and server config\n\n```kotlin\nimport io.javalin.Javalin\nimport io.javalin.apibuilder.ApiBuilder.*\n\nfun main() {\n    val app = Javalin.create { config -\u003e\n        config.useVirtualThreads = true\n        config.http.asyncTimeout = 10_000L\n        config.staticFiles.add(\"/public\")\n        config.staticFiles.enableWebjars()\n        config.router.apiBuilder {\n            path(\"/users\") {\n                get(UserController::getAll)\n                post(UserController::create)\n                path(\"/{userId}\") {\n                    get(UserController::getOne)\n                    patch(UserController::update)\n                    delete(UserController::delete)\n                }\n                ws(\"/events\", userController::webSocketEvents)\n            }\n        }\n    }.start(7070)\n}\n```\n\n### WebSockets\n\n```kotlin\napp.ws(\"/websocket/{path}\") { ws -\u003e\n    ws.onConnect { ctx -\u003e println(\"Connected\") }\n    ws.onMessage { ctx -\u003e\n        val user = ctx.message\u003cUser\u003e() // convert from json string to object\n        ctx.send(user) //  convert to json string and send back\n    }\n    ws.onClose { ctx -\u003e println(\"Closed\") }\n    ws.onError { ctx -\u003e println(\"Errored\") }\n}\n```\n\n### Filters and Mappers\n\n```kotlin\napp.before(\"/some-path/*\") { ctx -\u003e ... } // runs before requests to /some-path/*\napp.before { ctx -\u003e ... } // runs before all requests\napp.after { ctx -\u003e ... } // runs after all requests\napp.exception(Exception.class) { e, ctx -\u003e ... } // runs if uncaught Exception\napp.error(404) { ctx -\u003e ... } // runs if status is 404 (after all other handlers)\n\napp.wsBefore(\"/some-path/*\") { ws -\u003e ... } // runs before ws events on /some-path/*\napp.wsBefore { ws -\u003e ... } // runs before all ws events\napp.wsAfter { ws -\u003e ... } // runs after all ws events\napp.wsException(Exception.class) { e, ctx -\u003e ... } // runs if uncaught Exception in ws handler\n```\n\n### JSON-mapping\n\n```kotlin\nvar todos = arrayOf(...)\napp.get(\"/todos\") { ctx -\u003e // map array of Todos to json-string\n    ctx.json(todos)\n}\napp.put(\"/todos\") { ctx -\u003e // map request-body (json) to array of Todos\n    todos = ctx.body\u003cArray\u003cTodo\u003e\u003e()\n    ctx.status(204)\n}\n```\n\n### File uploads\n\n```kotlin\napp.post(\"/upload\") { ctx -\u003e\n    ctx.uploadedFiles(\"files\").forEach { uploadedFile -\u003e\n        FileUtil.streamToFile(uploadedFile.content(), \"upload/${uploadedFile.filename()}\")\n    }\n}\n```\n\n## Plugins\n\nJavalin has a plugin system that allows you to add functionality to the core library.\nYou can find a list of plugins [here](https://javalin.io/plugins).\n\nInstalling a plugin is as easy as adding a dependency to your project and registering it with Javalin:\n\n```kotlin\nJavalin.create { config -\u003e\n    config.registerPlugin(MyPlugin())\n}\n```\n\nSome of the most popular plugins are:\n\n### OpenAPI Plugin\n\nThe [Javalin OpenAPI](https://github.com/javalin/javalin-openapi) plugin allows you to generate an OpenAPI 3.0 specification for your API at compile time.\n\nAnnotate your routes with `@OpenApi` to generate the specification:\n\n```kotlin\n@OpenApi(\n    summary = \"Get all users\",\n    operationId = \"getAllUsers\",\n    tags = [\"User\"],\n    responses = [OpenApiResponse(\"200\", [OpenApiContent(Array\u003cUser\u003e::class)])],\n    path = \"/users\",\n    methods = [HttpMethod.GET]\n)\nfun getAll(ctx: Context) {\n    ctx.json(UserService.getAll())\n}\n```\n\nSwagger UI and ReDoc UI implementations for viewing the generated specification in your browser are also available.\n\nFor more information, see the [Javalin OpenAPI Wiki](https://github.com/javalin/javalin-openapi/wiki).\n\n### SSL Plugin\n\nThe [Javalin SSL](https://javalin.io/plugins/ssl-helpers) plugin allows you to easily configure SSL for your Javalin server, supporting a variety of formats such as PEM, PKCS12, DER, P7B, and JKS.\n\nEnabling SSL on the 443 port is as easy as:\n\n```kotlin\nval plugin = SSLPlugin { conf -\u003e\n    conf.pemFromPath(\"/path/to/cert.pem\", \"/path/to/key.pem\")\n}\n\nJavalin.create { javalinConfig -\u003e\n    javalinConfig.plugins.register(plugin)\n}.start()\n```\n\n## Sponsors\n\n| Logo | Sponsor | Amount |\n|------|---------|--------|\n| \u003cimg src=\"https://github.com/user-attachments/assets/07bf134b-db7a-4e53-b3db-f1681b0443ff\" alt=\"Barbary Software\" width=\"32\" height=\"32\"\u003e | [@barbarysoftware](https://github.com/sponsors/barbarysoftware) | (50 USD/m) |\n| \u003cimg src=\"https://github.com/user-attachments/assets/06236654-649d-46dd-b174-11ce61e325ec\" alt=\"Vasilis Soumakis\" width=\"32\" height=\"32\"\u003e | \u003ca href=\"https://github.com/VassilisSoum\"\u003e@VassilisSoum\u003c/a\u003e | (25 USD/m) |\n\n## Special thanks\n\n* Blake Mizerany, for creating [Sinatra](http://www.sinatrarb.com/)\n* Per Wendel, for creating [Spark](http://sparkjava.com/)\n* [Christian Rasmussen](https://github.com/chrrasmussen), for being a great guy\n* [Per Kristian Kummermo](https://github.com/pkkummermo), also for being a great guy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavalin%2Fjavalin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavalin%2Fjavalin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavalin%2Fjavalin/lists"}