A modular, production-ready C#/.NET utility library and toolkit for rapid development.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
CommonUtilities is a modular, production-ready C#/.NET utility library and toolkit designed to accelerate development for .NET 8+ projects. It contains a broad set of helpers, models, and utilities for common application needs (security, data, HTTP, scheduling, media, cloud integrations, and more). The codebase is organized for easy consumption as a project reference or compiled library.
This README was created from the project's template and repository contents.
- Security: AES, SHA256, signature and related helpers
- Data: Conversion, formatting, JSON file utilities
- HTTP: Basic and advanced HTTP helpers
- System: App settings, caching, file/process utilities, logging helpers
- Scheduler: Cron job helpers, scheduled services, SyncService base
- Media: Image helpers, Dropbox/image helpers, QR code generation
- Integrations: Stripe, Cloudflare captcha, Google AI, Google Drive, Google MFA
- Mailer: SMTP/mail helpers
- Utilities: Command helpers, enum helpers, IP info lookup
Use this project by referencing the CommonUtilities project in your solution or by building the library and consuming the DLL.
- Clone the repository:
git clone https://github.com/LoveDoLove/CS_CommonUtilities.git- Restore packages and build:
dotnet restore
dotnet build- Add
CommonUtilities\CommonUtilities.csprojas a project reference in your solution or copy the compiled DLL frombin/.
Many helpers require configuration via appsettings.json (or appsettings.Development.json). Example configuration keys used in this repo:
{
"Smtp": {
/* mailer */
},
"CfCaptcha": {
/* cloudflare captcha */
},
"IpInfo": {
/* ipinfo token */
},
"Stripe": {
/* api keys */
}
}See appsettings.json and appsettings.Development.json in the repo root for concrete examples.
Examples below show common usage patterns. Refer to source XML comments for full API details.
using CommonUtilities.Utilities.Security;
string encrypted = AesUtilities.Encrypt("mydata", "password");
string hash = Sha256Utilities.ComputeHash("mydata");using CommonUtilities.Helpers.Mailer;
using Microsoft.Extensions.Configuration;
var config = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
var smtpConfig = config.GetSection("Smtp").Get<Mailer.MailerConfig>();
var mailer = new Mailer.MailerHelper(smtpConfig);
await mailer.SendAsync("to@example.com", "Subject", "Body");using CommonUtilities.Helpers.Stripe;
var cfg = new Stripe.StripeConfig { ApiKey = "sk_test_xxx" };
var stripe = new Stripe.StripeHelper(cfg);
// use stripe methodsTop-level folders and a short description (see repository for full details):
CommonUtilities/Helpers/— helper classes grouped by feature (Mailer, Stripe, GoogleDrive, Security, Media, etc.)CommonUtilities/Models/— shared models and constantsCommonUtilities/Utilities/— lower-level utilities (Data, Http, Security, System helpers)CommonUtilities/Services/— background services and SyncService baseappsettings.json/appsettings.Development.json— configuration samples
Use these namespaces in your projects to call the helpers directly.
Contributions are welcome. To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/MyFeature) - Commit your changes (
git commit -m "Add feature") - Push to your branch (
git push origin feature/MyFeature) - Open a Pull Request
Please follow standard .NET best practices and include unit tests where appropriate.
Distributed under the MIT License. See LICENSE for details.
LoveDoLove — GitHub
Project Link: https://github.com/LoveDoLove/CS_CommonUtilities