Skip to main content

Cloudflare DNS provider extension for npmctl.

Project description

npmctl-cloudflare

Cloudflare DNS provider plugin for npmctl

Extend npmctl with Cloudflare-backed DNS record management for declarative workflows, provider discovery, and DNS-aware automation.

PyPI version Python versions CI Apache 2.0 License

npmctl-cloudflare package hits npmctl-cloudflare downloads

npmctl architecture infographic

npmctl-cloudflare is the Cloudflare DNS provider package for npmctl. Install it when you want desired-state DNS records or DNS diagnostics to resolve through Cloudflare instead of using only the base npmctl package.

Supported Python Versions

npmctl-cloudflare supports Python 3.10, 3.11, 3.12, 3.13, and 3.14.

Why npmctl-cloudflare

  • Adds Cloudflare DNS provider discovery to npmctl
  • Lets DNS workflows live beside proxy and certificate desired state
  • Keeps Cloudflare API tokens out of the core CLI package
  • Supports operator diagnostics through npmctl dns doctor
  • Provides client helpers for Cloudflare A and CNAME record workflows

FAQ

What is npmctl-cloudflare?

Answer: npmctl-cloudflare is a plugin package that teaches npmctl how to talk to the Cloudflare DNS Records API for DNS record operations and DNS provider diagnostics.

When do I need npmctl-cloudflare?

Answer: You need npmctl-cloudflare when your npmctl workflow includes Cloudflare-managed DNS records or when you want npmctl to validate Cloudflare DNS connectivity and credentials.

Does npmctl-cloudflare work without npmctl?

Answer: No. npmctl-cloudflare is an extension package for npmctl, not a standalone CLI.

Can npmctl-cloudflare set A and CNAME records?

Answer: Yes. The Cloudflare DNS Records API supports A and CNAME records, and this package exposes helpers for create, replace, patch, and delete operations.

What credentials are required?

Answer: Cloudflare API access requires CLOUDFLARE_API_TOKEN. For diagnostics, grant zone read and DNS read access. For record changes, grant DNS write access to the target zone.

Install

Install the base CLI and the Cloudflare provider package together:

pipx install npmctl
pipx inject npmctl npmctl-cloudflare
npmctl plugins list

With uv:

uv tool install npmctl
uv tool install npmctl-cloudflare
npmctl plugins list

Inside a virtual environment:

python -m venv .venv
. .venv/bin/activate
python -m pip install npmctl npmctl-cloudflare
npmctl plugins list

Configure Cloudflare

Set the required environment variable:

export CLOUDFLARE_API_TOKEN=your-cloudflare-api-token

Optional for tests, proxies, or alternate endpoints:

export CLOUDFLARE_API_BASE_URL=https://api.cloudflare.com/client/v4

Verify Plugin Discovery

Check that npmctl can discover the provider:

npmctl plugins list
npmctl dns doctor --provider cloudflare

Minimal DNS Workflow

Once the provider is installed and configured, npmctl can validate or diagnose Cloudflare-backed DNS behavior through the base CLI:

npmctl dns providers
npmctl dns zones --provider cloudflare
npmctl dns records --provider cloudflare --zone example.com

Cloudflare API Surface

The provider follows the Cloudflare DNS Records API:

  • GET /zones: discover zones available to the token.
  • GET /zones/{zone_id}/dns_records: list DNS records in one zone.
  • POST /zones/{zone_id}/dns_records: create A, CNAME, and other supported records.
  • PUT /zones/{zone_id}/dns_records/{dns_record_id}: overwrite an existing record.
  • PATCH /zones/{zone_id}/dns_records/{dns_record_id}: partially update an existing record.
  • DELETE /zones/{zone_id}/dns_records/{dns_record_id}: delete a record.

Programmatic Record Operations

The npmctl DNS provider contract requires zones() and records(zone). This package also exposes client helpers for API-backed record mutation:

from npmctl_cloudflare import CloudflareClient, CloudflareConfig

client = CloudflareClient(CloudflareConfig.from_env())
record = client.create_record("example.com", type="A", name="www", value="192.0.2.10", ttl=300)
client.patch_record("example.com", str(record.record_id), value="192.0.2.11")
client.delete_record("example.com", str(record.record_id))

CNAME creation uses the same method:

client.create_record("example.com", type="CNAME", name="app", value="target.example.net", ttl=300)

Safety Notes

  • Only operate on zones that are authoritative in Cloudflare.
  • Use least-privilege API tokens scoped to the intended zone.
  • Keep CLOUDFLARE_API_TOKEN out of desired-state files and logs.
  • Cloudflare prevents CNAME records from coexisting with A or AAAA records on the same name.
  • Use npmctl owner metadata for desired DNS records so future apply support can remain owner-scoped.

More Documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

npmctl_cloudflare-0.3.7.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

npmctl_cloudflare-0.3.7-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file npmctl_cloudflare-0.3.7.tar.gz.

File metadata

  • Download URL: npmctl_cloudflare-0.3.7.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for npmctl_cloudflare-0.3.7.tar.gz
Algorithm Hash digest
SHA256 c7dad682a83a5f473abb6013f6900c826cd65b5a239d1474b49d45717b8b7b9f
MD5 6a7a42f5b32d9751da2fe67730ef402c
BLAKE2b-256 fdf8c7ef9c939eaaf1390b68d3ef22a52166a299cc00ebded873b521d0e33296

See more details on using hashes here.

Provenance

The following attestation bundles were made for npmctl_cloudflare-0.3.7.tar.gz:

Publisher: release.yml on groupsum/npmctl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file npmctl_cloudflare-0.3.7-py3-none-any.whl.

File metadata

File hashes

Hashes for npmctl_cloudflare-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0f586999b270c1b9811e85dc541c023bc266fabb4ee2ca2cc047507b60997da2
MD5 4aaf19654e4076de5ee5032f22742d75
BLAKE2b-256 4ce6cc673fcc4d91e997a2838eea384a40c7df9db7efb6b15b8198857d2f57f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for npmctl_cloudflare-0.3.7-py3-none-any.whl:

Publisher: release.yml on groupsum/npmctl

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page