Skip to content

welcome tanstack start - #1

Merged
viqueen merged 11 commits into
mainfrom
feature/welcome-tanstack-start
Jul 25, 2026
Merged

welcome tanstack start#1
viqueen merged 11 commits into
mainfrom
feature/welcome-tanstack-start

Conversation

@viqueen

@viqueen viqueen commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Rebuilds the template on TanStack Start and turns it into a content-driven
starter: a landing page and an MDX blog, server-rendered and statically
prerendered. The structure mirrors the sibling labset/startup web/apps/site
app and folds in the practices from the "building this site" post.

What's included

  • TanStack Start + Router — file-based routing, an __root.tsx document
    shell, and getRouter(); no index.html. Route files stay thin and point at
    dedicated page components.
  • MDX content layer — posts live under src/content/posts/YYYY/MM/*.mdx,
    discovered with import.meta.glob, with meta validated at build time and an
    author registry. (No Shiki, by choice.)
  • Static prerendering (SSG) — the whole site is crawled from the homepage to
    HTML (crawlLinks), plus an explicit prerendered /404.
  • SEOsocialMeta() OG/Twitter tags + self-referencing canonical links,
    per route. SITE_URL lives in src/lib/site.ts.
  • Dark mode — pre-paint inline theme script (no flash) + a system-aware
    toggle backed by useSyncExternalStore.
  • Canonical shadcn components — the real base-luma button, card, badge,
    sheet, separator (not hand-rolled), each actually used. Fixes an invalid
    type="button" that hand-rolled anchors were emitting.
  • Organised components — grouped by domain (ui/, mdx/, layout/,
    home/, blog/) instead of loose files.
  • Docs — README rewritten for the template.

Structure

src/
├── components/{ui,mdx,layout,home,blog}/
├── content/            # posts.ts loader + authors.ts + posts/YYYY/MM/*.mdx
├── providers/theme/    # context, provider, hook
├── lib/                # site.ts (SITE_URL + socialMeta), utils.ts
├── routes/             # __root, index, 404, blog/{index,$slug}
└── router.tsx, index.css, mdx-env.d.ts

Tooling

  • src/routeTree.gen.ts is gitignored; build is vite build && tsc -b so the
    tree is generated before the type-check.
  • ESLint relaxes react-refresh/only-export-components only for ui/**.

Testing

  • pnpm build — passes, prerenders 8 static pages (home, /blog, 3 posts,
    /404, /#features)
  • tsc -b — passes
  • pnpm lint — passes

Notes

  • Set SITE_URL in src/lib/site.ts (currently https://example.com) to
    your deployed origin before shipping — it drives canonical + OG URLs.
  • Deploy dist/client/ for a static host.

🤖 Generated with Claude Code

viqueen and others added 11 commits July 24, 2026 16:58
Migrate the Vite SPA to TanStack Start (SSR + file-based routing):
- Add @tanstack/react-start and @tanstack/react-router
- Wire tanstackStart() into vite.config.ts (keep manual @ alias)
- Add src/router.tsx, __root.tsx document shell, and index route
- Move the landing page from App.tsx into src/routes/index.tsx
- Drop index.html and main.tsx (root route owns the document)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Sample blog posts in src/data/posts.ts
- Server functions (createServerFn) getPosts/getPost in src/lib/blog.ts
- Landing route: hero + blog stream, loaded via route loader (SSR)
- Post detail route blog.$slug.tsx with notFound handling
- Drop leftover Vite-template App.css and logo assets
- eslint: ignore generated route tree, allow _-prefixed unused vars,
  disable react-refresh only-export-components for routes and ui dirs

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Restructure the template to mirror labset/startup's web/apps/site and
fold in the practices from the "building this site" post.

Structure:
- content/ owns the MDX loader (posts.ts) + authors.ts, with meta validation
- providers/theme/ split into context, hook, provider, barrel
- dedicated page components (landing-page, blog-index, blog-post-page,
  not-found) with thin routes pointing at them
- root-document + site-layout + site-header/footer shells
- components/mdx/ for the element map and a sample Callout
- routes/blog/ dir (index + $slug) and a prerendered 404 route

Best practices:
- MDX content layer via import.meta.glob (no Shiki, per choice)
- static prerendering (crawlLinks) + explicit /404 page
- full SEO: socialMeta() OG/Twitter tags + self-referencing canonical
- dark mode via useSyncExternalStore + pre-paint inline theme script

Tooling:
- gitignore the generated src/routeTree.gen.ts; build is "vite build && tsc -b"
  so the tree is generated before typecheck
- eslint only relaxes react-refresh for ui/**; tsconfig keeps baseUrl with
  ignoreDeprecations "6.0"

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the hand-rolled ui primitives with the real shadcn (base-luma)
components from the site app, and make sure each is actually used.

- button: forward render + nativeButton, so `render={<a/>}` no longer emits
  an invalid type="button" on anchors (now role="button")
- badge: canonical useRender-based variant set (default/secondary/outline/
  ghost/link/destructive)
- card: canonical size-aware Card with Header/Title/Description/Content/
  Footer/Action
- sheet: canonical four-side sheet with built-in close, Header/Footer/Title/
  Description
- add a features section that uses Card + Badge (Card was previously unused)
  and link it from the header/footer nav

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the stock Vite boilerplate with docs for this template: stack,
source structure, how to write MDX posts, prerendering, SEO, and the
dev/build workflow.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Group the loose files under src/components/ by domain instead of leaving
them flat, alongside the existing ui/ and mdx/:
- layout/ — root-document, site-layout, site-header/footer, theme-toggle, not-found
- home/   — landing-page, hero-section, features-section, latest-posts-section
- blog/   — blog-index, blog-post, blog-post-page, post-card

Rewrite the @/components import paths and update the README structure.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@viqueen
viqueen merged commit e64ec28 into main Jul 25, 2026
1 check passed
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.

1 participant