docs(start): add hostname-based multi-tenancy tutorial#6809
docs(start): add hostname-based multi-tenancy tutorial#6809harshG775 wants to merge 7 commits intoTanStack:mainfrom
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new React tutorial and its config entry: a "Multi-Tenancy in TanStack Start: A Simple Guide" page covering hostname-based tenant resolution, SSR tenant detection, root-level data hydration, dynamic metadata, code examples, and production considerations. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
View your CI Pipeline Execution ↗ for commit ca94a81
☁️ Nx Cloud last updated this comment at |
Bundle Size Benchmarks
Trend sparkline is historical gzip bytes ending with this PR measurement; lower is better. |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/start/framework/react/tutorial/multi-tenant-setup.md`:
- Around line 98-104: The loader's catch block currently swallows all errors
from getTenantConfig; update the loader so it only converts 404/not-found errors
into { tenantConfig: null } and rethrows any other errors to avoid masking
outages—inside loader's try/catch, inspect the caught error (e.g., error.status
or error instanceof Response) and if it's a 404 return { tenantConfig: null },
otherwise throw the error; reference the loader function and the getTenantConfig
call when making the change.
- Around line 24-32: The fenced code block showing the request lifecycle
(containing "Request → Nitro Runtime → getRequestUrl() → normalizeHostname() →
getTenantConfigByHostname() → Root Loader → Hydrated Application") is missing a
language identifier; update the opening triple-backtick to include a language
token (for example change ``` to ```text) so the block is recognized as a
code/text fence by the linter.
- Around line 1-11: The YAML frontmatter contains an extra standalone '---'
divider in the middle (between description and the body) which breaks parsing;
open the frontmatter block that includes the title and description (the top YAML
block) and remove the stray '---' line so the frontmatter remains a single
contiguous YAML block (or move that divider to only appear once at the end of
the frontmatter), ensuring only the initial opening and final closing '---'
surround the title/description metadata.
- Standardize frontmatter quotes and formatting - Update code block language and arrow syntax - Convert list markers to hyphens for consistency - Apply single quotes in code examples for uniformity
Add error handling to catch specific errors when loading tenant configuration.
|
wouldnt recommend using root loader data for this. we should use router context instead. this will soon be much easier when we finalize the start context bridge concept. for now we'll keep this open |
…for hostname-based resolution
|
Thanks for the suggestion! I've updated the tutorial to resolve the tenant inside This should align better with the recommended architecture. |
Summary
Adds a new React tutorial: "Hostname-Based Multi-Tenancy" for TanStack Start.
What This Covers
Why
Multi-tenancy is a common SaaS requirement. This tutorial provides
a clean SSR-first approach aligned with TanStack Start architecture.
Tested locally against latest Start version.
Summary by CodeRabbit