{"id":13626686,"url":"https://github.com/frmdstryr/zhp","last_synced_at":"2025-10-08T05:31:16.489Z","repository":{"id":37271778,"uuid":"225716683","full_name":"frmdstryr/zhp","owner":"frmdstryr","description":"A Http server written in Zig","archived":true,"fork":false,"pushed_at":"2022-06-02T15:23:08.000Z","size":828,"stargazers_count":355,"open_issues_count":11,"forks_count":24,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-11-14T15:55:11.982Z","etag":null,"topics":["http","zig"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/frmdstryr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"frmdstryr","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":null}},"created_at":"2019-12-03T21:11:48.000Z","updated_at":"2024-11-06T12:38:52.000Z","dependencies_parsed_at":"2022-07-12T05:18:37.206Z","dependency_job_id":null,"html_url":"https://github.com/frmdstryr/zhp","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frmdstryr%2Fzhp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frmdstryr%2Fzhp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frmdstryr%2Fzhp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frmdstryr%2Fzhp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frmdstryr","download_url":"https://codeload.github.com/frmdstryr/zhp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235683861,"owners_count":19029079,"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":["http","zig"],"created_at":"2024-08-01T21:02:26.561Z","updated_at":"2025-10-08T05:31:11.071Z","avatar_url":"https://github.com/frmdstryr.png","language":"Zig","funding_links":["https://github.com/sponsors/frmdstryr"],"categories":["Zig","Libraries","Web Framework"],"sub_categories":["Zigged Project"],"readme":"# ZHP\n\n[![status](https://github.com/frmdstryr/zhp/actions/workflows/ci.yml/badge.svg)](https://github.com/frmdstryr/zhp/actions)\n\nA (work in progress) Http server written in [Zig](https://ziglang.org/).\n\nIf you have suggestions on improving the design please feel free to comment!\n\n### Features\n\n- A zero-copy parser and aims to compete with these [parser_benchmarks](https://github.com/rust-bakery/parser_benchmarks/tree/master/http)\nwhile still rejecting nonsense requests. It currently runs around ~1000MB/s.\n- Regex url routing thanks to [ctregex](https://github.com/alexnask/ctregex.zig)\n- Struct based handlers where the method maps to the function name\n- A builtin static file handler, error page handler, and not found page handler\n- Middleware support\n- Parses forms encoded with `multipart/form-data`\n- Streaming responses\n- Websockets\n\nSee how it compares in the [http benchmarks](https://gist.github.com/kprotty/3f369f46293a421f09190b829cfb48f7#file-newresults-md)\ndone by kprotty (now very old).\n\nIt's a work in progress... feel free to contribute!\n\n\n### Demo\n\nTry out the demo at [https://zhp.codelv.com](https://zhp.codelv.com).\n\n\u003e Note: If you try to benchmark the server it'll ban you, please run it locally\n\u003e or on your own server to do benchmarks.\n\nTo make and deploy your own app see:\n- [demo project](https://github.com/frmdstryr/zhp-demo)\n- [zig buildpack](https://github.com/frmdstryr/zig-buildpack)\n\n\n### Example\n\nSee the `example` folder for a more detailed example.\n\n```zig\nconst std = @import(\"std\");\nconst web = @import(\"zhp\");\n\npub const io_mode = .evented;\npub const log_level = .info;\n\nconst MainHandler = struct {\n    pub fn get(self: *MainHandler, request: *web.Request, response: *web.Response) !void {\n        _ = self;\n        _ = request;\n        try response.headers.put(\"Content-Type\", \"text/plain\");\n        _ = try response.stream.write(\"Hello, World!\");\n    }\n\n};\n\npub const routes = [_]web.Route{\n    web.Route.create(\"home\", \"/\", MainHandler),\n};\n\npub const middleware = [_]web.Middleware{\n    web.Middleware.create(web.middleware.LoggingMiddleware),\n};\n\npub fn main() anyerror!void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer std.debug.assert(!gpa.deinit());\n    const allocator = gpa.allocator();\n\n    var app = web.Application.init(allocator, .{.debug=true});\n    defer app.deinit();\n\n    try app.listen(\"127.0.0.1\", 9000);\n    try app.start();\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrmdstryr%2Fzhp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrmdstryr%2Fzhp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrmdstryr%2Fzhp/lists"}