{"id":14990759,"url":"https://github.com/luukdegram/apple_pie","last_synced_at":"2025-04-24T04:10:37.217Z","repository":{"id":37271752,"uuid":"270049778","full_name":"Luukdegram/apple_pie","owner":"Luukdegram","description":"Basic HTTP server implementation in Zig","archived":false,"fork":false,"pushed_at":"2023-06-27T16:28:00.000Z","size":308,"stargazers_count":164,"open_issues_count":14,"forks_count":21,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-16T21:02:12.578Z","etag":null,"topics":["http","http-server","server","zig","ziglang"],"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/Luukdegram.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"Luukdegram"}},"created_at":"2020-06-06T17:14:54.000Z","updated_at":"2025-04-06T18:32:46.000Z","dependencies_parsed_at":"2024-05-03T07:59:34.194Z","dependency_job_id":"52296e58-094e-4e45-aa60-5e628878b957","html_url":"https://github.com/Luukdegram/apple_pie","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Luukdegram%2Fapple_pie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Luukdegram%2Fapple_pie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Luukdegram%2Fapple_pie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Luukdegram%2Fapple_pie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Luukdegram","download_url":"https://codeload.github.com/Luukdegram/apple_pie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250560053,"owners_count":21450172,"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","http-server","server","zig","ziglang"],"created_at":"2024-09-24T14:20:46.623Z","updated_at":"2025-04-24T04:10:37.196Z","avatar_url":"https://github.com/Luukdegram.png","language":"Zig","funding_links":["https://github.com/sponsors/Luukdegram"],"categories":[],"sub_categories":[],"readme":"# Apple Pie\n\nApple pie is a HTTP Server implementation in [Zig](https://ziglang.org). The initial goal is to offer full support for http versions 1.0 and 1.1 with 2.0 and further planned at a later stage. With Apple Pie I'd like to offer a library that contains all features you'd expect from a server, while still remaining performant. Rather than hiding complexity, I want to expose its functionality so users can replace and/or expand upon to fit their needs.\n\n## Roadmap\n- HTTP 1.1 spec (fully) implemented\n\n## Features\n- Crossplatform support\n- Extensive routing (see the [router](examples/router.zig) example) built in\n- Allows for both async and blocking I/O using Zig's std event loop\n\n## Example\nA very basic implementation would be as follow:\n\n```zig\nconst std = @import(\"std\");\nconst http = @import(\"apple_pie\");\n\n// use evented mode for event loop support\npub const io_mode = .evented;\n\n// optional root constant to define max stack buffer size per request\npub const buffer_size: usize = 4096;\n// optional root constant to define max header size per request\npub const request_buffer_size: usize = 4096;\n\n/// Context variable, accessible by all handlers, allowing to access data objects\n/// without requiring them to be global. Thread-safety must be handled by the user.\nconst Context = struct {\n    data: []const u8,\n};\n\npub fn main() !void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer _ = gpa.deinit();\n\t\n    const my_context: Context = .{ .data = \"Hello, world!\" };\n\t\n    try http.listenAndServe(\n        gpa.allocator(),\n        try std.net.Address.parseIp(\"127.0.0.1\", 8080),\n        my_context,\n        index,\n    );\n}\n\nfn index(ctx: Context, response: *http.Response, request: http.Request) !void {\n    _ = request;\n    try response.writer().print(\"{s}\", .{ctx.data});\n}\n```\n\nMore examples can be found in the [examples](examples) folder.\n\n## Building\n\nApple Pie is being developed on Zig's master branch and tries to keep up-to-date with its latest development.\n\nTo build Apple Pie a simple\n`zig build` will suffice.\n\nTo build any of the examples, use the following:\n```\nzig build example -Dexample=\u003cexample_name\u003e\n```\nit will appear in `zig-out/bin/example_name`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluukdegram%2Fapple_pie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluukdegram%2Fapple_pie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluukdegram%2Fapple_pie/lists"}