# avrxtcloud/nxtdev-xyz architecture

> Architecture diagram of the GitHub repository avrxtcloud/nxtdev-xyz, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/avrxtcloud/nxtdev-xyz
- Repository: https://github.com/avrxtcloud/nxtdev-xyz

## Overview

#### Purpose and runtime
nxtdev.xyz is a Next.js/TypeScript developer platform for claiming Cloudflare-backed subdomains, managing DNS and delegated nameservers, configuring email aliases, and creating short links. It runs as a Vercel-oriented Next application, with a separate Dynamic DNS worker. Core entry points are `src/app/page.tsx`, `src/app/layout.tsx`, `src/middleware.ts`, and `worker/ddns-api.js`.

#### Routing, identity, and access boundaries
App Router pages split public marketing/docs/reporting routes from authenticated user and administrator areas. Authentication utilities and middleware gate dashboard/admin access; server actions are colocated with mutating pages.
- `src/middleware.ts`
- `src/lib/auth.ts`
- `src/app/dashboard/layout.tsx`
- `src/app/admin/layout.tsx`

#### Subdomain lifecycle and persistence
The primary workflow is claim → validate/limit → persist ownership → provision/manage DNS. Dashboard domain actions drive user-owned subdomain operations, backed by Supabase and shared domain/subdomain services. Database schemas and migrations define the durable model.
- `src/app/dashboard/domains/actions.ts`
- `src/lib/services/subdomains.ts`
- `src/db/supabaseAdmin.ts`
- `supabase_schema.sql`

#### DNS control plane
Record CRUD and nameserver delegation are separate dashboard stages. DNS service abstractions call Cloudflare APIs, while validators constrain supported record formats and domain inputs. Delegating NS records forms an important boundary: users move from managed records to their own nameserver control.
- `src/app/dashboard/domains/[subdomainId]/records/actions.ts`
- `src/app/dashboard/domains/[subdomainId]/nameservers/actions.ts`
- `src/lib/cloudflare/dns.ts`
- `src/lib/services/dns.ts`

#### Safety, verification, and observability
Mutations are screened for phishing keywords, unsafe/private IPs, and reputation risk before DNS publication. The application also exposes domain verification, DNS propagation, availability, and health endpoints. Audit utilities support accountable user/admin actions.
- `src/lib/safety/risk.ts`
- `src/lib/safety/abuseipdb.ts`
- `src/app/api/domain-verify/route.ts`
- `src/app/api/propagation/route.ts`
- `src/lib/audit.ts`

#### Adjacent managed products
Email aliases are configured through Cloudflare Email Routing, while short links use a dedicated external service abstraction. Both are authenticated dashboard capabilities and likely share the same ownership/persistence boundary as domains.
- `src/app/dashboard/email-aliases/actions.ts`
- `src/lib/cloudflare/email-routing.ts`
- `src/app/dashboard/short-links/actions.ts`
- `src/lib/services/shortio.ts`

#### Administration and operations
Admins manage users, subdomains/records, reservations, announcements, reports, settings, and audit views through server-action-backed routes. A dedicated DDNS endpoint worker supports programmatic dynamic record updates; API-key dashboard management is its likely credential-control surface.
- `src/app/admin/subdomains/actions.ts`
- `src/app/admin/reports/actions.ts`
- `src/app/dashboard/api-keys/actions.ts`
- `worker/ddns-api.js`
- `docker-compose.yml`

#### External infrastructure
Cloudflare is the authoritative DNS and email-routing provider; Supabase is the application database/admin client; AbuseIPDB supplies IP-reputation data; Short.io backs link management. Deployment configuration indicates Vercel/Next hosting, with environment variables centralized through `src/lib/env.ts`.

