Skip to content

chore(auth): the production Clerk instance on patchyhq.com #480

Closed

Description

@allisonmahmood

Part of the launch (#416). HITL: Allison does this in the Clerk dashboard, Google Cloud and Vercel DNS.

Start it early. Clerk says DNS can take up to 48 hours to propagate, and #416 can't deploy without the live keys.

Why

The development instance borrows Clerk's domain and Google app, so it works with no setup. Production has to use ours. Sign-in cookies must belong to our domain, or browsers treat them as third-party and block them. Invitation and waitlist emails must come from patchyhq.com, or they land in spam.

Steps

  1. Pick the app hostname, for example cloud.patchyhq.com. It becomes PATCHY_PUBLIC_BASE_URL and CLERK_AUTHORIZED_PARTIES. The server only checks the authorized party when that setting is present (packages/auth/src/Session.ts), so set it.
  2. Create the production instance of the patchy-cloud Clerk application on that domain.
  3. Add the DNS records Clerk lists to patchyhq.com in Vercel DNS. Explicit records override the wildcard * ALIAS. Leave post, which is PatchPage, alone.
  4. Google sign-in: create a Google OAuth client named Patchy and paste its ID and secret into Clerk. Clerk's shared credentials are development-only. To offer email sign-in only, turn Google off and skip this.
  5. Session token claims: match the development instance. Patchy refuses a session whose token lacks email, and name must be present even if null (packages/auth/src/Session.ts, SessionClaims).
  6. Brand the emails Clerk sends: invitations, and the waitlist emails from chore(auth): private beta sign-up through Clerk's waitlist #481. Add the agent line from feat(server): the agent front door: /llms.txt, an installer and patchy setup #36 to the invitation and waitlist-approval emails: Tell your agent: Set up Patchy using https:///llms.txt.
  7. Store the keys: put pk_live_…, sk_live_… and the authorized party where feat(infra): production infrastructure in AWS CDK and the deploy workflow #415's secrets expect them. Record on this issue where they live, never the keys themselves.

Done when

Clerk's Domains page shows every record verified, and the live keys are where #415's deploy reads them.

Activity

  1. added
    ready-for-human
    on Oct 2, 2026
  2. allisonmahmood commented on Oct 2, 2026

    @allisonmahmood
    OwnerAuthor

    Production instance created 2026-10-02.

    • Instance: ins_3K9DquBVFdEZKMk6ewpjpCRD0Zm on the patchy-cloud Clerk app (app_3ImZuFeZJb8038U0oFds84rupA2), cloned from development.
    • Domain: patchyhq.com as the primary domain. Frontend API clerk.patchyhq.com, Account Portal accounts.patchyhq.com, mail from patchyhq.com. Home URL https://cloud.patchyhq.com, so sign-ups that don't carry a redirect land in the app.
    • App host: https://cloud.patchyhq.com, which is PATCHY_PUBLIC_BASE_URL and CLERK_AUTHORIZED_PARTIES.
    • DNS (Vercel): CNAMEs clerk, accounts, clkmail, clk._domainkey and clk2._domainkey. Clerk verified DNS and mail; clerk.patchyhq.com has its certificate.
    • Allowed subdomains is on, with cloud.patchyhq.com and accounts.patchyhq.com. post.patchyhq.com serves PatchPage pages that users publish, so other subdomains must not reach Clerk's Frontend API.
    • Session claims email and name cloned and checked. Apple and Microsoft are off because they have no production credentials. Google is on and waiting for its credentials.
    • Keys: ~/.config/patchy-cloud/prod.env on Allison's machine (mode 600), together with the public URL and authorized party. feat(infra): production infrastructure in AWS CDK and the deploy workflow #415 has no Secrets Manager yet, so chore(infra): the first deploy of Patchy to AWS #416 moves them there. Re-pull with clerk env pull --app app_3ImZuFeZJb8038U0oFds84rupA2 --instance prod --file <file>.

    Left:

    • Google OAuth client named Patchy (Allison): redirect URI https://clerk.patchyhq.com/v1/oauth_callback, publishing status In production, ID and secret into Clerk's custom credentials.
    • accounts.patchyhq.com certificate, which Clerk issues on its own.

    Email branding is deferred. Custom email templates need Clerk Pro, and we're staying on the free plan for now, so invitations use Clerk's default copy and the agent line lives on Patchy's own pages.

  3. allisonmahmood commented on Oct 2, 2026

    @allisonmahmood
    OwnerAuthor

    Done. Since the comment above:

    The live keys are in ~/.config/patchy-cloud/prod.env until #416 places them in Secrets Manager.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-human

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions