Skip to content

feat(sdk): add custom domain support for staticwebsite - #1367

Merged
toiroakr merged 3 commits into
mainfrom
feat/staticwebsite-custom-domain
Jun 10, 2026
Merged

feat(sdk): add custom domain support for staticwebsite#1367
toiroakr merged 3 commits into
mainfrom
feat/staticwebsite-custom-domain

Conversation

@haru0017

@haru0017 haru0017 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add customDomains option to defineStaticWebSite() for associating custom domains with static websites
  • Deploy logic diffs desired vs existing custom domains and calls AddCustomDomain / RemoveCustomDomain RPCs
  • Domains added through the console are never removed by deploy. Only SDK-managed domains are tracked and can be removed
  • Custom domain TRN (...staticwebsite:{name}:custom_domain:{domain}) is a nested format not supported by the shared resourceTrn helper, so a local customDomainTrn function is used instead
  • Add staticwebsite domain get and staticwebsite domain list CLI commands for checking domain status and DNS CNAME targets

@haru0017 haru0017 self-assigned this Jun 9, 2026
@changeset-bot

changeset-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b6ddabd

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@tailor-platform/sdk Minor
@tailor-platform/create-sdk Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 9, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/@tailor-platform/create-sdk@b6ddabd
pnpm add https://pkg.pr.new/@tailor-platform/sdk@b6ddabd

commit: b6ddabd

@github-actions

This comment has been minimized.

Copilot AI left a comment

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.

Pull request overview

This PR adds first-class custom domain support to the Static Website service configuration and deployment flow, plus CLI commands to inspect custom-domain status and DNS targets.

Changes:

  • Extend static website config/types with an optional customDomains array.
  • Update deploy planning/apply to diff desired vs existing custom domains and call Add/Remove RPCs, while only removing SDK-owned domains.
  • Add tailor-sdk staticwebsite domain get|list commands and document the new functionality.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
packages/sdk/src/types/staticwebsite.generated.ts Adds customDomains to the generated StaticWebsite type.
packages/sdk/src/parser/service/staticwebsite/schema.ts Extends the Zod schema to accept customDomains.
packages/sdk/src/cli/shared/readonly-guard.test.ts Marks new domain subcommands as read/local-safe.
packages/sdk/src/cli/commands/staticwebsite/index.ts Registers the staticwebsite domain subcommand.
packages/sdk/src/cli/commands/staticwebsite/domain/status.ts Adds status label mapping for custom domain statuses.
packages/sdk/src/cli/commands/staticwebsite/domain/list.ts Implements staticwebsite domain list.
packages/sdk/src/cli/commands/staticwebsite/domain/index.ts Adds the domain command group for staticwebsite.
packages/sdk/src/cli/commands/staticwebsite/domain/get.ts Implements staticwebsite domain get.
packages/sdk/src/cli/commands/deploy/staticwebsite.ts Plans/applies custom domain changes alongside static websites.
packages/sdk/src/cli/commands/deploy/staticwebsite.test.ts Adds planning tests for custom domain diffing/ownership behavior.
packages/sdk/src/cli/commands/deploy/deploy.ts Prints/summarizes the new custom domain changeset in plans.
packages/sdk/src/cli/commands/deploy/deploy.test.ts Updates empty plan results to include the custom domain changeset.
packages/sdk/docs/services/staticwebsite.md Documents customDomains and the new inspection command.
packages/sdk/docs/cli/staticwebsite.md Adds docs for staticwebsite domain commands.
packages/sdk/docs/cli-reference.md Adds custom domain commands to the CLI reference table.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/sdk/src/cli/commands/deploy/staticwebsite.ts
Comment thread packages/sdk/src/cli/commands/deploy/staticwebsite.ts
Comment thread packages/sdk/src/cli/commands/deploy/staticwebsite.ts
Comment thread packages/sdk/src/cli/commands/staticwebsite/domain/index.ts Outdated
Comment thread packages/sdk/src/cli/commands/deploy/staticwebsite.test.ts
@github-actions

