{"id":16715560,"url":"https://github.com/stijnmoreels/fprimitive","last_synced_at":"2025-03-21T20:33:58.157Z","repository":{"id":61603344,"uuid":"183746505","full_name":"stijnmoreels/FPrimitive","owner":"stijnmoreels","description":".NET project to help developers to build a correct and more safe domain model","archived":false,"fork":false,"pushed_at":"2024-03-20T05:52:49.000Z","size":14650,"stargazers_count":32,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-18T05:08:55.054Z","etag":null,"topics":["boundaries","ddd","domain","fsharp","immutable","model","primitive","secure","trust","types","untrusted"],"latest_commit_sha":null,"homepage":"https://stijnmoreels.github.io/FPrimitive/","language":"F#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stijnmoreels.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2019-04-27T08:13:51.000Z","updated_at":"2025-02-26T04:37:23.000Z","dependencies_parsed_at":"2024-03-20T06:47:30.827Z","dependency_job_id":null,"html_url":"https://github.com/stijnmoreels/FPrimitive","commit_stats":{"total_commits":110,"total_committers":2,"mean_commits":55.0,"dds":0.009090909090909038,"last_synced_commit":"5e6cf6ea68a98d8f4087b814a9ce1e6cfdeb91ab"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stijnmoreels%2FFPrimitive","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stijnmoreels%2FFPrimitive/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stijnmoreels%2FFPrimitive/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stijnmoreels%2FFPrimitive/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stijnmoreels","download_url":"https://codeload.github.com/stijnmoreels/FPrimitive/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244866471,"owners_count":20523520,"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":["boundaries","ddd","domain","fsharp","immutable","model","primitive","secure","trust","types","untrusted"],"created_at":"2024-10-12T21:09:47.551Z","updated_at":"2025-03-21T20:33:57.183Z","avatar_url":"https://github.com/stijnmoreels.png","language":"F#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![NuGet Badge](https://buildstats.info/nuget/fprimitive)](https://www.nuget.org/packages/fprimitive)\n[![codecov](https://codecov.io/gh/stijnmoreels/FPrimitive/branch/main/graph/badge.svg?token=QQ1FKUU3HP)](https://codecov.io/gh/stijnmoreels/FPrimitive)\n\n# FPrimitive\n\nFPrimitive is a .NET project to help developers build a correct and more secure domain model by providing building blocks, standard types and trust boundaries.\n\n\u003cimg src=\"/docs/img/logo.png\" width=100 height=100 alt=\"logo\" /\u003e\n\n## Build Status\n\n| Mono                                                                                                                              | .NET                                                                                                                                                   |\n| --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |\n| [![Build Status](https://travis-ci.org/stijnmoreels/FPrimitive.svg?branch=master)](https://travis-ci.org/stijnmoreels/FPrimitive) | [![.NET Build status](https://ci.appveyor.com/api/projects/status/2ijw1am46pyhqnur?svg=true)](https://ci.appveyor.com/project/stijnmoreels/fprimitive) |\n\n## Documentation\nThe project has a wiki page with further information and some additional resources are also listed here:\n* [Library Documentation Page](https://stijnmoreels.github.io/FPrimitive)\n* [Domain-Driven Security w/ F# FPrimitive \u0026 C# Interop](https://www.codit.eu/blog/domain-driven-security-with-f-fprimitive-and-c-interop/)\n* [From Untrusted Input to Strict Model w/ Layered JSON Parsing in F# FPrimitive](https://www.codit.eu/blog/from-untrusted-input-to-strict-model-with-layered-json-parsing-in-f-fprimitive-c/)\n\n## Examples\nThe project contains several reusable building blocks to make your domain model more correct and therefore more secure.\n\n\n```fsharp\nopen FPrimitive\n\n/// Composible specifications for your domain types:\ntype NonEmptyString =\n  private NonEmptyString of string with\n    static member create x : Result\u003cNonEmptyString, Map\u003cstring, string list\u003e\u003e =\n      Spec.def\u003cstring\u003e\n      |\u003e Spec.notNull \"should not be null\"\n      |\u003e Spec.notEmpty \"should not be empty\"\n      |\u003e Spec.createModel NonEmptyString x\n\n/// ...also available as computation expression.\ntype NonEmptyList\u003c'a\u003e =\n  private NonEmptyList of 'a list with\n    static member create xs : Result\u003cNonEmptyList\u003c'a\u003e, Map\u003cstring, string list\u003e\u003e =\n      specModel NonEmptyList xs {\n        nonEmpty \"list should not be empty\"\n        lengthBetween 1 10 \"list length should be between 1-10\" }\n\n/// Access controllers for your critical application resources:\nlet uncontrolled_critical = ignore\nlet critical =\n  Access.func uncontrolled_critical\n  |\u003e Access.once\n  |\u003e Access.duringHours 9 17\n  |\u003e Access.revokable\n\n/// Try to evaluate\nAccess.eval () critical\n/// Revoke when neccessary\nAccess.revoke critical\n```\n\nWith full C# support!\n\n```csharp\nusing FPrimitive;\n\npublic class PositiveInt\n{\n    private PrositiveInt(int value) { Value = int; }\n\n\tpublic int value { get; }\n\n\tpublic static ValidationResult\u003cPositiveInt\u003e Create(int value)\n\t{\n\t\treturn Spec.Of\u003cint\u003e()\n\t\t\t   .GreaterThan(0, \"Positive integer should be greater than zero\")\n\t\t\t   .CreateModel(value, validated =\u003e new PositiveInt(validated));\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstijnmoreels%2Ffprimitive","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstijnmoreels%2Ffprimitive","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstijnmoreels%2Ffprimitive/lists"}