import type { Metadata } from "next"; import { ArrowRightLeft, ArrowDown } from "lucide-react"; import { Card, CardContent, CardHeader, CardTitle, CardDescription, } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Separator } from "@/components/ui/separator"; export const metadata: Metadata = { title: "Data Flow", }; const dnsQuerySteps = [ { step: "1", actor: "User", action: "Submits a domain name in the VectorDNS UI", detail: "Browser sends a request to a Next.js API route on Vercel.", }, { step: "2", actor: "Next.js API Route", action: "Proxies the request to the Go DNS service", detail: "Adds the shared API key header and forwards to the Go server over HTTPS.", }, { step: "3", actor: "Go Microservice", action: "Resolves DNS records via UDP/TCP", detail: "Uses miekg/dns to query resolvers (Google 8.8.8.8, Cloudflare 1.1.1.1) or authoritative nameservers directly.", }, { step: "4", actor: "DNS Resolvers", action: "Return DNS records", detail: "Authoritative nameservers or recursive resolvers respond with the requested record types.", }, { step: "5", actor: "Go Microservice", action: "Returns structured JSON to Next.js", detail: "Parsed and normalized DNS records are sent back over HTTPS.", }, { step: "6", actor: "Next.js", action: "Stores results in Supabase & returns to client", detail: "DNS history is written to Supabase for authenticated users. The response is returned to the browser.", }, ]; const monitoringSteps = [ { step: "1", actor: "Go Cron Job", action: "Triggers on a schedule (daily by default)", detail: "A native Go cron scheduler runs inside the VPS process — no serverless timeouts.", }, { step: "2", actor: "Go Microservice", action: "Fetches monitored domains from Supabase", detail: "Reads the saved_domains table to get the list of domains and their last-known DNS snapshot.", }, { step: "3", actor: "Go Microservice", action: "Re-queries DNS for each domain", detail: "Performs fresh DNS lookups and diffs the result against the stored snapshot.", }, { step: "4", actor: "Go Microservice", action: "Detects changes", detail: "If records changed, writes a new entry to dns_history and availability_history.", }, { step: "5", actor: "Go Microservice", action: "Triggers notifications", detail: "Writes to the notifications table. Next.js picks these up for in-app display; Resend handles email delivery.", }, ]; const whoIsSteps = [ { step: "1", actor: "User", action: "Requests WHOIS data for a domain", detail: "Next.js handles this entirely — no Go service involved.", }, { step: "2", actor: "Next.js API Route", action: "Calls the whoiser library", detail: "whoiser queries the appropriate WHOIS server directly from Vercel.", }, { step: "3", actor: "Next.js", action: "Returns parsed WHOIS data to the client", detail: "Registrar, expiry, nameservers, and registration details.", }, ]; type FlowStep = { step: string; actor: string; action: string; detail: string; }; function FlowSteps({ steps }: { steps: FlowStep[] }) { return (
{steps.map((s, i) => (
{s.step}
{i < steps.length - 1 && (
)}
{s.actor} {s.action}

{s.detail}

))}
); } export default function DataFlowPage() { return (
{/* Page header */}

Data Flow

How requests travel through VectorDNS — from the browser through Next.js and the Go DNS service to resolvers, and how results are stored.

{/* DNS query flow */}

DNS Record Lookup

User-initiated DNS query flow.

              User → Next.js API Route → Go DNS API → DNS Resolvers
            
{/* Monitoring flow */}

Domain Monitoring

Scheduled background job — runs on the VPS, no user trigger required.

              Go Cron → Supabase (read) → DNS Resolvers → Supabase (write) →
              Notifications
            
{/* WHOIS flow */}

WHOIS Lookups

Handled entirely by Next.js — the Go service is not involved.

              User → Next.js API Route (whoiser) → WHOIS Servers
            
{/* Key design notes */}

Key Design Notes

No direct client → Go The browser never calls the Go service directly. All requests go through Next.js API routes, which validate the session and add the API key. Persistent process on VPS Unlike serverless functions, the Go service runs continuously — enabling native cron jobs and long-running monitoring without timeout constraints. UDP/TCP, not DoH DNS queries use direct UDP/TCP to resolvers or authoritative nameservers via miekg/dns — faster and more capable than DNS-over-HTTPS. Supabase as source of truth Both Next.js and the Go service read/write Supabase. Row Level Security ensures users only access their own data.
); }