{"id":39505390,"url":"https://github.com/0mjs/zinc","last_synced_at":"2026-03-07T00:03:33.421Z","repository":{"id":276518429,"uuid":"922623801","full_name":"0mjs/zinc","owner":"0mjs","description":"A simple, fast, Go HTTP framework inspired by Express.js.","archived":false,"fork":false,"pushed_at":"2025-06-15T00:07:25.000Z","size":23437,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2026-01-18T15:22:09.001Z","etag":null,"topics":["framework","golang","open-source"],"latest_commit_sha":null,"homepage":"https://zinc.0mjs.dev","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0mjs.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":"2025-01-26T17:39:44.000Z","updated_at":"2026-01-13T10:34:54.000Z","dependencies_parsed_at":"2025-03-16T00:33:14.077Z","dependency_job_id":null,"html_url":"https://github.com/0mjs/zinc","commit_stats":null,"previous_names":["0mjs/zinc"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/0mjs/zinc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0mjs%2Fzinc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0mjs%2Fzinc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0mjs%2Fzinc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0mjs%2Fzinc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0mjs","download_url":"https://codeload.github.com/0mjs/zinc/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0mjs%2Fzinc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30204113,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"ssl_error","status_checked_at":"2026-03-06T18:57:34.882Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["framework","golang","open-source"],"created_at":"2026-01-18T05:53:09.738Z","updated_at":"2026-03-07T00:03:33.408Z","avatar_url":"https://github.com/0mjs.png","language":"Go","readme":"# zinc\n\n![Zinc](https://img.shields.io/badge/Zinc-%20A%20web%20framework%20for%20Go-silver)\n![Version](https://img.shields.io/badge/version-0.0.58-red)\n![Go Version](https://img.shields.io/badge/Go-1.22+-blue)\n![License](https://img.shields.io/badge/license-MIT-green)\n\nZinc is a high-performance, minimal API framework for Go that focuses on speed, simplicity, and developer velocity. Designed to compete with the most popular frameworks around today in performance and usability.\n\n## Features\n\n- **Fast**: Optimized routing and minimal middleware overhead\n- **Simple API**: Intuitive and expressive API that follows Go idioms\n- **Powerful Router**: Support for static routes, path parameters, route groups, and middleware\n- **Template Engine**: Built-in HTML templating with custom functions and template caching\n- **WebSocket Support**: Real-time communication with room-based broadcasting\n- **File Uploads**: Easy file upload handling with size limits and type validation\n- **Cron Scheduler**: Built-in cron jobs for scheduled tasks\n- **Memory Efficient**: Utilizes sync.Pool and fixed-size data structures to minimize allocations\n- **Well-Tested**: Comprehensive test suite ensures reliability\n\n## Installation\n\n```bash\ngo get github.com/0mjs/zinc\n```\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n    \"github.com/0mjs/zinc\"\n    \"log\"\n)\n\nfunc main() {\n    app := zinc.New()\n    \n    // Simple route\n    app.Get(\"/\", func(c *zinc.Context) {\n        c.Send(\"Hello, World!\")\n    })\n    \n    // Path parameters\n    app.Get(\"/users/:id\", func(c *zinc.Context) {\n        c.JSON(zinc.Map{\n            \"message\": \"User ID: \" + c.Param(\"id\"),\n        })\n    })\n    \n    // Route grouping\n    api := app.Group(\"/api\")\n    api.Get(\"/users\", func(c *zinc.Context) {\n        c.JSON(zinc.Map{\n            \"users\": []string{\"matthew\", \"mark\", \"luke\", \"john\"},\n        })\n    })\n    \n    // Middleware\n    app.Use(LoggerMiddleware())\n    \n    log.Fatal(app.Serve())\n}\n\nfunc LoggerMiddleware() zinc.Middleware {\n    return func(c *zinc.Context) {\n        // Log before request handling\n        c.Next() // Pass control to the next middleware or handler\n        // Log after request handling\n    }\n}\n```\n\n## Documentation\n\nFor complete documentation, visit:\n\n- [Pkg.go.dev Documentation](https://pkg.go.dev/github.com/0mjs/zinc)\n- [Zinc Docs](https://github.com/0mjs/zinc/docs](https://zinc.0mjs.dev/)\n\n## Benchmarks\n\nZinc is designed for high performance, with benchmarks showing it to be competitive with or faster than other popular Go frameworks:\n\n- Static routes: ~800ns/op\n- Dynamic routes: ~1.2μs/op\n- Middleware chain: ~2.0μs/op\n\n## Typed Service Dependency Injection\n\nZinc provides a powerful type-safe service dependency injection system that allows you to register and retrieve services by their concrete types.\n\n### Registering Services\n\nYou can register services using either the string-based approach or the new type-based approach:\n\n```go\n// String-based service registration (legacy)\napp.Service(\"userService\", userService)\n\n// Type-based service registration (recommended)\napp.Register(userService)\n```\n\n### Retrieving Services\n\nThere are several ways to retrieve services:\n\n1. String-based retrieval (legacy):\n\n```go\nuserService := c.Service(\"userService\").(*UserService)\n```\n\n2. Type-based retrieval using generics:\n\n```go\n// From App instance\nuserService, ok := zinc.ServiceOf[*UserService](app)\nif !ok {\n    // Handle service not found\n}\n\n// From Context\nuserService, ok := zinc.ContextServiceOf[*UserService](c)\nif !ok {\n    // Handle service not found\n}\n```\n\nThe type-based approach provides several advantages:\n- Compile-time type safety\n- No need for type assertions\n- No string literals that could contain typos\n- Better IDE support with code completion\n\n### Examples\n\n#### Basic Usage\n\n```go\n// Register a service\napp.Register(userService)\n\n// Use the service in a handler\napp.Get(\"/users\", func(c *zinc.Context) error {\n    service, ok := zinc.ContextServiceOf[*UserService](c)\n    if !ok {\n        return c.Status(zinc.StatusInternalServerError).String(\"Service not available\")\n    }\n    return service.GetUsers(c)\n})\n```\n\n#### Using Services in Middleware\n\nServices can be accessed directly from middleware functions:\n\n```go\n// Middleware that uses typed services\nauthMiddleware := func(c *zinc.Context) error {\n    // Access the auth service directly from context\n    authService, ok := zinc.ContextServiceOf[*AuthService](c)\n    if !ok {\n        return c.Status(zinc.StatusInternalServerError).String(\"Auth service not available\")\n    }\n    \n    // Use the service\n    token := c.Request.Header.Get(\"Authorization\")\n    if err := authService.ValidateToken(token); err != nil {\n        return c.Status(zinc.StatusUnauthorized).String(\"Invalid token\")\n    }\n    \n    // Continue with the next handler\n    return c.Next()\n}\n\n// Apply the middleware to routes or groups\napp.Get(\"/protected\", authMiddleware, func(c *zinc.Context) error {\n    return c.String(\"Protected resource\")\n})\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0mjs%2Fzinc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0mjs%2Fzinc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0mjs%2Fzinc/lists"}