{"id":34815793,"url":"https://github.com/muhammad-fiaz/api.zig","last_synced_at":"2026-04-26T09:32:38.481Z","repository":{"id":328966132,"uuid":"1116888162","full_name":"muhammad-fiaz/api.zig","owner":"muhammad-fiaz","description":"High-performance, multi-threaded HTTP API framework for Zig","archived":false,"fork":false,"pushed_at":"2025-12-16T13:34:36.000Z","size":4784,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-22T15:40:31.807Z","etag":null,"topics":["api","api-package","api-zig","graphql","http-zig","resful","resful-api","zig","zig-api","zig-api-package","zig-http","zig-lang","zig-library","zig-package","zig-restful"],"latest_commit_sha":null,"homepage":"https://muhammad-fiaz.github.io/api.zig/","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/muhammad-fiaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-15T14:22:30.000Z","updated_at":"2026-04-20T04:07:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/muhammad-fiaz/api.zig","commit_stats":null,"previous_names":["muhammad-fiaz/api.zig"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/muhammad-fiaz/api.zig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fapi.zig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fapi.zig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fapi.zig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fapi.zig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muhammad-fiaz","download_url":"https://codeload.github.com/muhammad-fiaz/api.zig/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fapi.zig/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32292886,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T08:29:33.829Z","status":"ssl_error","status_checked_at":"2026-04-26T08:29:18.366Z","response_time":129,"last_error":"SSL_read: 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":["api","api-package","api-zig","graphql","http-zig","resful","resful-api","zig","zig-api","zig-api-package","zig-http","zig-lang","zig-library","zig-package","zig-restful"],"created_at":"2025-12-25T13:36:48.211Z","updated_at":"2026-04-26T09:32:38.475Z","avatar_url":"https://github.com/muhammad-fiaz.png","language":"Zig","readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg  alt=\"logo\" src=\"https://github.com/user-attachments/assets/8c73f119-df49-46ac-ab5c-9dd5d216da4d\" /\u003e\n\n\u003ca href=\"https://muhammad-fiaz.github.io/api.zig/\"\u003e\u003cimg src=\"https://img.shields.io/badge/docs-muhammad--fiaz.github.io-blue\" alt=\"Documentation\"\u003e\u003c/a\u003e\n\u003ca href=\"https://ziglang.org/\"\u003e\u003cimg src=\"https://img.shields.io/badge/Zig-0.15.0+-orange.svg?logo=zig\" alt=\"Zig Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/api.zig\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/muhammad-fiaz/api.zig\" alt=\"GitHub stars\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/api.zig/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/muhammad-fiaz/api.zig\" alt=\"GitHub issues\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/api.zig/pulls\"\u003e\u003cimg src=\"https://img.shields.io/github/issues-pr/muhammad-fiaz/api.zig\" alt=\"GitHub pull requests\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/api.zig\"\u003e\u003cimg src=\"https://img.shields.io/github/last-commit/muhammad-fiaz/api.zig\" alt=\"GitHub last commit\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/api.zig/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/muhammad-fiaz/api.zig\" alt=\"License\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/api.zig/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://github.com/muhammad-fiaz/api.zig/actions/workflows/ci.yml/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n\u003cimg src=\"https://img.shields.io/badge/platforms-linux%20%7C%20windows%20%7C%20macos-blue\" alt=\"Supported Platforms\"\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/api.zig/releases/latest\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/muhammad-fiaz/api.zig?label=Latest%20Release\u0026style=flat-square\" alt=\"Latest Release\"\u003e\u003c/a\u003e\n\u003ca href=\"https://pay.muhammadfiaz.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/Sponsor-pay.muhammadfiaz.com-ff69b4?style=flat\u0026logo=heart\" alt=\"Sponsor\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/sponsors/muhammad-fiaz\"\u003e\u003cimg src=\"https://img.shields.io/badge/Sponsor-💖-pink?style=social\u0026logo=github\" alt=\"GitHub Sponsors\"\u003e\u003c/a\u003e\n\u003ca href=\"https://hits.sh/github.com/muhammad-fiaz/api.zig/\"\u003e\u003cimg src=\"https://hits.sh/github.com/muhammad-fiaz/api.zig.svg?label=Visitors\u0026extraCount=0\u0026color=green\" alt=\"Repo Visitors\"\u003e\u003c/a\u003e\n\n\u003cp\u003e\u003cem\u003eHigh-performance, multi-threaded HTTP API framework for Zig - build blazing-fast APIs with compile-time safety.\u003c/em\u003e\u003c/p\u003e\n\n\u003cb\u003e📚 \u003ca href=\"https://muhammad-fiaz.github.io/api.zig/\"\u003eDocumentation\u003c/a\u003e |\n\u003ca href=\"https://muhammad-fiaz.github.io/api.zig/api/\"\u003eAPI Reference\u003c/a\u003e |\n\u003ca href=\"https://muhammad-fiaz.github.io/api.zig/guide/quick-start\"\u003eQuick Start\u003c/a\u003e |\n\u003ca href=\"https://github.com/muhammad-fiaz/api.zig/blob/main/CONTRIBUTING.md\"\u003eContributing\u003c/a\u003e\u003c/b\u003e\n\n\u003c/div\u003e\n\n---\n\n\u003e Note: This Project is in active development. Currently, Breaking changes may occur in every commit. Use at your own risk.\n\n## ✨ Features\n\n- 🚀 **High Performance** - Zero runtime reflection, compile-time route validation\n- ⚡ **Multi-Threaded** - Configurable thread pools for concurrent request handling\n- 📝 **Automatic OpenAPI** - Auto-generated OpenAPI 3.1 specification\n- 🎨 **Swagger UI \u0026 ReDoc** - Built-in interactive API documentation (Swagger UI 5.31.0, ReDoc 2.5.2)\n- 🔒 **Type Safety** - Full compile-time type checking for routes and handlers\n- 🔄 **Concurrency** - Thread-safe request handling with atomic counters\n- 🎯 **GraphQL Support** - Built-in GraphQL Playground with GraphiQL 3.8.3\n- 📦 **Zero Dependencies** - Pure Zig implementation\n- 🌐 **Cross-Platform** - Linux, Windows, macOS\n\n## UI Preview\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n      \u003cimg src=\"https://github.com/user-attachments/assets/2a9141a4-7df1-45fa-846c-daafd2827585\" /\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      \u003cimg src=\"https://github.com/user-attachments/assets/5fc85cce-e346-4fe6-b495-c1931550955e\" /\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n      \u003cimg src=\"https://github.com/user-attachments/assets/d698a2ab-ea85-4fc0-82a6-0ac82a6bb310\" /\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      \u003cimg src=\"https://github.com/user-attachments/assets/47ae9990-0026-4339-877f-0378f8922a2a\" /\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\n\n\n\n## 📦 Installation\n\nAdd `api.zig` to your `build.zig.zon`:\n\n```bash\nzig fetch --save https://github.com/muhammad-fiaz/api.zig/archive/refs/heads/main.tar.gz\n```\n\nThen in your `build.zig`:\n\n```zig\nconst api = b.dependency(\"api\", .{\n    .target = target,\n    .optimize = optimize,\n});\nexe.root_module.addImport(\"api\", api.module(\"api\"));\n```\n\n## 🚀 Quick Start\n\n```zig\nconst std = @import(\"std\");\nconst api = @import(\"api\");\n\nfn hello() api.Response {\n    return api.Response.jsonRaw(\"{\\\"message\\\":\\\"Hello, World!\\\"}\");\n}\n\nfn getUser(ctx: *api.Context) api.Response {\n    const id = ctx.param(\"id\") orelse \"0\";\n    _ = id;\n    return api.Response.jsonRaw(\"{\\\"id\\\":1,\\\"name\\\":\\\"John Doe\\\"}\");\n}\n\npub fn main() !void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer _ = gpa.deinit();\n    const allocator = gpa.allocator();\n\n    var app = api.App.init(allocator, .{\n        .title = \"My API\",\n        .version = \"1.0.0\",\n    });\n    defer app.deinit();\n\n    try app.get(\"/\", hello);\n    try app.get(\"/users/{id}\", getUser);\n\n    // Run with 4 worker threads\n    try app.run(.{ .port = 8000, .num_threads = 4 });\n}\n```\n\nRun your server:\n\n```bash\nzig build run\n```\n\nThen visit:\n\n- **http://localhost:8000/** — Your API\n- **http://localhost:8000/docs** — Swagger UI\n- **http://localhost:8000/redoc** — ReDoc\n\n## ⚡ Multi-Threading\n\napi.zig supports configurable thread pools for maximum performance:\n\n```zig\n// Single-threaded mode (default)\ntry app.run(.{ .port = 8000 });\n\n// Multi-threaded with 4 workers\ntry app.run(.{ .port = 8000, .num_threads = 4 });\n\n// Auto-detect CPU count\ntry app.run(.{ .port = 8000, .num_threads = null });\n```\n\n## 📚 API Reference\n\n### HTTP Methods\n\n```zig\ntry app.get(\"/resource\", handler);\ntry app.post(\"/resource\", handler);\ntry app.put(\"/resource/{id}\", handler);\ntry app.delete(\"/resource/{id}\", handler);\ntry app.patch(\"/resource/{id}\", handler);\n```\n\n### Path Parameters\n\n```zig\nfn getUser(ctx: *api.Context) api.Response {\n    const user_id = ctx.param(\"id\") orelse \"0\";\n    // Use user_id...\n}\n\ntry app.get(\"/users/{id}\", getUser);\n```\n\n### Response Types\n\n```zig\n// JSON response\napi.Response.jsonRaw(\"{\\\"key\\\":\\\"value\\\"}\");\n\n// Text response\napi.Response.text(\"Hello, World!\");\n\n// HTML response\napi.Response.html(\"\u003ch1\u003eHello\u003c/h1\u003e\");\n\n// Error response\napi.Response.err(.not_found, \"{\\\"error\\\":\\\"Not found\\\"}\");\n\n// Redirect\napi.Response.redirect(\"/new-location\");\n```\n\n### Builder Pattern\n\n```zig\napi.Response.text(\"Created\")\n    .setStatus(.created)\n    .setHeader(\"X-Custom\", \"value\")\n    .withCors(\"*\");\n```\n\n## 🧪 Testing\n\nRun the test suite:\n\n```bash\nzig build test\n```\n\n## 🤝 Contributing\n\nContributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 💖 Support\n\nIf you find this project helpful, please consider:\n\n- ⭐ Starring the repository\n- 🐛 Reporting bugs\n- 💡 Suggesting new features\n- 🔀 Submitting pull requests\n","funding_links":["https://github.com/sponsors/muhammad-fiaz"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammad-fiaz%2Fapi.zig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuhammad-fiaz%2Fapi.zig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammad-fiaz%2Fapi.zig/lists"}