dgii-ts
Open-source DGII validation & integration library for TypeScript
Published on
Overview
dgii-ts is an open-source TypeScript library for working with Dominican tax identifiers like RNC, cédula, NCF, and e-NCF. It validates them and looks them up against the DGII, the country's tax authority.
I built it because the DGII doesn't publish a stable public API. For years developers have leaned on fragile scrapers of old ASP.NET pages whose URLs keep moving, which quietly breaks every integration that depends on them. dgii-ts hides all of that behind one typed client that's built to keep working when the source doesn't.
Challenges
The real challenge is that you're integrating with a system that doesn't want to be integrated with. The DGII has no REST API, it shut off its old SOAP service in January 2025, and the ASP.NET pages it does serve change without warning. My answer was to build it in layers: offline check-digit validation that never touches the network, a scraping layer for live lookups, and a client with a circuit breaker and retries with backoff so one failure upstream doesn't take everything down with it.
Key Learnings
This one taught me to treat failure as the normal case, not the exception. Because the data source is unreliable by design, the interesting work was all in the fallbacks, the graceful degradation, and an offline path that always works. Publishing it on npm under MIT with CI also made me care a lot more about a clean public API, proper versioning, and docs that another developer can actually follow.