{"id":18549292,"url":"https://github.com/sanyavertolet/statics","last_synced_at":"2026-02-10T03:04:23.826Z","repository":{"id":246543546,"uuid":"821427044","full_name":"sanyavertolet/statics","owner":"sanyavertolet","description":"Serve static resources on JVM and native","archived":false,"fork":false,"pushed_at":"2025-02-03T04:24:01.000Z","size":391,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-13T06:08:24.400Z","etag":null,"topics":["kotlin","kotlin-jvm","kotlin-multiplatform","kotlin-native","ktor","ktor-server","static-resources"],"latest_commit_sha":null,"homepage":"https://sanyavertolet.github.io/statics/","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/sanyavertolet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2024-06-28T14:09:46.000Z","updated_at":"2024-10-28T17:12:02.000Z","dependencies_parsed_at":"2025-05-15T09:22:25.708Z","dependency_job_id":null,"html_url":"https://github.com/sanyavertolet/statics","commit_stats":null,"previous_names":["sanyavertolet/statics"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/sanyavertolet/statics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanyavertolet%2Fstatics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanyavertolet%2Fstatics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanyavertolet%2Fstatics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanyavertolet%2Fstatics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanyavertolet","download_url":"https://codeload.github.com/sanyavertolet/statics/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanyavertolet%2Fstatics/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259592280,"owners_count":22881268,"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":["kotlin","kotlin-jvm","kotlin-multiplatform","kotlin-native","ktor","ktor-server","static-resources"],"created_at":"2024-11-06T20:38:34.439Z","updated_at":"2026-02-10T03:04:23.744Z","avatar_url":"https://github.com/sanyavertolet.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Module ktor-statics\n\nThis project is a tiny library for `Ktor`-based apps designed to serve static files such as HTML, JavaScript, and CSS.\nThe problem is that Ktor has `staticResources()` on `jvm`, while `native` does not have any easy mechanism to configure serving static files.\n\n`Ktor-statics` provides a function available on `jvm`, `linuxX64`, `linuxArm64`, `macosX64`, and `macosArm64` targets:\n```kotlin\nstatics(remotePath = \"/\", basePackage = \"path/to/resource/folder\", index = \"index.html\")\n```\n\n* `remotePath` - prefix for `statics` requests;\n* `basePackage` - path to `statics` (on `jvm` - path to resources inside your `.jar`, on `native` - path to folder);\n* `index` - file that should be served if no path matches.\n\n#### On `jvm`, `statics` uses `staticResources` under the hood. If you want same behaviour on `jvm`, use `alternativeStatics`.\n\n## Installation and Usage\n1. Add GitHub maven repository to your `settings.gradle.kts` file:\n```kotlin\n   dependencyResolutionManagement { \n       repositories { \n           mavenCentral()\n           maven { \n               name = \"sanyavertolet/statics\"\n               url = uri(\"https://maven.pkg.github.com/sanyavertolet/statics\")\n               credentials { \n                   username = providers.gradleProperty(\"gpr.user\").orNull ?: System.getenv(\"GITHUB_ACTOR\")\n                   password = providers.gradleProperty(\"gpr.key\").orNull ?: System.getenv(\"GITHUB_TOKEN\") \n               } \n           } \n       }\n   }\n```\nFor more information, read [GitHub Docs](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry).\n\n2. Add `com.sanyavertolet.statics:ktor-statics:{STATICS_VERSION}` to dependencies in your `build.gradle.kts` file:\n```kotlin\n    kotlin {\n        jvm()\n        linuxX64()\n    \n        sourceSets {\n            commonMain {\n                dependencies {\n                    // other dependencies\n                    implementation(\"com.sanyavertolet.statics:ktor-statics:${STATICS_VERSION}\")\n                }\n            }\n        }\n    }\n```\n\n3. Use `statics` in your routing configuration:\n```kotlin\n// jvm\nfun Application.module() {\n    // some other configurations\n    routing {\n        // other routing configuration\n        statics(\"/\", \"public\")\n    }\n}\n\n// native\nfun Application.module() {\n    // some other configurations\n    routing {\n        // other routing configuration\n        statics(\"/\", \"/path/to/public\")\n    }\n}\n```\n\n## Contributing\nAll the contributions are welcomed!\nPlease see [CONTRIBUTING.md](CONTRIBUTING.md) file for details on how to get started.\n\n## Support\nFor support or to report bugs, please open an issue on [statics issues](https://github.com/sanyavertolet/statics/issues) page.\n\n## License\n`statics` is licensed under the `MIT Licence`.\nSee the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanyavertolet%2Fstatics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanyavertolet%2Fstatics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanyavertolet%2Fstatics/lists"}