Skip to content

feat: add Porkbun DNS provider support - #5165

Open
outeiroDev wants to merge 1 commit into
Dokploy:canaryfrom
outeiroDev:feat/porkbun-dns-provider
Open

feat: add Porkbun DNS provider support#5165
outeiroDev wants to merge 1 commit into
Dokploy:canaryfrom
outeiroDev:feat/porkbun-dns-provider

Conversation

@outeiroDev

@outeiroDev outeiroDev commented Aug 22, 2026

Copy link
Copy Markdown

What is this PR about?

Adds Porkbun as a supported DNS provider alongside Cloudflare and AWS Route53. Once connected, Dokploy can list a Porkbun account's domains as zones and automatically create/update/delete the DNS records needed for a domain, the same flow already available for Cloudflare and Route53 (introduced in v0.30.0).

The implementation follows the existing DnsClient interface in packages/server/src/utils/dns/:

  • porkbun.ts implements listZones (via /domain/listAll), listRecords, upsertRecord, updateRecord, deleteRecord and testConnection against the Porkbun API v3 (https://api.porkbun.com/api/json/v3), authenticating with apikey/secretapikey in the request body.
  • A new porkbun value was added to the DnsProviderType Postgres enum and a porkbunDnsConfigSchema (apiKey / secretApiKey) was added to the discriminated union in db/schema/dns-provider.ts, together with the Drizzle migration for the enum change.
  • The secret field is masked/merged the same way the existing providers do it in services/dns-provider.ts.
  • UI: added a Porkbun icon and the provider's form fields (API Key / Secret API Key) in the DNS provider dialog, plus registration in the provider selector.

Since Porkbun does not have a separate "zone" concept like Cloudflare, each domain in the account is exposed as a zone (id/name = the domain itself), and record names are translated between Dokploy's fully-qualified format and Porkbun's subdomain-only format internally.

Unit tests were added in apps/dokploy/__test__/dns/porkbun.test.ts covering all DnsClient methods (including apex-domain handling and error propagation), mirroring the existing Cloudflare/Route53 test suites.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Tested locally: pnpm run typecheck (server + app) and pnpm test for the DNS suite all pass (42/42 tests, including the 10 new Porkbun tests). Not tested against a live Porkbun account/API key.

Issues related (if applicable)

N/A

Screenshots (if applicable)

N/A

Greptile Summary

Adds Porkbun as a DNS provider across persistence, credential handling, API operations, tests, and dashboard configuration.

  • Registers the Porkbun provider and database enum migration.
  • Implements zone and DNS-record operations against Porkbun API v3.
  • Adds masked credential editing, provider selection, iconography, and unit coverage.

Confidence Score: 4/5

The trailing-dot name conversion defect should be fixed before merging because valid absolute DNS names can be sent to Porkbun as incorrect subdomains.

Porkbun is otherwise consistently integrated across schemas, migrations, masking, UI, and client registration, but its conversion of user-entered FQDNs does not account for the DNS root dot and the provider list also lacks the new display label.

Files Needing Attention: packages/server/src/utils/dns/porkbun.ts, apps/dokploy/components/dashboard/settings/dns/handle-dns-provider.tsx

Reviews (1): Last reviewed commit: "feat: add Porkbun DNS provider support" | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

Adds Porkbun as a supported DNS provider alongside Cloudflare and
AWS Route53, allowing Dokploy to automatically create DNS records
for domains managed on Porkbun.

- New DnsClient implementation for the Porkbun API v3
- porkbun enum value and config schema (apiKey/secretApiKey)
- Drizzle migration for the new DnsProviderType enum value
- UI: provider icon, form fields and provider selector entry
- Unit tests covering listZones/listRecords/upsertRecord/updateRecord/deleteRecord/testConnection
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 22, 2026
Comment on lines +41 to +47
const toSubdomain = (name: string, domain: string) => {
if (name === domain) {
return "";
}
const suffix = `.${domain}`;
return name.endsWith(suffix) ? name.slice(0, -suffix.length) : name;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Trailing-dot names bypass conversion

When a user enters an absolute DNS name such as app.example.com. or example.com., toSubdomain returns the entire FQDN instead of the subdomain or empty apex name, causing Porkbun lookups and writes to use an incorrect record name and resulting in a rejected operation, duplicate, or wrongly named record.

Suggested change
const toSubdomain = (name: string, domain: string) => {
if (name === domain) {
return "";
}
const suffix = `.${domain}`;
return name.endsWith(suffix) ? name.slice(0, -suffix.length) : name;
};
const toSubdomain = (name: string, domain: string) => {
const normalizedName = name.endsWith(".") ? name.slice(0, -1) : name;
if (normalizedName === domain) {
return "";
}
const suffix = `.${domain}`;
return normalizedName.endsWith(suffix)
? normalizedName.slice(0, -suffix.length)
: normalizedName;
};

const providerLabels = {
cloudflare: "Cloudflare",
route53: "AWS Route53",
porkbun: "Porkbun",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Provider list omits Porkbun label

The editor registers the user-facing Porkbun label, but the separate provider-list label map remains unchanged, so configured Porkbun providers render the raw lowercase badge porkbun instead of the consistently capitalized provider name.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant