Skip to content

Repository files navigation

D2

Apache-2.0 libraries for .NET and TypeScript — errors-as-values, typed error catalogs, auth vocabulary & request context, resilient callers, tiered caches, payload encryption, RabbitMQ messaging, geo & reference data, contacts & location value objects, validation, i18n, handlers, ASP.NET helpers, logging & OpenTelemetry — as installable NuGet and npm packages.

This repo is portable app-building libs only. Full inbound JWT runtime, host mega-aggregators, product boundary gRPC clients, IDL/codegen factory tools, and other product-specific composition kits are not published here (they are not part of this open library surface).

License Apache License 2.0
NuGet DcsvIo.D2.*
npm @dcsv-io/d2-*
Releases GitHub Releases
Issues GitHub Issues
Open inventory 46 versioned NuGet packages · 32 npm packages (catalog source-gen shells may exist on disk for parents; they are not separate publish rows)
# .NET
dotnet add package DcsvIo.D2.Result

# TypeScript
pnpm add @dcsv-io/d2-result

See also: DcsvIo.D2.Result · @dcsv-io/d2-result


What you get

D2 is a set of composable libraries, not a single app or host. Install what you need and wire it into your services.

You need… D2 gives you…
Errors without exception soup DcsvIo.D2.Result / @dcsv-io/d2-result — typed success/failure, semantic factories, i18n-ready user messages
Stable error codes across languages Spec-driven catalogs → DcsvIo.D2.ErrorCodes.Registry / @dcsv-io/d2-error-codes-registry that stay in lockstep
Portable auth vocabulary DcsvIo.D2.Auth.Abstractions + AuthContext.Abstractions — scopes, audiences, JWT claims, JWKS/session ports (full inbound JWT runtime is product composition, not an open install package)
Safe workload identity DcsvIo.D2.Spiffe — SPIFFE SAN / trust-domain grammar for mTLS peers
Caches that stay coherent DcsvIo.D2.Caching.* / @dcsv-io/d2-caching-* — local, Redis, tiered + invalidation backplane
Encrypted async messaging DcsvIo.D2.Messaging.RabbitMq / @dcsv-io/d2-messaging-rabbitmq + DcsvIo.D2.Encryption / @dcsv-io/d2-encryption
PII that doesn’t leak into logs DcsvIo.D2.Logging, DcsvIo.D2.Contacts, DcsvIo.D2.DataGovernance.*
Geo & world reference data DcsvIo.D2.Geo.Default / @dcsv-io/d2-geo-default — full typed catalogs for countries, subdivisions, currencies, languages, locales, timezones, and geopolitical entities, with O(1) lookups, nested accessors (e.g. Subdivisions.US.NY), cross-links between catalogs, and free-text name resolution — driven from contracts/geo/ on both stacks
Locations you can store and dedupe DcsvIo.D2.Location — coordinates (lat/lon, geohash, plus-code), street addresses, admin hierarchy, content-addressable hashes
Contact details as value objects DcsvIo.D2.Contacts — personal name, affixes, demographics, professional, email, phone — smart constructors, redaction-aware
Validation that matches on both stacks DcsvIo.D2.Validation / @dcsv-io/d2-validation — email, phone (E.164), postal codes
i18n you can type-check DcsvIo.D2.I18n.Keys / @dcsv-io/d2-i18n-keys + runtimes
Handlers with observability baked in DcsvIo.D2.Handler — scopes, OTel, log scope, universal catch
ASP.NET Core host helpers DcsvIo.D2.AspNetCore — CORS, health, ProblemDetails, mTLS helpers (full host mega-aggregators stay product composition, not this package)

Same specs under contracts/ drive much of the .NET and TypeScript surface, so catalogs and wire shapes don’t drift.

Full per-package docs live next to the code:


Packages at a glance

Package IDs: NuGet DcsvIo.D2.<Name> · npm @dcsv-io/d2-<name>
(early packages may still be pre-stable 0.x — check the registry for current versions.)

Every package name below is a link to that package’s README.

Core & control flow

Concern .NET TypeScript Why it matters
Results DcsvIo.D2.Result · DcsvIo.D2.Result.Grpc @dcsv-io/d2-result Errors-as-values; semantic factories instead of throw/catch control flow
Error categories & registry DcsvIo.D2.ErrorCodes.Category · DcsvIo.D2.ErrorCodes.Registry @dcsv-io/d2-error-category · @dcsv-io/d2-error-codes-registry One closed category set + merged code→metadata lookup
Utilities DcsvIo.D2.Utilities @dcsv-io/d2-utilities Falsey/Truthy, parse helpers, safe JSON — shared boundary habits
Resilience DcsvIo.D2.Resilience @dcsv-io/d2-resilience Retry, circuit breaker, single-flight, timeout — opt-in caller-side
Time DcsvIo.D2.Time @dcsv-io/d2-time Injectable clock + temporal types with cross-runtime parity fixtures
Problem Details DcsvIo.D2.ProblemDetails.Abstractions @dcsv-io/d2-problem-details-abstractions RFC 7807 catalog (type URI, extension keys, titles)

Auth, identity & context

Concern .NET TypeScript Why it matters
Auth vocabulary DcsvIo.D2.Auth.Abstractions @dcsv-io/d2-auth-abstractions Scopes, audiences, claims catalogs + JWKS/session ports (JWT runtime middleware is host-supplied)
Auth / request context DcsvIo.D2.AuthContext.Abstractions · DcsvIo.D2.Context.Abstractions @dcsv-io/d2-auth-context-abstractions · @dcsv-io/d2-request-context-abstractions Who is calling, org, scopes — and how context hops safely
Workload identity DcsvIo.D2.Spiffe SPIFFE SAN + trust-domain grammar for mTLS peers
Wire headers DcsvIo.D2.Headers.Common · DcsvIo.D2.Headers.Http · DcsvIo.D2.Headers.Grpc · DcsvIo.D2.Headers.Amqp @dcsv-io/d2-headers-common · @dcsv-io/d2-headers-http · @dcsv-io/d2-headers-grpc · @dcsv-io/d2-headers-amqp One catalog for HTTP / gRPC / AMQP header names (route-guard helpers are host-supplied)

Caching, crypto & messaging

Concern .NET TypeScript Why it matters
Cache ports DcsvIo.D2.Caching.Abstractions @dcsv-io/d2-caching-abstractions Local / distributed / tiered markers; every op returns D2Result
Local / Redis / tiered DcsvIo.D2.Caching.Local.Default · DcsvIo.D2.Caching.Distributed.Redis · DcsvIo.D2.Caching.Tiered @dcsv-io/d2-caching-local-default · @dcsv-io/d2-caching-distributed-redis · @dcsv-io/d2-caching-tiered L1 + Redis L2 + broadcast invalidation (d2:cache:invalidations)
Encryption DcsvIo.D2.Encryption @dcsv-io/d2-encryption · @dcsv-io/d2-encryption-abstractions AES-256-GCM + sealed ECDH frames; KAT-pinned cross-language
Messaging DcsvIo.D2.Messaging.Abstractions · DcsvIo.D2.Messaging.RabbitMq @dcsv-io/d2-messaging-abstractions · @dcsv-io/d2-messaging-rabbitmq Topology, encrypt-on-publish, DLQ metadata, idempotency seam

Domain value objects & reference data

