{"id":34873508,"url":"https://github.com/ozzyczech/diggy","last_synced_at":"2026-02-28T10:08:44.433Z","repository":{"id":309711681,"uuid":"1037272302","full_name":"OzzyCzech/diggy","owner":"OzzyCzech","description":"Diggy is a flexible, multi-backend JavaScript DNS resolver for fetching DNS records — supports dig, DNS over HTTPS, and native Node.js DNS.","archived":false,"fork":false,"pushed_at":"2026-01-02T13:43:41.000Z","size":547,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-08T13:16:49.234Z","etag":null,"topics":["browser","cloudflare-dns","dig","dns","dns-client","dns-over-https","dns-over-tls","dns-resolver","dns-server","dns-tools","doh","google-dns","js-dns","lookup","nodejs","resolver"],"latest_commit_sha":null,"homepage":"https://ozzyczech.github.io/diggy/","language":"TypeScript","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/OzzyCzech.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-08-13T10:20:34.000Z","updated_at":"2026-01-02T13:43:45.000Z","dependencies_parsed_at":"2025-08-13T12:29:11.732Z","dependency_job_id":null,"html_url":"https://github.com/OzzyCzech/diggy","commit_stats":null,"previous_names":["ozzyczech/diggy"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/OzzyCzech/diggy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OzzyCzech%2Fdiggy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OzzyCzech%2Fdiggy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OzzyCzech%2Fdiggy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OzzyCzech%2Fdiggy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OzzyCzech","download_url":"https://codeload.github.com/OzzyCzech/diggy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OzzyCzech%2Fdiggy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28607624,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T16:10:39.856Z","status":"ssl_error","status_checked_at":"2026-01-20T16:10:39.493Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["browser","cloudflare-dns","dig","dns","dns-client","dns-over-https","dns-over-tls","dns-resolver","dns-server","dns-tools","doh","google-dns","js-dns","lookup","nodejs","resolver"],"created_at":"2025-12-26T00:04:35.930Z","updated_at":"2026-01-20T17:00:26.065Z","avatar_url":"https://github.com/OzzyCzech.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 👾 Diggy\n\n[![NPM Downloads](https://img.shields.io/npm/dm/diggy?style=for-the-badge)](https://www.npmjs.com/package/diggy)\n[![NPM Version](https://img.shields.io/npm/v/diggy?style=for-the-badge)](https://www.npmjs.com/package/diggy)\n[![NPM License](https://img.shields.io/npm/l/diggy?style=for-the-badge)](https://github.com/OzzyCzech/diggy/blob/main/LICENSE)\n[![Last Commit](https://img.shields.io/github/last-commit/OzzyCzech/diggy?style=for-the-badge)](https://github.com/OzzyCzech/diggy/commits/main)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/OzzyCzech/diggy/main.yml?style=for-the-badge)](https://github.com/OzzyCzech/diggy/actions)\n\n👾 **Diggy** is a flexible, multi-backend JavaScript **DNS resolver** for fetching **DNS records**\nwith support for various resolution methods including DNS over HTTPS, native `dig` commands, and Node.js built-in DNS\nfunctionality.\n\n## Features\n\n- **✨ Multiple DNS backends** - Choose from Google DoH, Cloudflare DoH, Node.js DNS, or native dig command or even\n  create your own custom resolver!\n- **🔒 DNS over HTTPS (DoH)** - Secure DNS queries over encrypted connections\n- **⚡ Native dig Support** - Leverage system [DNS tools](https://linux.die.net/man/1/dig) directly from Node.js\n- **🛠️ Node.js Integration** - Use built-in Node.js [DNS functionality](https://nodejs.org/api/dns.html)\n- **📋 Complete Record Support** - Fetch A, AAAA, SOA, CNAME, TXT, MX, SRV, CAA, NAPTR, and more\n- **🚀 Zero Dependencies** - Lightweight with literally no external dependencies\n- **🎯 TypeScript ready** - Full type definitions included\n\n## 📦 Installation\n\n```bash\nnpm install diggy\n```\n\n```bash\nyarn add diggy\n```\n\n```bash\npnpm add diggy\n```\n\n```bash\nbun add diggy\n```\n\n## 🚀 Quick Start\n\n### Basic Usage\n\n```javascript\nimport { getDnsRecords } from 'diggy';\n\n// Fetch all DNS records for a domain\nconst allRecords = await getDnsRecords('example.com');\nconsole.log(allRecords);\n\n// Fetch specific record types\nconst aRecords = await getDnsRecords('example.com', 'A');\nconst txtRecords = await getDnsRecords('example.com', 'TXT');\nconst mxRecords = await getDnsRecords('example.com', 'MX');\n```\n\n### TypeScript Support\n\n```typescript\nimport { type AnyDNSRecord, getDnsRecords } from 'diggy';\nconst records: AnyDNSRecord[] = await getDnsRecords('example.com', 'A');\n```\n\n```typescript\nfunction getDnsRecords(\n  host: string,\n  type?: string,\n  resolver?: string | BuildInDNSResolver | DNSResolver,\n): Promise\u003cAnyDNSRecord[]\u003e\n```\n\n**Parameters:**\n\n- `host` (string): The domain name to query\n- `type` (string, optional): DNS record type (A, AAAA, MX, TXT, etc.). If omitted, returns all available records\n- `resolver` (string | BuildInDNSResolver | DNSResolver, optional): DNS resolver to use\n\n**Returns:** Promise resolving to an array of DNS records, see [Response format](#response-format) for details.\n\n### 🌍 Browser Usage\n\nYou can also use Diggy in the browser via ESM imports. This allows you to fetch DNS records directly from client-side\nJavaScript. There are built-in resolvers for Google and Cloudflare DNS over HTTPS, which work seamlessly in the browser.\n\n```html\n\n\u003cscript type=\"module\"\u003e\n  import { getDnsRecords } from 'https://esm.sh/diggy';\n  const records = await getDnsRecords('ozana.cz');\n\u003c/script\u003e\n```\n\n## 🌐 Available Resolvers\n\n### Built-in Resolvers\n\nDiggy includes several pre-configured resolvers:\n\n```javascript\n// Use Google DNS JSON Over HTTPS\nconst records = await getDnsRecords('example.com', 'A', \"google\");\n\n// Use Cloudflare DNS JSON Over HTTPS\nconst records = await getDnsRecords('example.com', 'A', \"cloudflare\");\n\n// Use nodejs dns module\nconst records = await getDnsRecords('example.com', 'A', \"nodejs\");\n\n// Use dig command\nconst records = await getDnsRecords('example.com', 'A', \"dig\");\n```\n\n| Resolver     | Description                 | Environment                            | \n|--------------|-----------------------------|----------------------------------------|\n| `google`     | Google DNS over HTTPS       | Browsers, Node.js                      | \n| `cloudflare` | Cloudflare DNS over HTTPS   | Browsers, Node.js                      | \n| `nodejs`     | Node.js built-in DNS module | Node.js only                           | \n| `dig`        | Native dig command          | Node.js only, requires `dig` installed | \n\n### Configure built-in resolvers\n\nCreate your own DNS resolver for custom endpoints:\n\n```javascript\nimport { getDnsRecords, dohResolver } from 'diggy';\n\nconst customDohResolver = dohResolver(\"https://custom.dns.provider/resolve\");\nconst records = await getDnsRecords('example.com', 'TXT', customDohResolver);\n```\n\n\u003e 💡 **Tip:** Find more public [DoH endpoints here](https://github.com/curl/curl/wiki/DNS-over-HTTPS)\n\nJust like with `dohResolver`, you can also use `digResolver` or `nodeResolver` and specify a custom DNS server:\n\n```javascript\nimport { getDnsRecords, digResolver, nodeResolver } from 'diggy';\n\n// Native nodejs dns resolver witg specific DNS server\nconst customNodejsResolver = nodeResolver(['8.8.8.8']);\nconst records = await getDnsRecords('example.com', 'A', customNodejsResolver);\n\n// Native dig command with specific DNS server\nconst customDigResolver = digResolver('1.1.1.1');\nconst records = await getDnsRecords('example.com', 'A', customDigResolver);\n```\n\n\u003e 💡 **Tip:** Find more public [DNS servers here](https://public-dns.info/)\n\nYou can also **create your own custom resolver** by implementing the `DNSResolver` interface:\n\n```typescript\nexport type DNSResolver = (\n  host: string,\n  type: DNSRecordType,\n) =\u003e Promise\u003cAnyDNSRecord[]\u003e;\n```\n\n## 📝 Supported Record Types\n\n| Type  | Description            | Example Use Case        |\n|-------|------------------------|-------------------------|\n| A     | IPv4 address           | Website hosting         |\n| AAAA  | IPv6 address           | IPv6 connectivity       |\n| CNAME | Canonical name         | Domain aliases          |\n| MX    | Mail exchange          | Email routing           |\n| TXT   | Text records           | SPF, DKIM, verification |\n| SOA   | Start of authority     | Zone information        |\n| SRV   | Service records        | Service discovery       |\n| CAA   | Certificate authority  | SSL/TLS security        |\n| NAPTR | Name authority pointer | ENUM, SIP routing       |\n\n## Response Format\n\nDNS records are returned as an array of objects with the following structure:\n\n```typescript\nimport { CaaRecordData, MxRecordData, SoaRecordData, SrvRecordData, NaptrRecordData } from \"./types\";\n\ninterface AnyDNSRecord {\n  name: string;    // Domain name\n  type: string;    // Record type (A, AAAA, MX, etc.)\n  ttl: number;     // Time-to-live in seconds\n\n  // Record data (format varies by type)\n  data:\n    | string\n    | string[]\n    | MxRecordData\n    | SoaRecordData\n    | CaaRecordData\n    | NaptrRecordData\n    | SrvRecordData;\n}\n```\n\n### Example Response\n\n```json\n[\n  {\n    \"name\": \"example.com\",\n    \"type\": \"SOA\",\n    \"ttl\": 3600,\n    \"data\": {\n      \"nsname\": \"ns1.example.com.\",\n      \"hostmaster\": \"hostmaster.example.com.\",\n      \"serial\": 2025051204,\n      \"refresh\": 10800,\n      \"retry\": 3600,\n      \"expire\": 604800,\n      \"minttl\": 3600\n    }\n  },\n  {\n    \"name\": \"example.cz\",\n    \"type\": \"A\",\n    \"ttl\": 1800,\n    \"data\": \"66.33.66.33\"\n  },\n  {\n    \"name\": \"example.cz\",\n    \"type\": \"MX\",\n    \"ttl\": 60,\n    \"data\": {\n      \"priority\": 10,\n      \"exchange\": \"mail.example.com\"\n    }\n  }\n]\n```\n\n## 🔧 Requirements\n\n- **Node.js**: Version 22 or higher\n- **dig command**: Required only when using the 'dig' resolver\n- **Internet connection**: Required for DoH resolvers (google, cloudflare)\n\n## 📄 License\n\n[MIT License](LICENSE) - see the [LICENSE](LICENSE) file for details.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n--- \n\nMade with ❤️ by the [Roman Ožana](https://ozana.cz)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozzyczech%2Fdiggy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fozzyczech%2Fdiggy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fozzyczech%2Fdiggy/lists"}