{"id":22886317,"url":"https://github.com/imclint21/initium","last_synced_at":"2025-04-14T23:08:05.404Z","repository":{"id":267126370,"uuid":"900338574","full_name":"imclint21/Initium","owner":"imclint21","description":"Initium is a .NET library that simplifies building APIs by standardizing service management, routing, and response handling.","archived":false,"fork":false,"pushed_at":"2025-01-10T13:14:36.000Z","size":75,"stargazers_count":2,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-14T23:07:57.373Z","etag":null,"topics":["api-design","api-development","api-rest","aspnetcore","csharp-extensions","dotnet","framework","microservice","middleware","prometheus","saas","saas-api","saas-boilerplate"],"latest_commit_sha":null,"homepage":"","language":"C#","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/imclint21.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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}},"created_at":"2024-12-08T14:25:20.000Z","updated_at":"2025-01-10T13:14:39.000Z","dependencies_parsed_at":"2024-12-08T15:18:25.947Z","dependency_job_id":"408af900-52db-453a-83ba-caeb55fcf73c","html_url":"https://github.com/imclint21/Initium","commit_stats":null,"previous_names":["imclint21/initium"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imclint21%2FInitium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imclint21%2FInitium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imclint21%2FInitium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imclint21%2FInitium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imclint21","download_url":"https://codeload.github.com/imclint21/Initium/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975316,"owners_count":21192209,"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":["api-design","api-development","api-rest","aspnetcore","csharp-extensions","dotnet","framework","microservice","middleware","prometheus","saas","saas-api","saas-boilerplate"],"created_at":"2024-12-13T20:17:45.792Z","updated_at":"2025-04-14T23:08:05.385Z","avatar_url":"https://github.com/imclint21.png","language":"C#","readme":"# Initium — Service Core Foundation\n\n[![Publish NuGet](https://github.com/imclint21/Initium/actions/workflows/publish.yml/badge.svg?branch=master)](https://github.com/imclint21/Initium/actions/workflows/publish.yml)\n![DotNet](https://img.shields.io/badge/.NET-8.0%20LTS-blue)\n![MIT License](https://img.shields.io/badge/license-MIT-lightgrey.svg)\n[![NuGet Version](https://img.shields.io/nuget/v/Initium)](https://www.nuget.org/packages/Initium/)\n\n## Introduction\n\nInitium is a library for simplifying .NET API development, offering standardized service operations, flexible routing, and seamless chaining of service results for cleaner and more maintainable code.\n\n- **Streamlined API Controllers**: Simplifies response handling with attributes like `[ApiResponse]`, providing clear and consistent HTTP status documentation.\n- **Centralized Result Management**: `ServiceResult` enables clear success or failure status, making error handling and conditional logic seamless.\n- **Exception Handling Made Easy**: `ApiException` provides a straightforward way to handle specific HTTP error codes, improving code clarity.\n- **Result Chaining**: Methods return `ServiceResult` or typed results, allowing for intuitive chaining and cleaner service logic.\n- **Enhanced Maintainability**: Standardized patterns reduce boilerplate code, making APIs easier to build, understand, and maintain.\n\n## Getting Started\n\nTo get started with Initium, just add the package using NuGet:\n\n```bash\ndotnet add package Initium\n```\n\n## How it Works?\n\nHere's how to create a controller :\n\n```csharp\npublic class CoffeeController(CoffeeService service) : ApiController\n{\n    [HttpPost]\n    [ApiResponse(200, \"Coffee prepared successfully.\")]\n    [ApiResponse(400, \"An error occurred during the preparation process.\")]\n    public ActionResult PrepareCoffee() =\u003e service.PrepareCoffee();\n}\n```\nAnd here's how to create an action in a service, each function returns a `ServiceResult`, and can be chained.\n\n```csharp\npublic class CoffeeService\n{\n    public ServiceResult DoSomething()\n    {\n        return ServiceResult.Error(\"Something happened!\", HttpStatusCode.Conflict);\n    }\n\n    public ServiceResult PrepareCoffee()\n    {\n        var doSomethingResult = DoSomething();\n        if (doSomethingResult == false) return doSomethingResult;\n        \n        return ServiceResult.Ok(\"The coffee is now DONE!\");\n    }\n}\n```\n\n## Contribute to Initium\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for best practices and instructions on setting up your development environment to work on Initium.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimclint21%2Finitium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimclint21%2Finitium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimclint21%2Finitium/lists"}