Concern .NET TypeScript Why it matters
Geo types & codes DcsvIo.D2.Geo.Abstractions @dcsv-io/d2-geo-abstractions Typed codes/records for countries, subdivisions, currencies, languages, locales, timezones, geopolitical entities; name resolution helpers
Geo catalog data DcsvIo.D2.Geo.Default @dcsv-io/d2-geo-default Full generated data for all seven catalogs — lookups, nested accessors, cross-catalog links
Location DcsvIo.D2.Location · DcsvIo.D2.Location.EntityFrameworkCore Coordinates, street address, admin location; hash-deduplicatable
Contacts DcsvIo.D2.Contacts · DcsvIo.D2.Contacts.EntityFrameworkCore Name, email, phone, demographics, professional — composable, redaction-aware
Validation DcsvIo.D2.Validation · DcsvIo.D2.Validation.Abstractions @dcsv-io/d2-validation · @dcsv-io/d2-validation-abstractions Email / phone / postal — shared fixture corpus
Data governance DcsvIo.D2.DataGovernance.Abstractions · DcsvIo.D2.DataGovernance.EntityFrameworkCore GDPR-style anonymization markers + EF wiring
EF helpers DcsvIo.D2.EntityFrameworkCore · DcsvIo.D2.EntityFrameworkCore.Postgres Migrations, advisory-lock startup, complex-property indexes

Handlers, host & observability

Concern .NET TypeScript Why it matters
Handler pipeline DcsvIo.D2.Handler · DcsvIo.D2.Handler.Abstractions · DcsvIo.D2.Handler.Repo · DcsvIo.D2.Handler.Repo.Abstractions · DcsvIo.D2.Handler.Repo.Postgres Scope checks, OTel, logging, DB exception → D2Result
ASP.NET Core DcsvIo.D2.AspNetCore Security headers, CORS, health, ProblemDetails, mTLS helpers (host mega-aggregators are host-supplied)
Logging DcsvIo.D2.Logging @dcsv-io/d2-logging Structured logging + PII redaction culture
Telemetry DcsvIo.D2.Telemetry @dcsv-io/d2-telemetry OpenTelemetry setup (traces / metrics / logs)
i18n DcsvIo.D2.I18n · DcsvIo.D2.I18n.Keys · DcsvIo.D2.I18n.Abstractions @dcsv-io/d2-i18n · @dcsv-io/d2-i18n-keys · @dcsv-io/d2-i18n-abstractions Typed message keys + runtime translation

Contracts, IDL & protos

Concern Path / package Why it matters
Shared specs contracts/ Source of truth for catalogs, headers, error codes, geo, messages…
Protos contracts/protos/ · @dcsv-io/d2-protos Common gRPC / wire types
Architecture decisions docs/adrs/ Why the framework looks the way it does

Cluster indexes and every package’s own README have APIs, dependencies, and codegen notes. Prefer those over this overview when you integrate.


Repository layout

Path Contents
packages/dotnet/ Shared .NET libraries (see index for every package)
packages/typescript/ Shared TypeScript packages (see index for every package)
contracts/ Specs, schemas, protos, message catalogs that drive both stacks
docs/adrs/ Architecture decisions for these open libraries
D2.Public.slnx .NET solution for the libraries in this repository
LICENSE Apache-2.0

Build from source (optional)

Most apps should depend on published packages. To build the open surface from a clone:

dotnet build D2.Public.slnx
dotnet test D2.Public.slnx

# TypeScript — see package READMEs; typically pnpm workspace under packages/typescript

SDK / engine pins live in global.json and package engines when present.


Versioning

Consumable libraries use per-package semver (0.x while early). Versions and notes appear on NuGet / npm and on Releases. Each package’s CHANGELOG.md tracks that package only.

Open publish inventory is the set of versioned packages under packages/{dotnet,typescript}/ that are meant to ship to NuGet/npm. Supporting catalog source-gen shells may sit next to parent packages for build-time codegen; they are not separate public install products.


About this repository

Source for the portable libraries and contracts above — published so you can read code next to NuGet/npm releases and open issues. Contribution model (public mirror; issues welcome, PRs not merged upstream) is in CONTRIBUTING.md.


Security

Do not file public issues that include credentials or unreleased exploit detail. Prefer a private report to DCSV security contacts on the organization profile when available; otherwise open a high-level issue without an exploit payload and request a private channel.


License

Apache License 2.0 — Copyright (c) DCSV.

About

.NET & TypeScript libs: Result, caching, crypto, messaging, handlers/OTel — plus geo (countries, subdivisions, currencies, languages, locales, timezones, geopolitical entities), location, contacts, validation.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages