A versatile collection of C# utilities and extensions designed to supercharge any .NET project. Born from the HappyCapy project, now open for the community.
Find a file
2026-07-07 01:56:58 -05:00
CapyKit Migrating to docfx 2026-07-01 23:03:53 -05:00
Docs Generate API docs as markdown 2026-07-07 01:56:58 -05:00
Tests Added KeyGen, Fixed Bugs, Fixed Tests 2025-02-14 04:52:55 -06:00
.gitignore Update .gitignore 2025-01-29 23:58:51 -06:00
LICENSE Initial commit 2024-04-09 22:31:13 -05:00
README.md Improve developer documentation 2026-07-07 01:31:52 -05:00

CapyKit

CapyKit is a practical .NET utility library for the small pieces of application code that tend to get rewritten from project to project. It includes focused helpers for strings, collections, serialization, compression, password hashing, random value generation, key validation, calculations, resource pooling, and lightweight library diagnostics.

The project started as shared infrastructure for HappyCapy and is now packaged as a standalone toolkit for .NET 8 applications.

What Is Included

  • Extension methods for strings, enums, objects, and LINQ collections.
  • JSON serialization and gzip compression helpers.
  • PBKDF2 password hashing, salt generation, and random token/password generation.
  • HMAC-backed formatted key generation and validation.
  • Distance, unit conversion, angle conversion, and quick hash helpers.
  • A simple resource pool abstraction.
  • CapyEventReporter for routing CapyKit warnings and errors into your own logging system.
  • A generated DocFX API reference for the public surface area.

Install

dotnet add package CapyKit

For local development from this repository:

dotnet add reference ./CapyKit/CapyKit.csproj

Quick Example

using CapyKit;
using CapyKit.Extensions;
using CapyKit.Helpers;

var name = incomingName.IfNullOrWhiteSpace("Guest");
var page = users.Page(pageNumber: 1, pageSize: 25);

Password password = SecurityHelper.Pbkdf2("correct horse battery staple");
bool matches = SecurityHelper.CompareHashedPassword(
    password,
    "correct horse battery staple",
    password.Salt,
    Password.Pbkdf2Algorithm);

Documentation

The in-repository documentation starts at Docs/index.md. It includes an introduction, getting-started guide, and links into the generated DocFX API reference.

To build and serve the documentation locally:

dotnet tool install -g docfx
docfx Docs/docfx.json --serve

DocFX writes the generated site to Docs/_site.

Project Status

CapyKit is a growing utility library. Some APIs are mature and covered by tests, while others are still being rounded out as the project transitions from private shared code into a public package. Review the generated API reference and tests when adopting a helper in production code.

License

This project is licensed under the terms in LICENSE.