This comment has been minimized.

@haru0017
haru0017 force-pushed the feat/staticwebsite-custom-domain branch from bfd2fd8 to 545f74b Compare June 9, 2026 09:03
@github-actions

This comment has been minimized.

@haru0017
haru0017 marked this pull request as ready for review June 9, 2026 09:09

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📖 Docs Consistency Check

⚠️ Inconsistencies Found

File Issue Suggested Fix
packages/sdk/docs/services/staticwebsite.md Missing documentation about SDK-managed vs console-managed domain behavior Add a section explaining that only SDK-managed domains are removed during deployment, and console-added domains persist

Details

1. Missing SDK-managed domain behavior documentation

Location: packages/sdk/docs/services/staticwebsite.md, line 65-75 (customDomains section)

Issue: The documentation does not explain the important distinction between SDK-managed and console-managed custom domains. According to the implementation (packages/sdk/src/cli/commands/deploy/staticwebsite.ts:299-329), the deploy logic:

  1. Only removes domains that are labeled as SDK-managed (tracked via labels with sdk-name, sdk-version, and sdk-app-id)
  2. Never removes domains added through the console UI
  3. Only performs removal when customDomains is explicitly specified in the config

Current documentation:

### customDomains

Associate custom domains with the static website:

```typescript
defineStaticWebSite("my-website", {
  customDomains: ["app.example.com"],
});

After deploying, use tailor-sdk staticwebsite domain get <domain> to check domain status and retrieve the CNAME targets required for DNS configuration.


**Suggested fix:** Add behavior documentation after the example:

```markdown
### customDomains

Associate custom domains with the static website:

