{"id":51002584,"url":"https://github.com/muhammad-fiaz/zix","last_synced_at":"2026-06-20T16:32:38.828Z","repository":{"id":353120086,"uuid":"1140600606","full_name":"muhammad-fiaz/zix","owner":"muhammad-fiaz","description":"A fast, modern web framework for Zig.","archived":false,"fork":false,"pushed_at":"2026-01-23T17:12:57.000Z","size":77,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-22T15:40:33.139Z","etag":null,"topics":["web-application","web-development","web-server","zig","zig-lang","zig-language","zig-package","zix","zix-framework","zix-library","zix-web"],"latest_commit_sha":null,"homepage":"","language":"Zig","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/muhammad-fiaz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2026-01-23T14:02:17.000Z","updated_at":"2026-04-21T16:03:08.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/muhammad-fiaz/zix","commit_stats":null,"previous_names":["muhammad-fiaz/zix"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/muhammad-fiaz/zix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fzix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fzix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fzix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fzix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muhammad-fiaz","download_url":"https://codeload.github.com/muhammad-fiaz/zix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muhammad-fiaz%2Fzix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34578089,"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":"online","status_checked_at":"2026-06-20T02:00:06.407Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["web-application","web-development","web-server","zig","zig-lang","zig-language","zig-package","zix","zix-framework","zix-library","zix-web"],"created_at":"2026-06-20T16:32:37.607Z","updated_at":"2026-06-20T16:32:38.798Z","avatar_url":"https://github.com/muhammad-fiaz.png","language":"Zig","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003ca href=\"https://muhammad-fiaz.github.io/zix/\"\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/zix\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/muhammad-fiaz/zix\" alt=\"GitHub stars\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/zix/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/muhammad-fiaz/zix\" alt=\"GitHub issues\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/zix/pulls\"\u003e\u003cimg src=\"https://img.shields.io/github/issues-pr/muhammad-fiaz/zix\" alt=\"GitHub pull requests\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/zix/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/muhammad-fiaz/zix\" alt=\"License\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/muhammad-fiaz/zix/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://github.com/muhammad-fiaz/zix/actions/workflows/ci.yml/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n\n\u003cp\u003e\u003cem\u003eA fast, modern web framework for Zig.\u003c/em\u003e\u003c/p\u003e\n\n\u003cb\u003e\u003ca href=\"https://muhammad-fiaz.github.io/zix/\"\u003eDocumentation\u003c/a\u003e |\n\u003ca href=\"https://muhammad-fiaz.github.io/zix/api/index\"\u003eAPI Reference\u003c/a\u003e |\n\u003ca href=\"https://muhammad-fiaz.github.io/zix/guide/getting-started\"\u003eQuick Start\u003c/a\u003e |\n\u003ca href=\"CONTRIBUTING.md\"\u003eContributing\u003c/a\u003e\u003c/b\u003e\n\n\u003c/div\u003e\n\n## Overview\n\nZix is a modern web framework for the Zig programming language. It provides a familiar, intuitive API for building web applications while leveraging Zig's performance, memory safety, and compile-time guarantees.\n\n\u003e [!NOTE]\n\u003e Zix is a work in progress and Docs are not yet ready but you can use `zig build docs` to generate docs.\n\n**⭐️ If you love `zix`, make sure to give it a star! ⭐️**\n\n## Quick Start\n\n### Installation\n\nAdd Zix to your `build.zig.zon`:\n\n```bash\nzig fetch --save git+https://github.com/muhammad-fiaz/zix\n```\n\nThen in your `build.zig`:\n\n```zig\nconst zix_dep = b.dependency(\"zix\", .{\n    .target = target,\n    .optimize = optimize,\n});\nexe.root_module.addImport(\"zix\", zix_dep.module(\"zix\"));\n```\n\n### Hello World\n\n```zig\nconst std = @import(\"std\");\nconst zix = @import(\"zix\");\n\npub fn main() !void {\n    var gpa = std.heap.GeneralPurposeAllocator(.{}){};\n    defer _ = gpa.deinit();\n    const allocator = gpa.allocator();\n\n    var app = try zix.createApp(allocator, .{\n        .port = 3000,\n    });\n    defer {\n        app.deinit();\n        allocator.destroy(app);\n    }\n\n    try app.get(\"/\", struct {\n        fn handler(ctx: *zix.Context) !void {\n            try ctx.text(\"Hello, World!\");\n        }\n    }.handler);\n\n    try app.get(\"/json\", struct {\n        fn handler(ctx: *zix.Context) !void {\n            try ctx.json(.{ .message = \"Hello!\", .framework = \"Zix\" });\n        }\n    }.handler);\n\n    try app.run();\n}\n```\n\n## Configuration\n\nAll configuration is centralized in a single `Config` struct:\n\n```zig\nvar app = try zix.createApp(allocator, .{\n    .address = \"0.0.0.0\",\n    .port = 8080,\n    .enable_logging = true,\n    .enable_security_headers = true,\n    .cors_enabled = true,\n    .cors_allow_origin = \"*\",\n    .template_dir = \"templates\",\n    .static_dir = \"public\",\n    .static_mount_path = \"/static\",\n    .debug_mode = true,\n});\n```\n\n## Routing\n\n```zig\n// HTTP methods\ntry app.get(\"/users\", listUsers);\ntry app.post(\"/users\", createUser);\ntry app.put(\"/users/:id\", updateUser);\ntry app.patch(\"/users/:id\", patchUser);\ntry app.delete(\"/users/:id\", deleteUser);\n\n// Route parameters\ntry app.get(\"/users/:id\", struct {\n    fn handler(ctx: *zix.Context) !void {\n        const id = ctx.param(\"id\") orelse \"unknown\";\n        try ctx.json(.{ .user_id = id });\n    }\n}.handler);\n\n// Query parameters\ntry app.get(\"/search\", struct {\n    fn handler(ctx: *zix.Context) !void {\n        const query = try ctx.query(\"q\") orelse \"\";\n        const page = try ctx.query(\"page\") orelse \"1\";\n        try ctx.json(.{ .query = query, .page = page });\n    }\n}.handler);\n```\n\n## Middleware\n\n```zig\n// Global middleware\ntry app.use(zix.middleware.securityHeaders());\ntry app.use(zix.middleware.cors());\ntry app.use(zix.middleware.recovery());\n\n// Custom middleware\nconst authMiddleware = struct {\n    fn check(ctx: *zix.Context, next: zix.NextFn) !void {\n        const token = ctx.header(\"Authorization\");\n        if (token == null) {\n            try ctx.unauthorized();\n            ctx.abort();\n            return;\n        }\n        try next(ctx);\n    }\n}.check;\n\ntry app.use(authMiddleware);\n```\n\n## Response Types\n\n```zig\n// Text\ntry ctx.text(\"Hello, World!\");\n\n// HTML\ntry ctx.html(\"\u003ch1\u003eWelcome\u003c/h1\u003e\");\n\n// JSON\ntry ctx.json(.{ .status = \"ok\", .count = 42 });\n\n// Redirect\ntry ctx.redirect(\"/login\");\n\n// File download\ntry ctx.sendFile(\"report.pdf\", \"monthly-report.pdf\");\n\n// Status codes\n_ = ctx.status(201);\ntry ctx.json(.{ .created = true });\n\n// Cookies\ntry ctx.setCookie(.{\n    .name = \"session\",\n    .value = \"abc123\",\n    .max_age = 3600,\n    .http_only = true,\n});\n```\n\n## External Logger\n\nPlug in your own logging backend:\n\n```zig\nfn myLogger(level: zix.Level, message: []const u8, timestamp: i64) void {\n    // Send to your logging service\n    std.debug.print(\"[{s}] {s}\\n\", .{ level.toString(), message });\n}\n\napp.setExternalLogger(myLogger);\n```\n\n## Static Files\n\n```zig\ntry app.static(\"/assets\", \"public\");\n```\n\nFiles in `public/` will be served at `/assets/`:\n- `public/css/style.css` → `/assets/css/style.css`\n- `public/js/app.js` → `/assets/js/app.js`\n\n## Templates\n\n```zig\napp.enableTemplates();\n\ntry app.get(\"/\", struct {\n    fn handler(ctx: *zix.Context) !void {\n        try ctx.render(\"index.html\", .{\n            .title = \"Welcome\",\n            .user = \"Alice\",\n        });\n    }\n}.handler);\n```\n\nTemplate syntax:\n```html\n\u003ch1\u003e{{ title }}\u003c/h1\u003e\n{% if user %}\n  \u003cp\u003eHello, {{ user }}!\u003c/p\u003e\n{% endif %}\n{% for item in items %}\n  \u003cli\u003e{{ item }}\u003c/li\u003e\n{% endfor %}\n```\n\n## Error Handling\n\n```zig\n// Custom 404 handler\napp.notFound(struct {\n    fn handler(ctx: *zix.Context) !void {\n        _ = ctx.status(404);\n        try ctx.json(.{ .error = \"Resource not found\" });\n    }\n}.handler);\n\n// Custom error handler for specific errors\ntry app.errorHandler(\"MyError\", struct {\n    fn handler(ctx: *zix.Context, err: anyerror) anyerror!void {\n        _ = err;\n        try ctx.status(500).json(.{ .error = \"A custom error occurred\" });\n    }\n}.handler);\n```\n\n## Building and Running\n\n```bash\n# Build the library\nzig build\n\n# Run tests\nzig build test\n\n# Build and run examples\nzig build example-basic\nzig build run-basic\n\nzig build example-json-api\nzig build run-json-api\n\n# Generate documentation\nzig build docs\n```\n\n## License\n\nThis project is licensed under the Apache-2.0 License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammad-fiaz%2Fzix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuhammad-fiaz%2Fzix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuhammad-fiaz%2Fzix/lists"}