{"id":50236184,"url":"https://github.com/arthurhoch/kiss-server","last_synced_at":"2026-05-26T19:35:22.245Z","repository":{"id":355728715,"uuid":"1229344549","full_name":"arthurhoch/kiss-server","owner":"arthurhoch","description":"Tiny zero-dependency Java 17+ HTTP/1.1 server library for simple REST-style applications.","archived":false,"fork":false,"pushed_at":"2026-05-24T15:06:21.000Z","size":213,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-24T15:12:41.185Z","etag":null,"topics":["http-server","http11","java","java17","kiss","library","maven","nio","rest","zero-dependency"],"latest_commit_sha":null,"homepage":"https://arthurhoch.github.io/kiss-server/","language":"Java","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/arthurhoch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":"docs/roadmap.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-05T00:25:33.000Z","updated_at":"2026-05-24T15:06:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/arthurhoch/kiss-server","commit_stats":null,"previous_names":["arthurhoch/kiss-server"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/arthurhoch/kiss-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurhoch%2Fkiss-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurhoch%2Fkiss-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurhoch%2Fkiss-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurhoch%2Fkiss-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arthurhoch","download_url":"https://codeload.github.com/arthurhoch/kiss-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arthurhoch%2Fkiss-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33536655,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"ssl_error","status_checked_at":"2026-05-26T15:22:15.568Z","response_time":63,"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":["http-server","http11","java","java17","kiss","library","maven","nio","rest","zero-dependency"],"created_at":"2026-05-26T19:35:21.453Z","updated_at":"2026-05-26T19:35:22.233Z","avatar_url":"https://github.com/arthurhoch.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KissServer\n\nTiny zero-dependency Java 17+ HTTP/1.1 server library for simple REST-style applications.\n\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.arthurhoch/kiss-server.svg)](https://central.sonatype.com/artifact/io.github.arthurhoch/kiss-server)\n[![Java](https://img.shields.io/badge/Java-17%2B-blue.svg)](https://openjdk.org/projects/jdk/17/)\n[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE.txt)\n[![CI](https://github.com/arthurhoch/kiss-server/actions/workflows/ci.yml/badge.svg)](https://github.com/arthurhoch/kiss-server/actions/workflows/ci.yml)\n[![CodeQL](https://github.com/arthurhoch/kiss-server/actions/workflows/codeql.yml/badge.svg)](https://github.com/arthurhoch/kiss-server/actions/workflows/codeql.yml)\n[![Docs](https://github.com/arthurhoch/kiss-server/actions/workflows/pages.yml/badge.svg)](https://github.com/arthurhoch/kiss-server/actions/workflows/pages.yml)\n\nPart of the KISS Java Libraries family: small, explicit, zero-dependency Java 17+ libraries. Each project is independent. Use only the modules you need.\n\nKissServer exists for cases where a small, explicit Java HTTP server is enough and a framework runtime would be more than the job needs. It uses a Java 17-compatible NIO HTTP/1.1 engine, a small public API, bounded parser limits, and an application-provided or server-owned `ExecutorService` for normal route handlers.\n\nLatest stable release: `0.1.0`.\n\nThe `0.1.0` artifact is published on Maven Central and the `v0.1.0` GitHub release is available.\n\n## Why this exists\n\nKissServer exists for simple APIs, local tools, MVPs, internal services, embedded use cases, and AI-generated applications where a small HTTP/1.1 server is enough and a framework runtime would be more than the job needs.\n\n## Highlights\n\n- Zero production dependencies.\n- Java 17+ main artifact.\n- NIO-based HTTP/1.1 socket engine.\n- Simple `get`, `post`, dynamic route, and response APIs.\n- Fast path for exact static/simple `GET` responses.\n- Normal path for business routes.\n- Configurable `ExecutorService` for handler execution.\n- Optional JDK 21 virtual-thread executor usage from application code.\n- Android-compatible by design, pending real device or emulator validation.\n- GraalVM Native Image friendly by design, pending validated example or CI support.\n\n## Design Principles\n\n- KISS: keep routing, request handling, and runtime behavior explicit.\n- Zero production dependencies.\n- Java 17+ standard APIs and a Java 17-compatible NIO engine.\n- Bounded buffers, parser limits, and predictable shutdown.\n- Small public API with no Servlet API, dependency injection container, annotation scanning, or framework runtime.\n- Fast path for exact static responses without complicating normal routes.\n\n## Installation\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.arthurhoch\u003c/groupId\u003e\n    \u003cartifactId\u003ekiss-server\u003c/artifactId\u003e\n    \u003cversion\u003e0.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Hello World\n\n```java\nimport io.github.arthurhoch.kiss.server.KissServer;\n\npublic final class Main {\n    public static void main(String[] args) throws Exception {\n        KissServer server = KissServer.create();\n        server.get(\"/health\", ctx -\u003e ctx.text(\"OK\"));\n        server.start(8080).await();\n    }\n}\n```\n\n## Common Routes\n\nGET route:\n\n```java\nserver.get(\"/hello\", ctx -\u003e ctx.text(\"Hello\"));\n```\n\nPOST route:\n\n```java\nserver.post(\"/echo\", ctx -\u003e ctx.text(ctx.bodyAsString()));\n```\n\nDynamic route:\n\n```java\nserver.get(\"/users/{id}\", ctx -\u003e {\n    String id = ctx.pathParam(\"id\");\n    return ctx.text(\"User \" + id);\n});\n```\n\nQuery params are currently exposed as the raw query string:\n\n```java\nserver.get(\"/search\", ctx -\u003e {\n    String query = ctx.request().queryString();\n    return ctx.text(\"query=\" + query);\n});\n```\n\nRequest and response headers:\n\n```java\nserver.get(\"/headers\", ctx -\u003e {\n    String agent = ctx.request().header(\"User-Agent\");\n    return ctx.text(\"agent=\" + (agent == null ? \"\" : agent))\n            .header(\"X-App\", \"kiss-server\");\n});\n```\n\nCustom status:\n\n```java\nimport io.github.arthurhoch.kiss.server.http.HttpStatus;\n\nserver.get(\"/missing\", ctx -\u003e ctx.text(HttpStatus.NOT_FOUND, \"Missing\"));\n```\n\nJSON without a required JSON dependency:\n\n```java\nimport io.github.arthurhoch.kiss.server.http.ContentType;\nimport io.github.arthurhoch.kiss.server.http.HttpStatus;\nimport io.github.arthurhoch.kiss.server.http.Response;\n\nserver.get(\"/json\", ctx -\u003e {\n    String json = \"{\\\"message\\\":\\\"hello\\\"}\";\n    return Response.body(HttpStatus.OK, ContentType.JSON, json, java.nio.charset.StandardCharsets.UTF_8);\n});\n```\n\nPrebuilt static JSON bytes for an exact fast route:\n\n```java\nimport io.github.arthurhoch.kiss.server.routing.FastResponses;\n\nserver.fastGet(\"/version\", FastResponses.json(\"{\\\"version\\\":\\\"0.1.0\\\"}\"));\n```\n\n## Fast Path And Normal Path\n\nUse the fast path only when the response is fixed and the route is exact:\n\n```java\nserver.fastGet(\"/health\", FastResponses.text(\"OK\"));\n```\n\nGood fast path candidates include `/health`, `/ready`, `/version`, `/ping`, and `/robots.txt` when the response is static.\n\nUse normal routes for business logic, dynamic path params, query-dependent responses, request bodies, database calls, file calls, network calls, and anything that needs `Request`, `Context`, or `Response` flexibility.\n\n## Executor Configuration\n\nNormal handlers run on the configured `ExecutorService` by default. If no executor is provided, KissServer creates and owns one. If an executor is provided, the application owns its shutdown.\n\n```java\nimport io.github.arthurhoch.kiss.server.KissServer;\nimport io.github.arthurhoch.kiss.server.ServerConfig;\n\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\n\nExecutorService executor = Executors.newFixedThreadPool(\n        Math.max(4, Runtime.getRuntime().availableProcessors())\n);\n\nServerConfig config = ServerConfig.builder()\n        .host(\"0.0.0.0\")\n        .port(8080)\n        .executor(executor)\n        .maxConnections(10_000)\n        .maxHeaderBytes(16 * 1024)\n        .maxRequestLineBytes(8 * 1024)\n        .maxBodyBytes(10L * 1024 * 1024)\n        .build();\n\nKissServer server = KissServer.create(config);\n```\n\nOptional JDK 21 application code may pass a virtual-thread executor:\n\n```java\nExecutorService executor = Executors.newVirtualThreadPerTaskExecutor();\n\nServerConfig config = ServerConfig.builder()\n        .port(8080)\n        .executor(executor)\n        .build();\n```\n\nKissServer main source remains Java 17-compatible and does not call JDK 21-only APIs directly.\n\n## Performance Notes\n\nKissServer is designed to be fast because it is small and direct: byte-oriented parsing, bounded buffers, selector-based I/O, exact route checks before dynamic routes, precomputed response writer pieces, a fast path for static exact `GET` responses, and no framework runtime.\n\nThe normal path is still the right default for application behavior. Fast-static results must be labeled separately because they avoid normal `Request`, `Context`, and `Response` allocation.\n\nUndertow and Vert.x appear in benchmark modules as reference servers only. They are not dependencies of the main library.\n\n## Latest Local Benchmark Snapshot\n\nEnvironment:\n\n- Java: Temurin 21.0.11\n- wrk: 4.2.0 [kqueue]\n- Heap: `-Xms512m -Xmx512m`\n- Host: localhost\n- Warmup: 10s\n- Measured: 30s\n- wrk option: `--latency`\n- Raw results: [benchmarks/results/20260504T211305Z-nio-rerun](benchmarks/results/20260504T211305Z-nio-rerun)\n\nThese are local directional results, not universal production guarantees. Real systems include TLS, proxies, containers, CPU limits, network devices, payload variance, and different JVM or OS settings.\n\n| Scenario | Best kiss-server | Undertow | Vert.x | Winner |\n|----------|------------------|----------|--------|--------|\n| `health_t4_c100` | 209,089 req/s, p99 1.12ms | 157,380 req/s, p99 0.86ms | 157,356 req/s, p99 1.75ms | kiss-server |\n| `health_t8_c500` | 162,441 req/s, p99 5.62ms | 150,673 req/s, p99 3.87ms | 145,309 req/s, p99 5.25ms | kiss-server |\n| `hello_t8_c500` | 158,021 req/s, p99 6.05ms | 149,329 req/s, p99 4.03ms | 144,778 req/s, p99 6.77ms | kiss-server |\n| `json_t8_c500` | 156,804 req/s, p99 4.55ms | 149,090 req/s, p99 4.04ms | 147,406 req/s, p99 5.56ms | kiss-server |\n| `users_t8_c500` | 144,125 req/s, p99 4.99ms | 145,921 req/s, p99 4.06ms | 156,504 req/s, p99 5.14ms | Vert.x |\n| `post_echo_t8_c500` | 137,829 req/s, p99 5.30ms | 136,610 req/s, p99 4.99ms | 147,247 req/s, p99 4.97ms | Vert.x |\n| `post_consume_t8_c500` | 144,844 req/s, p99 4.79ms | 143,158 req/s, p99 4.18ms | 150,992 req/s, p99 4.92ms | Vert.x |\n\nFairness note: The winning kiss-server simple endpoint results use the clearly labeled fast-static mode with prebuilt responses for `/health`, `/hello`, and `/json`. Dynamic and POST workloads are benchmarked separately and still have different bottlenecks.\n\n## Deployment Recommendation\n\nProduction deployments should usually terminate TLS and HTTP/2 or HTTP/3 at Cloudflare, Nginx, Caddy, or a similar edge/proxy layer, then forward local HTTP/1.1 traffic to KissServer:\n\n```text\nclient/browser\n  -\u003e Cloudflare/Nginx/Caddy using TLS + HTTP/2 or HTTP/3\n      -\u003e kiss-server using HTTP/1.1 locally\n```\n\nFor local tools, tests, internal services, and embedded uses, KissServer can bind directly to loopback or a configured interface.\n\n## Intentionally Not Supported Yet\n\n- HTTP/2 in the core.\n- TLS implementation in the core.\n- WebSocket in the core.\n- Servlet API.\n- Spring, Quarkus, Netty, Jetty, Undertow, Vert.x, or other framework/server dependency in the main artifact.\n- Built-in JSON dependency.\n- Annotation scanning or dependency injection container.\n- Reflection in the hot path.\n\n## Related KISS Projects\n\nThese libraries are independent, zero-dependency Java 17+ projects. Use only the modules you need.\n\n| Project | Purpose |\n|---|---|\n| [kiss-json](https://github.com/arthurhoch/kiss-json) | Field-based JSON serialization and deserialization. |\n| [kiss-requests](https://github.com/arthurhoch/kiss-requests) | Simple HTTP client built on Java HttpClient. |\n| [kiss-server](https://github.com/arthurhoch/kiss-server) | Small HTTP/1.1 server for simple REST-style applications. |\n| [kiss-config](https://github.com/arthurhoch/kiss-config) | Configuration loading from properties, .env files, system properties, and environment variables. |\n| [kiss-binary](https://github.com/arthurhoch/kiss-binary) | Explicit binary IO for primitive binary formats. |\n\n## Documentation\n\n- [Documentation Index](docs/index.md)\n- [GitHub Pages](https://arthurhoch.github.io/kiss-server)\n- [Versioned AI Skills](docs/skills/index.md)\n- [Getting Started](docs/getting-started.md)\n- [API](docs/api.md)\n- [Examples](docs/examples.md)\n- [Using kiss-server with AI coding agents](docs/ai-usage.md)\n- [Tutorial for AI agents and humans](docs/tutorial-for-ai.md)\n- [AI Performance Guide](docs/ai-performance-guide.md)\n- [AI Quickstart](docs/AI_QUICKSTART.md)\n- [Fast Path](docs/fast-path.md)\n- [Executor Model](docs/executor-model.md)\n- [Performance](docs/performance.md)\n- [Benchmarking](docs/benchmarking.md)\n- [Safe Code Cleanup](docs/code-cleanup.md)\n- [Security Hardening](docs/security-hardening.md)\n- [Android](docs/android.md)\n- [Native Image](docs/native-image.md)\n- [Deployment](docs/deployment.md)\n- [Architecture](.github/architecture/index.md)\n\n## Maven Central Status\n\nVersion `0.1.0` is published on Maven Central. Release automation remains tag-based through the configured Maven Central workflow and requires the documented Central Portal and GPG secrets.\n\n## Requirements\n\n- Java 17 or newer for the main artifact.\n- Maven for building from source.\n- Optional JDK 21 only for application-provided virtual-thread executors.\n\n## Build\n\n```bash\nmvn -B clean verify\nmvn -B test jacoco:report\nmvn -B javadoc:javadoc\n```\n\nAdditional configured profiles:\n\n```bash\nmvn -Pspotbugs verify\nmvn -Psecurity verify\n```\n\n## Security and Quality\n\nGitHub Actions run CI, CodeQL, Dependency Review, OpenSSF Scorecard, GitHub Pages deployment, and Maven Central release readiness workflows. Dependabot tracks Maven and GitHub Actions updates. OWASP Dependency-Check is available through the `security` Maven profile, and SpotBugs is available through the optional `spotbugs` profile. See [Security Hardening](docs/security-hardening.md).\n\nJaCoCo coverage is generated during `verify`. Read the HTML report at `target/site/jacoco/index.html`; use `target/site/jacoco/jacoco.xml` for Codecov or Sonar if those services are configured later. No coverage badge is shown until a real external coverage service is configured.\n\nBefore deleting code, follow [Safe Code Cleanup](docs/code-cleanup.md): distinguish internal code from public API, search source/tests/docs/examples/benchmarks, inspect coverage, run Javadocs, and document user-visible removals in `CHANGELOG.md`. Before release, run the normal build, Javadocs, coverage generation, and any relevant optional quality/security profiles.\n\n## License\n\nApache License 2.0. Copyright 2026 Arthur Hoch. See [LICENSE.txt](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurhoch%2Fkiss-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farthurhoch%2Fkiss-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farthurhoch%2Fkiss-server/lists"}