```typescript
defineStaticWebSite("my-website", {
  customDomains: ["app.example.com"],
});

After deploying, use tailor-sdk staticwebsite domain get <domain> to check domain status and retrieve the CNAME targets required for DNS configuration.

SDK-managed vs Console-managed Domains:

Custom domains can be added through the SDK (via customDomains config) or through the console UI. The SDK only manages domains it created:

  • SDK-managed domains: Domains specified in customDomains are tracked by the SDK. If you remove a domain from the config, it will be deleted from the workspace on the next deploy.
  • Console-managed domains: Domains added through the console are never modified or removed by SDK deployments, even if customDomains is specified.
  • Omitting customDomains: If you don't specify customDomains in your config, all existing domains (both SDK-managed and console-managed) remain untouched during deployment.

This allows you to use both the SDK and console to manage domains on the same website without conflicts.


**Reference:** Implementation at `packages/sdk/src/cli/commands/deploy/staticwebsite.ts:299-329`, particularly the comment on line 322: "Only remove SDK-owned domains not in desired if customDomains is explicitly specified"

### Recommended Actions

1. Add the SDK-managed vs console-managed domain behavior section to `packages/sdk/docs/services/staticwebsite.md`
2. Consider adding a brief note in the deploy command documentation about this behavior if users are likely to be surprised by it

### What Was Checked

✅ **CLI command signatures** (`staticwebsite domain get`, `staticwebsite domain list`)
- Argument names, types, and descriptions match between implementation and documentation
- Options and their descriptions are consistent

✅ **CLI reference index** (`packages/sdk/docs/cli-reference.md`)
- New commands are listed with correct descriptions and links

✅ **Configuration API** (`customDomains` option)
- Type signature matches (`string[]` optional)
- Example code in documentation is valid

✅ **Generated types** (`packages/sdk/src/types/staticwebsite.generated.ts`)
- Generated type matches the schema definition

✅ **Service documentation structure**
- New `customDomains` section added with example
- Reference to CLI commands for checking domain status

⚠️ **Behavior documentation** (incomplete)
- Missing explanation of SDK-managed vs console-managed domain lifecycle

> Re-run this check by adding the `docs-check` label to the PR.

---
<!-- docs-consistency-check -->

Comment thread packages/sdk/docs/services/staticwebsite.md
Comment thread packages/sdk/src/cli/commands/staticwebsite/domain/index.ts Outdated
@haru0017
haru0017 requested a review from toiroakr June 10, 2026 00:38
@github-actions

Copy link
Copy Markdown

Code Metrics Report (packages/sdk)

main (7249602) #1367 (f0fa0a8) +/-
Coverage 66.0% 66.0% -0.1%
Code to Test Ratio 1:0.4 1:0.4 -0.1
Details
  |                    | main (7249602) | #1367 (f0fa0a8) |  +/-  |
  |--------------------|----------------|-----------------|-------|
- | Coverage           |          66.0% |           66.0% | -0.1% |
  |   Files            |            398 |             402 |    +4 |
  |   Lines            |          13769 |           13843 |   +74 |
+ |   Covered          |           9095 |            9142 |   +47 |
- | Code to Test Ratio |          1:0.4 |           1:0.4 |  -0.1 |
  |   Code             |          91692 |           92114 |  +422 |
+ |   Test             |          39822 |           40001 |  +179 |

Code coverage of files in pull request scope (83.2% → 79.0%)

Files Coverage +/- Status
packages/sdk/src/cli/commands/deploy/deploy.ts 84.3% +0.0% modified
packages/sdk/src/cli/commands/deploy/staticwebsite.ts 88.5% +8.9% modified
packages/sdk/src/cli/commands/staticwebsite/domain/get.ts 7.1% +7.1% added
packages/sdk/src/cli/commands/staticwebsite/domain/index.ts 100.0% +100.0% added
packages/sdk/src/cli/commands/staticwebsite/domain/list.ts 7.1% +7.1% added
packages/sdk/src/cli/commands/staticwebsite/domain/status.ts 100.0% +100.0% added
packages/sdk/src/cli/commands/staticwebsite/index.ts 50.0% 0.0% modified
packages/sdk/src/parser/service/staticwebsite/schema.ts 100.0% 0.0% modified

SDK Configure Bundle Size

main (7249602) #1367 (f0fa0a8) +/-
configure-index-size 19.37KB 19.37KB 0KB
dependency-chunks-size 35.31KB 35.31KB 0KB
total-bundle-size 54.68KB 54.68KB 0KB

Runtime Performance

main (7249602) #1367 (f0fa0a8) +/-
Generate Median 2,780ms 2,774ms -6ms
Generate Max 2,918ms 2,807ms -111ms
Apply Build Median 2,841ms 2,821ms -20ms
Apply Build Max 2,898ms 2,844ms -54ms

Type Performance (instantiations)

main (7249602) #1367 (f0fa0a8) +/-
tailordb-basic 34,181 34,188 7
tailordb-optional 3,841 3,841 0
tailordb-relation 5,921 5,921 0
tailordb-validate 2,566 2,566 0
tailordb-hooks 5,767 5,767 0
tailordb-object 12,136 12,136 0
tailordb-enum 2,462 2,462 0
resolver-basic 9,424 9,424 0
resolver-nested 26,111 26,111 0
resolver-array 18,187 18,187 0
executor-schedule 4,234 4,234 0
executor-webhook 873 873 0
executor-record 6,659 6,659 0
executor-resolver 4,369 4,369 0
executor-operation-function 868 868 0
executor-operation-gql 869 869 0
executor-operation-webhook 888 888 0
executor-operation-workflow 1,714 1,714 0

Reported by octocov

@toiroakr toiroakr left a comment

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.

LGTM👍
Thank you!

@toiroakr
toiroakr merged commit ae57c55 into main Jun 10, 2026
40 checks passed
@toiroakr
toiroakr deleted the feat/staticwebsite-custom-domain branch June 10, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants