{"id":15101970,"url":"https://github.com/frankhaugen/frank.bedrockslim","last_synced_at":"2026-01-18T19:01:39.715Z","repository":{"id":213379356,"uuid":"733573169","full_name":"frankhaugen/Frank.BedrockSlim","owner":"frankhaugen","description":"This is using ASP.net core low-level internals to send and receive data in a client-server pattern","archived":false,"fork":false,"pushed_at":"2024-01-21T23:20:23.000Z","size":104,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-01T17:28:35.652Z","etag":null,"topics":["client","dependency-injection","dotnet-core","networking","nuget-package","server"],"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/frankhaugen.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}},"created_at":"2023-12-19T16:23:15.000Z","updated_at":"2024-01-23T20:15:14.000Z","dependencies_parsed_at":"2023-12-20T17:46:41.865Z","dependency_job_id":"0c2fd566-5738-4e4d-b44b-7f3cc7cb80c9","html_url":"https://github.com/frankhaugen/Frank.BedrockSlim","commit_stats":null,"previous_names":["frankhaugen/frank.bedrockslim"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankhaugen%2FFrank.BedrockSlim","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankhaugen%2FFrank.BedrockSlim/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankhaugen%2FFrank.BedrockSlim/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frankhaugen%2FFrank.BedrockSlim/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frankhaugen","download_url":"https://codeload.github.com/frankhaugen/Frank.BedrockSlim/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332520,"owners_count":20921852,"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":["client","dependency-injection","dotnet-core","networking","nuget-package","server"],"created_at":"2024-09-25T18:43:56.069Z","updated_at":"2026-01-18T19:01:39.709Z","avatar_url":"https://github.com/frankhaugen.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Frank.BedrockSlim\n___\nThe purpose of this project is to provide a starting point for building a web application using the Bedrock Framework. It is intended to be used as a starting point for building servers and clients, using minimal dependencies, and providing a simple, consistent, and easy to use API.\n\nASP.NET Core is the core of this library, but very little of the actual \"basics\" are added, so its only providing \"server infrastructure\" and \"client infrastructure\" for the most part. The rest is up to you.\n\n___\n\n![Nuget](https://img.shields.io/nuget/v/Frank.BedrockSlim.Server?label=Server\u0026style=for-the-badge)\n![Nuget](https://img.shields.io/nuget/v/Frank.BedrockSlim.Client?label=Client\u0026style=for-the-badge)\n\n![Nuget](https://img.shields.io/nuget/dt/Frank.BedrockSlim.Server?label=Server\u0026style=for-the-badge)\n![Nuget](https://img.shields.io/nuget/dt/Frank.BedrockSlim.Client?label=Client\u0026style=for-the-badge)\n\n\n\n___\n## Table of Contents\n\n- [Getting Started](#getting-started)\n  - [Installing](#installing)\n  - [Sample Projects](#sample-projects)\n  - [Server](#server)\n  - [Client](#client)\n  - [Lack of Tests](#lack-of-tests)\n\n___\n\n## Getting Started\n\n### Installing\n\nTo install the latest version of this library, run one or both of the following commands:\n\n```bash\ndotnet add package Frank.BedrockSlim.Server\ndotnet add package Frank.BedrockSlim.Client\n```\n\n### Sample Projects\n\nThere are two sample projects included in this repository, one for the server, and one for the client. They are both console applications, and can be used to test the library.\n\nTo run the sample projects, just run the following commands run the 'run-samples.ps1' script:\n\n```bash\npwsh ./run-samples.ps1\n```\n\nThe script will build the library, and then run the server saple project and wait 5 seconds before running the client sample project, then close them after 15 seconds.\n\n### Server\n\nThe server is a simple console application that hosts a web server. It is configured using the `Host.CreateDefaultBuilder` method, which provides a default configuration, logging, and dependency injection setup. The `ConfigureWebHostDefaults` method configures the web host using the `Startup` class, which is where you can configure the server.\n\n#### Program.cs\n\n```csharp\nvar builder = WebApplication.CreateEmptyBuilder(new WebApplicationOptions( ));\nbuilder.UseTcpConnectionHandler\u003cMyCustomProcessor\u003e(6667);\nbuilder.Logging.AddConsole();\nvar app = builder.Build();\nawait app.RunAsync();\n```\n\n#### MyCustomProcessor.cs\n\n```csharp\npublic class MyCustomProcessor : IConnectionProcessor\n{\n    private readonly ILogger\u003cMyCustomProcessor\u003e _logger;\n\n    public MyCustomProcessor(ILogger\u003cMyCustomProcessor\u003e logger)\n    {\n        _logger = logger;\n    }\n\n    public async Task\u003cReadOnlyMemory\u003cbyte\u003e\u003e ProcessAsync(ReadOnlyMemory\u003cbyte\u003e input)\n    {\n        var stringInput = Encoding.UTF8.GetString(input.ToArray());\n        _logger.LogInformation(\"Received: {Input}\", stringInput);\n        return new ReadOnlyMemory\u003cbyte\u003e(\"OK\"u8.ToArray());\n    }\n}\n```\n\n### Client\n\nThe client is a simple interface called `ITcpClient` that provides a simple API for connecting to a server and sending and receiving data. It has an extension method called `AddTcpClient` that can be used to configure the client in your `Startup` class or `Program` class.\n\n#### Program.cs\n\n```csharp\nvar builder = Host.CreateApplicationBuilder(args);\nbuilder.Services.AddTcpClient(options =\u003e\n{\n    options.Timeout = TimeSpan.FromSeconds(5);\n});\n\nbuilder.Services.AddHostedService\u003cWorker\u003e();\n\nvar host = builder.Build();\nhost.Run();\n```\n\n#### Worker.cs\n\n```csharp\npublic class Worker : BackgroundService\n{\n    private readonly ILogger\u003cWorker\u003e _logger;\n    private readonly ITcpClient _tcpClient;\n\n    public Worker(ILogger\u003cWorker\u003e logger, ITcpClient tcpClient)\n    {\n        _logger = logger;\n        _tcpClient = tcpClient;\n    }\n\n    protected override async Task ExecuteAsync(CancellationToken stoppingToken)\n    {\n        while (!stoppingToken.IsCancellationRequested)\n        {\n            if (_logger.IsEnabled(LogLevel.Information))\n            {\n                var response = await _tcpClient.SendAsync(IPAddress.Loopback, 6667, \"Hello World\"u8.ToArray());\n                \n                if (response.Length \u003e 0)\n                {\n                    _logger.LogInformation(\"Received: {Response}\", Encoding.UTF8.GetString(response.ToArray()));\n                }\n            }\n\n            await Task.Delay(1000, stoppingToken);\n        }\n    }\n}\n```\n___\n\n## Lack of Tests\n\nExcept for the sample projects, there are no tests. This is because theres very little to test. The XUnit project is there to make it easy to start testing, but the actual test cases are not very clear at this time.\n___\n## Contributing\n\nNot all contributions are code! We welcome contributions from everyone, but please see our [contributing guide](CONTRIBUTING.md) for more information.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrankhaugen%2Ffrank.bedrockslim","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrankhaugen%2Ffrank.bedrockslim","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrankhaugen%2Ffrank.bedrockslim/lists"}