Main entry points: [`src/app/dashboard/layout.tsx`](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/layout.tsx) (User dashboard), [`src/middleware.ts`](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/middleware.ts) (Access control), [`src/lib/services/dns.ts`](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/services/dns.ts) (DNS service), [`src/app/dashboard/domains/[subdomainId]/records/actions.ts`](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/domains/%5BsubdomainId%5D/records/actions.ts) (DNS record CRUD)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Next.js application"]
  node_entry["App Router entry<br/>Next.js UI<br/>[page.tsx]"]
  node_access["Access control<br/>auth middleware<br/>[middleware.ts]"]
  node_auth["Authentication<br/>auth utilities<br/>[auth.ts]"]
  node_dashboard["User dashboard<br/>authenticated UI<br/>[layout.tsx]"]
  node_admin["Administration<br/>admin UI<br/>[layout.tsx]"]
  node_verification["Verification APIs<br/>route handlers<br/>[route.ts]"]
end

subgraph group_domain["Domain control plane"]
  node_domain_actions["Domain lifecycle<br/>server actions<br/>[actions.ts]"]
  node_subdomains["Subdomain service<br/>[subdomains.ts]"]
  node_record_actions["DNS record CRUD<br/>server actions<br/>[actions.ts]"]
  node_ns_actions["Nameserver delegation<br/>server actions<br/>[actions.ts]"]
  node_dns_service["DNS service<br/>DNS abstraction<br/>[dns.ts]"]
  node_risk["Publication safety<br/>risk screening<br/>[risk.ts]"]
  node_ddns{{"Dynamic DNS worker<br/>worker API<br/>[ddns-api.js]"}}
end

subgraph group_products["Managed products"]
  node_email["Email aliases<br/>server actions<br/>[actions.ts]"]
  node_short_links["Short links<br/>server actions<br/>[actions.ts]"]
end

subgraph group_external["External infrastructure"]
  node_supabase[("Supabase<br/>application database<br/>[supabaseAdmin.ts]")]
  node_cloudflare{{"Cloudflare<br/>DNS and email provider<br/>[dns.ts]"}}
  node_abuseipdb{{"AbuseIPDB<br/>reputation provider<br/>[abuseipdb.ts]"}}
  node_shortio{{"Short.io<br/>link provider<br/>[shortio.ts]"}}
end

node_entry -->|"routes through"| node_access
node_access -->|"uses"| node_auth
node_access -->|"permits users"| node_dashboard
node_access -->|"permits admins"| node_admin
node_dashboard -->|"claims and manages"| node_domain_actions
node_domain_actions -->|"orchestrates"| node_subdomains
node_subdomains -->|"persists ownership"| node_supabase
node_dashboard -->|"manages records"| node_record_actions
node_dashboard -->|"delegates nameservers"| node_ns_actions
node_record_actions -->|"screens publication"| node_risk
node_risk -->|"checks IP reputation"| node_abuseipdb
node_record_actions -->|"provisions"| node_dns_service
node_ns_actions -->|"updates delegation"| node_dns_service
node_dns_service -->|"calls DNS API"| node_cloudflare
node_verification -->|"checks DNS state"| node_cloudflare
node_dashboard -->|"configures"| node_email
node_email -->|"uses Email Routing"| node_cloudflare
node_dashboard -->|"creates"| node_short_links
node_short_links -->|"manages links"| node_shortio
node_ddns -->|"updates records"| node_dns_service
node_admin -->|"manages platform state"| node_supabase

click node_entry "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/page.tsx"
click node_access "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/middleware.ts"
click node_auth "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/auth.ts"
click node_dashboard "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/layout.tsx"
click node_admin "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/admin/layout.tsx"
click node_domain_actions "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/domains/actions.ts"
click node_subdomains "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/services/subdomains.ts"
click node_record_actions "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/domains/%5BsubdomainId%5D/records/actions.ts"
click node_ns_actions "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/domains/%5BsubdomainId%5D/nameservers/actions.ts"
click node_dns_service "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/services/dns.ts"
click node_risk "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/safety/risk.ts"
click node_verification "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/api/domain-verify/route.ts"
click node_email "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/email-aliases/actions.ts"
click node_short_links "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/short-links/actions.ts"
click node_ddns "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/worker/ddns-api.js"
click node_supabase "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/db/supabaseAdmin.ts"
click node_cloudflare "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/cloudflare/dns.ts"
click node_abuseipdb "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/safety/abuseipdb.ts"
click node_shortio "https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/services/shortio.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_access,node_auth,node_dashboard,node_admin,node_verification toneBlue
class node_domain_actions,node_subdomains,node_record_actions,node_ns_actions,node_dns_service,node_risk,node_ddns toneAmber
class node_email,node_short_links toneMint
class node_supabase,node_cloudflare,node_abuseipdb,node_shortio toneRose
```

## Components

### Next.js application

- [App Router entry](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/page.tsx): Next.js UI · Public marketing, docs, and reporting routes. · `src/app/page.tsx`
- [Access control](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/middleware.ts): auth middleware · Gates dashboard and administrator areas. · `src/middleware.ts`
- [Authentication](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/auth.ts): auth utilities · `src/lib/auth.ts`
- [User dashboard](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/layout.tsx): authenticated UI · Hosts domain, email, short-link, and API-key actions. · `src/app/dashboard/layout.tsx`
- [Administration](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/admin/layout.tsx): admin UI · Privileged management and reporting surface. · `src/app/admin/layout.tsx`
- [Verification APIs](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/api/domain-verify/route.ts): route handlers · Domain verification and propagation checks. · `src/app/api/domain-verify/route.ts`

### Domain control plane

- [Domain lifecycle](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/domains/actions.ts): server actions · Claims and manages owned subdomains. · `src/app/dashboard/domains/actions.ts`
- [Subdomain service](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/services/subdomains.ts): domain service · Applies ownership, validation, and limits. · `src/lib/services/subdomains.ts`
- [DNS record CRUD](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/domains/%5BsubdomainId%5D/records/actions.ts): server actions · `src/app/dashboard/domains/[subdomainId]/records/actions.ts`
- [Nameserver delegation](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/domains/%5BsubdomainId%5D/nameservers/actions.ts): server actions · Transfers DNS control to user nameservers. · `src/app/dashboard/domains/[subdomainId]/nameservers/actions.ts`
- [DNS service](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/services/dns.ts): DNS abstraction · Validates and provisions managed DNS records. · `src/lib/services/dns.ts`
- [Publication safety](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/safety/risk.ts): risk screening · Screens phishing, unsafe IPs, and reputation risk. · `src/lib/safety/risk.ts`
- [Dynamic DNS worker](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/worker/ddns-api.js): worker API · Programmatic dynamic record updates. · `worker/ddns-api.js`

### Managed products

- [Email aliases](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/email-aliases/actions.ts): server actions · `src/app/dashboard/email-aliases/actions.ts`
- [Short links](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/app/dashboard/short-links/actions.ts): server actions · `src/app/dashboard/short-links/actions.ts`

### External infrastructure

- [Supabase](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/db/supabaseAdmin.ts): application database · Durable ownership, credentials, and product state. · `src/db/supabaseAdmin.ts`
- [Cloudflare](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/cloudflare/dns.ts): DNS and email provider · Authoritative DNS and Email Routing provider. · `src/lib/cloudflare/dns.ts`
- [AbuseIPDB](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/safety/abuseipdb.ts): reputation provider · `src/lib/safety/abuseipdb.ts`
- [Short.io](https://github.com/avrxtcloud/nxtdev-xyz/blob/main/src/lib/services/shortio.ts): link provider · `src/lib/services/shortio.ts`

## Connections

- App Router entry → Access control: routes through
- Access control → Authentication: uses
- Access control → User dashboard: permits users
- Access control → Administration: permits admins
- User dashboard → Domain lifecycle: claims and manages
- Domain lifecycle → Subdomain service: orchestrates
- Subdomain service → Supabase: persists ownership
- User dashboard → DNS record CRUD: manages records
- User dashboard → Nameserver delegation: delegates nameservers
- DNS record CRUD → Publication safety: screens publication
- Publication safety → AbuseIPDB: checks IP reputation
- DNS record CRUD → DNS service: provisions
- Nameserver delegation → DNS service: updates delegation
- DNS service → Cloudflare: calls DNS API
- Verification APIs → Cloudflare: checks DNS state
- User dashboard → Email aliases: configures
- Email aliases → Cloudflare: uses Email Routing
- User dashboard → Short links: creates
- Short links → Short.io: manages links
- Dynamic DNS worker → DNS service: updates records
- Administration → Supabase: manages platform state
