Repository navigation
feat: slug reservation flow (CLI DX v2, PR-B of 2) #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,22 @@ | ||
| import Link from "next/link" | ||
| import { notFound } from "next/navigation" | ||
|
|
||
| export default function TenantNotFound() { | ||
| return ( | ||
| <div className="flex min-h-svh flex-col items-center justify-center px-4"> | ||
| <h1 className="text-2xl font-bold tracking-tight"> | ||
| Help center not found | ||
| </h1> | ||
| <p className="mt-3 text-muted-foreground"> | ||
| This subdomain hasn't been set up yet. | ||
| </p> | ||
| <a | ||
| href="https://helpbase.dev" | ||
| className="mt-6 rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background transition-opacity hover:opacity-90" | ||
| > | ||
| Create your help center | ||
| </a> | ||
| </div> | ||
| ) | ||
| /** | ||
| * Tenant "not found" page. Rendered by the subdomain middleware for: | ||
| * - unknown subdomains (never-existed tenants) | ||
| * - reserved tenants at deep-link paths (articles/search/etc. — root | ||
| * `/` still routes to the branded "coming soon" landing) | ||
| * | ||
| * Calling `notFound()` is the load-bearing bit: Next.js converts it into | ||
| * a true HTTP 404 response (not a 200 with "not found" copy). That | ||
| * matters because middleware-level rewrites preserve the destination's | ||
| * status, and we want crawlers + MCP clients + monitoring tools hitting | ||
| * unknown or reserved subdomain paths to see "nope, nothing here" at | ||
| * the protocol level, not "here's a page that claims nothing is here." | ||
| * The previous implementation rendered a 200 HTML page with a "Create | ||
| * your help center" CTA; that CTA can come back as a proper | ||
| * `not-found.tsx` route later. Ship correctness first. | ||
| * Caught by /review codex on 2026-04-18. | ||
| */ | ||
| export default function TenantNotFound(): never { | ||
| notFound() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| import type { Metadata } from "next" | ||
|
|
||
| /** | ||
| * Reserved-tenant landing page. | ||
| * | ||
| * Rendered by the subdomain middleware (proxy.ts) when a subdomain | ||
| * matches a tenant row whose `deployed_at` is still null — meaning the | ||
| * owner logged in and got an auto-provisioned reservation but hasn't | ||
| * published content yet. Anyone visiting the URL sees this page instead | ||
| * of an empty category grid, and the response carries X-Robots-Tag: | ||
| * noindex so Google doesn't index placeholder subdomains. | ||
| * | ||
| * Intentionally minimal: no Supabase lookup (the middleware already | ||
| * confirmed the slug exists), no owner email leakage, no admin info. | ||
| * The slug in the URL is the only identifier shown. | ||
| */ | ||
|
|
||
| export const metadata: Metadata = { | ||
| robots: { index: false, follow: false }, | ||
| title: "Coming soon", | ||
| } | ||
|
|
||
| // Static — no per-slug data is fetched, everything the page needs lives | ||
| // in the URL segment. `revalidate` can be any value since nothing varies. | ||
| export const revalidate = 3600 | ||
|
|
||
| export default async function ReservedTenantPage({ | ||
| params, | ||
| }: { | ||
| params: Promise<{ slug: string }> | ||
| }) { | ||
| const { slug } = await params | ||
| // Keep in sync with proxy.ts. The apex stays configurable so staging | ||
| // (e.g. helpbase-dev.vercel.app) and self-hosted setups don't render | ||
| // a page advertising the wrong hostname. CodeRabbit flagged the hard | ||
| // coded "helpbase.dev" string on PR #10. | ||
| const rootDomain = (process.env.NEXT_PUBLIC_ROOT_DOMAIN ?? "helpbase.dev").trim() | ||
| const displayHost = `${slug}.${rootDomain}` | ||
|
|
||
| return ( | ||
| <div className="mx-auto flex min-h-svh w-full max-w-xl flex-col items-center justify-center px-6 py-16"> | ||
| <div className="w-full text-center"> | ||
| <p className="text-xs font-semibold uppercase tracking-[0.2em] text-muted-foreground"> | ||
| helpbase | ||
| </p> | ||
| <h1 className="mt-6 text-3xl font-semibold tracking-tight"> | ||
| This help center isn't live yet | ||
| </h1> | ||
| <p className="mt-4 text-base text-muted-foreground"> | ||
| <span className="font-mono text-foreground">{displayHost}</span>{" "} | ||
| has been reserved. The owner needs to publish content before visitors | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| see anything here. | ||
| </p> | ||
|
|
||
| <div className="mt-10 rounded-xl border border-border bg-muted/30 p-5 text-left"> | ||
| <p className="text-sm font-medium">If this is your help center</p> | ||
| <p className="mt-2 text-sm text-muted-foreground"> | ||
| Run the helpbase CLI from your project root to publish: | ||
| </p> | ||
| <pre className="mt-3 overflow-x-auto rounded-lg bg-background px-4 py-3 text-xs"> | ||
| <code>{`helpbase deploy`}</code> | ||
| </pre> | ||
| <p className="mt-3 text-xs text-muted-foreground"> | ||
| Prefer a different subdomain? Run{" "} | ||
| <code className="font-mono">helpbase rename <new-slug></code>{" "} | ||
| before your first deploy. | ||
| </p> | ||
| </div> | ||
|
|
||
| <p className="mt-10 text-sm text-muted-foreground"> | ||
| Learn more at{" "} | ||
| <a | ||
| href="https://helpbase.dev" | ||
| className="underline underline-offset-4 hover:text-foreground" | ||
| > | ||
| helpbase.dev | ||
| </a> | ||
| </p> | ||
| </div> | ||
| </div> | ||
| ) | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.