Building a 58 MB RAM Domain Intelligence API in Pure Node.js: DNS-over-HTTPS Fallback, RDAP Bootstrap, TLS Sockets & Zero Browsers
Most domain enrichment and email deliverability APIs have two classic problems: they either spin up headless browsers just to fingerprint a homepage tech stack, or they rely on port-25 SMTP probes that time out inside cl
Most domain enrichment and email deliverability APIs have two classic problems: they either spin up headless browsers just to fingerprint a homepage tech stack, or they rely on port-25 SMTP probes that time out inside cloud containers. Even worse, standard dns.resolveTxt() calls in Docker containers silently drop truncated UDP responses on enterprise domains with 25β50 TXT verification records (stripe.com, github.com, linear.app).
Here is how we solved all three in pure Node.js 22 + TypeScript at $2.00 / 1,000 domains ($0 start fee):
-
Container-Safe DNS + DoH TXT Fallback: Query
A,AAAA,MX,NS,TXT, and_dmarcvianode:dns/promiseswith strict timeoutsβand whenever a live domain returns empty/timed-out TXT records due to UDP truncation, automatically fall back to Google DNS-over-HTTPS (dns.google/resolve). -
Email Provider, Gateway & Auth Readiness Score (
0β100): ClassifyGoogle Workspace,Microsoft 365,Zoho,Proton,Fastmail,Proofpoint, andMimecast, estimate SPF DNS lookup counts (catching RFC 7208>10lookup limits), parse DMARCp=/sp=/rua=, and grade outbound readinessAβF. -
IANA RDAP Bootstrap + Live
node:tlsInspection: Cachedata.iana.org/rdap/dns.jsonin memory with graceful fallback when a TLD lacks RDAP, and inspect live port-443 certificates withrejectUnauthorized: falseso expired certs still reportdaysUntilExpiryandauthorizationErrorinstead of crashing. -
Bounded 256 KB HTTP/Tech Stack Fingerprinting: Manually trace redirects (
redirect: 'manual'), cap response body reads at 256 KB viaReadableStreamreader, and fingerprint CDNs/WAFs, frameworks,HSTS/CSP/X-Frame-Options,robots.txt, andsitemap.xml.
Verified Live Apify Cloud Benchmark (128 MB RAM)
-
5 diverse domains (
stripe.com,linear.app,github.com,shopify.com, plus an unresolvable.invaliddomain) -
Total Container Duration:
4.44s(2.45sanalysis time) -
Peak Memory:
58.5 MB(avg44.9 MB) -
Compute Units:
0.0001542CU (~0.031 CU / 1,000 domains)
Try It via Apify Store, MCP, or n8n
- Apify Store: https://apify.com/deliberate_gratitude_shj/domain-intel-api
-
GitHub Source +
n8n_workflow.json: https://github.com/tikzyre8-cmyk/domain-intel-api - MCP Endpoint: https://mcp.apify.com/?actors=deliberate_gratitude_shj/domain-intel-api
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.