Skip to content

feat(template-generator): upgrade template deps to latest and harden docker templates - #1098

Merged
AmanVarshney01 merged 3 commits into
mainfrom
feat/template-deps-docker-hardening
Jul 4, 2026
Merged

AmanVarshney01 merged 3 commits into
mainfrom
feat/template-deps-docker-hardening

Conversation

@AmanVarshney01

@AmanVarshney01 AmanVarshney01 commented Jul 2, 2026 •

Copy link
Copy Markdown
Owner

Dependency upgrades

Majors (with required code migrations)

  • React Router v7 → v8.1 — all @react-router/* packages bumped; removed the v8_middleware future flag (default in v8). Template code needed no changes: imports already come from react-router only, and meta() doesn't use the removed data arg. react-router-devtools ^1 → ^6 and @clerk/react-router → ^3.5.4 (both RR8-compatible).
  • vite-plus 0.1.24 → 0.2.2 — 0.2 bundles vitest directly and discontinued @voidzero-dev/vite-plus-test (stopped at 0.1.24), so the vitest override alias is removed; the vite → vite-plus-core alias stays. rolldown → 1.1.4.
  • @tanstack/svelte-query v5 → v6 — migrated svelte templates to the runes API: options are thunks (createQuery(() => opts)) and results drop the $ store prefix. QueryClientProvider/QueryClient usage unchanged.
  • @hono/node-server ^2 (only breaking: Node 18 drop + Vercel adapter removal; templates only use serve), stripe SDKs ^9/^6 (no template code touches them), shiki ^4, nx ^23 (generated nx.json schema unchanged).

Minors

~140 minor/patch bumps across dependencyVersionMap and hbs template pins (vite 8.1.3, heroui-native 1.0.5, uniwind 1.10, SvelteKit 2.69, @nuxt/ui 4.9, TanStack Router 1.170/Start 1.168, tRPC 11.18, hono 4.12, clerk, react-query unified at ^5.101.2, oxlint/oxfmt, wrangler, zod, …).

Deliberately untouched

All Expo/native pins — verified against Expo SDK 57's bundledNativeModules.json (incl. react-native-gesture-handler ~2.32.0; v3 is not supported by SDK 57). @babel/core stays on 7 for babel-preset-expo. Also removed an orphaned @types/three from the electrobun desktop template.

Docker template fixes (from a full combination audit)

  • Guard desktop addons + --web-deploy docker — tauri/electrobun switch next/svelte/astro to static export, which broke the SSR docker images at build time. New CLI validation rejects the combo (keeps the working next+electrobun+convex+better-auth case).
  • Next standalone runner now copies public/ when the pwa addon emits it (standalone output excludes it → manifest/icons 404'd in-container).
  • Root .env generated for compose build args — ${CONVEX_URL:-}/${CLERK_PUBLISHABLE_KEY:-} interpolate from the project root, but only apps/web/.env was scaffolded, so images were silently built with empty values.
  • Pinned DB images (postgres:18, mysql:8.4, mongo:8) in deploy + db-setup composes — postgres:18 also matches the /var/lib/postgresql volume layout the templates use. Pinned pnpm@11 in Dockerfiles to avoid lockfile-format drift.
  • Web service healthcheck added to generated docker-compose (wget for nginx-served SPAs, node fetch for node runners).

Verification

  • bun run generate-templates regenerated (506 templates)
  • bun run check clean
  • template-generator tsc --noEmit clean
  • CLI suite: 641 pass / 0 fail (updated hardcoded version expectations in 5 test files)

Not addressed (follow-up candidate): single-stage server/web images ship the full monorepo + dev deps (size/hygiene, not correctness).

Summary by CodeRabbit

  • New Features

    • Added Docker web-deploy compatibility validation for incompatible desktop addon/static-export combinations.
    • Docker deployments can now generate a root .env containing compose build-arg values when applicable.
  • Bug Fixes

    • Improved Docker Compose health checks and pinned database container image tags.
    • Updated Docker templates (including pnpm pinning and Next public asset handling) and refreshed UI query/mutation bindings for newer frontend behavior.
  • Chores

    • Updated template dependency versions and adjusted generated package override behavior.
  • Tests

    • Updated scaffold and generation test expectations to match new version outputs.

…docker templates

Dependency upgrades:
- react-router v7 -> v8 (imports unchanged; drop v8_middleware future flag, now default)
- react-router-devtools ^1 -> ^6, @clerk/react-router ^3.5 (RR8-compatible)
- vite-plus 0.1.24 -> 0.2.2; drop discontinued vite-plus-test vitest override
- @tanstack/svelte-query v5 -> v6: thunk options + runes results in svelte templates
- @hono/node-server ^2, stripe SDKs (^9/^6), shiki ^4, nx ^23
- ~140 minor/patch bumps across dependencyVersionMap and template pins
- expo/native pins left untouched (verified against SDK 57 bundledNativeModules)
- remove unused @types/three from electrobun desktop template

Docker template fixes:
- block webDeploy=docker with tauri/electrobun on next/svelte/astro (desktop
  addons force static export, breaking the SSR docker images)
- copy public/ into next standalone runner when pwa addon emits it
- generate root .env for compose build-arg interpolation (CONVEX_URL,
  CLERK_PUBLISHABLE_KEY were silently baked empty)
- pin db images (postgres:18, mysql:8.4, mongo:8) and pnpm@11 in Dockerfiles
- add web service healthcheck to generated docker-compose
@vercel

vercel Bot commented Jul 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
create-better-t-stack-web Ready Ready Preview, Comment Jul 4, 2026 12:28pm

Request Review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cbd68da6ce

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@coderabbitai

coderabbitai Bot commented Jul 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6257749b-4efb-4b6c-943b-b9d13e9b79c7

📥 Commits

Reviewing files that changed from the base of the PR and between 1d21818 and 728e7e6.

📒 Files selected for processing (3)
  • packages/template-generator/src/templates.generated.ts
  • packages/template-generator/src/utils/add-deps.ts
  • packages/template-generator/templates/frontend/react/react-router/package.json.hbs
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/template-generator/templates/frontend/react/react-router/package.json.hbs
  • packages/template-generator/src/utils/add-deps.ts
  • packages/template-generator/src/templates.generated.ts

Walkthrough

This PR adds a Docker web-deploy compatibility check, updates template-generator dependency pins and tests, changes Docker template outputs, generates root .env values for Docker builds, and refactors Svelte template query usage to direct query and mutation instance access.

Changes

Docker Web Deploy Compatibility Validation

Layer / File(s) Summary
Validator implementation and wiring
apps/cli/src/utils/compatibility-rules.ts, apps/cli/src/utils/config-validation.ts
Adds validateDockerWebDeployDesktopAddons and calls it from validateFullConfig.

Template Generator Updates

Layer / File(s) Summary
Dependency pins and assertions
packages/template-generator/src/utils/add-deps.ts, packages/template-generator/templates/frontend/*/package.json.hbs, packages/template-generator/templates/packages/ui/package.json.hbs, apps/cli/test/*.test.ts, packages/template-generator/templates/addons/electrobun/apps/desktop/package.json.hbs, packages/template-generator/src/templates.generated.ts
Bumps dependency versions in generator maps and templates, removes @types/three from electrobun desktop outputs, and updates matching test assertions.
Vite-plus overrides
packages/template-generator/src/post-process/package-configs.ts, apps/cli/test/addons.test.ts
Removes the vitest override for vite-plus and adjusts related test expectations.
Docker template outputs
packages/template-generator/templates/deploy/docker/**/Dockerfile.hbs, packages/template-generator/templates/deploy/docker/compose/docker-compose.yml.hbs, packages/template-generator/templates/db-setup/docker-compose/*/docker-compose.yml.hbs, packages/template-generator/src/processors/env-vars.ts, packages/template-generator/src/templates.generated.ts
Pins pnpm to 11, pins database images, adds web healthchecks, updates build args and root .env generation, and copies public into the Next.js runner image.
Svelte query access patterns
packages/template-generator/templates/auth/better-auth/web/svelte/.../+page.svelte.hbs, packages/template-generator/templates/frontend/svelte/src/routes/+page.svelte.hbs, packages/template-generator/templates/examples/todo/web/svelte/.../+page.svelte.hbs, packages/template-generator/src/templates.generated.ts
Switches Svelte templates from $store access to direct query/mutation instance properties and updates refetch, disabled-state, and error handling paths.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: dependency upgrades and Docker template hardening.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🧹 Nitpick comments (1)
packages/template-generator/templates/deploy/docker/web/astro/Dockerfile.hbs (1)

6-6: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider pinning an exact pnpm patch version rather than just the major.

pnpm@11 floats to the latest 11.x release on every build, which can silently break reproducibility if a future 11.x patch introduces a behavior change (pnpm 11 already required config migrations from v10). Pinning an exact version (e.g. pnpm@11.9.0) would make builds fully reproducible while still getting the intended major-version behavior.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 66d8b9fb-965d-4076-a696-e7a8d785e434

📥 Commits

Reviewing files that changed from the base of the PR and between 0ca6f35 and cbd68da.

📒 Files selected for processing (39)
  • apps/cli/src/utils/compatibility-rules.ts
  • apps/cli/src/utils/config-validation.ts
  • apps/cli/test/addons.test.ts
  • apps/cli/test/auth.test.ts
  • apps/cli/test/clerk-matrix.test.ts
  • apps/cli/test/electrobun-addon.test.ts
  • apps/cli/test/external-commands.test.ts
  • packages/template-generator/src/post-process/package-configs.ts
  • packages/template-generator/src/processors/env-vars.ts
  • packages/template-generator/src/templates.generated.ts
  • packages/template-generator/src/utils/add-deps.ts
  • packages/template-generator/templates/addons/electrobun/apps/desktop/package.json.hbs
  • packages/template-generator/templates/auth/better-auth/web/svelte/src/routes/dashboard/+page.svelte.hbs
  • packages/template-generator/templates/db-setup/docker-compose/mongodb/docker-compose.yml.hbs
  • packages/template-generator/templates/db-setup/docker-compose/mysql/docker-compose.yml.hbs
  • packages/template-generator/templates/db-setup/docker-compose/postgres/docker-compose.yml.hbs
  • packages/template-generator/templates/deploy/docker/compose/docker-compose.yml.hbs
  • packages/template-generator/templates/deploy/docker/server/Dockerfile.hbs
  • packages/template-generator/templates/deploy/docker/web/astro/Dockerfile.hbs
  • packages/template-generator/templates/deploy/docker/web/nuxt/Dockerfile.hbs
  • packages/template-generator/templates/deploy/docker/web/react/next/Dockerfile.hbs
  • packages/template-generator/templates/deploy/docker/web/react/react-router/Dockerfile.hbs
  • packages/template-generator/templates/deploy/docker/web/react/tanstack-router/Dockerfile.hbs
  • packages/template-generator/templates/deploy/docker/web/react/tanstack-start/Dockerfile.hbs
  • packages/template-generator/templates/deploy/docker/web/solid/Dockerfile.hbs
  • packages/template-generator/templates/deploy/docker/web/svelte/Dockerfile.hbs
  • packages/template-generator/templates/examples/todo/web/svelte/src/routes/todos/+page.svelte.hbs
  • packages/template-generator/templates/frontend/astro/package.json.hbs
  • packages/template-generator/templates/frontend/native/uniwind/package.json.hbs
  • packages/template-generator/templates/frontend/nuxt/package.json.hbs
  • packages/template-generator/templates/frontend/react/next/package.json.hbs
  • packages/template-generator/templates/frontend/react/react-router/package.json.hbs
  • packages/template-generator/templates/frontend/react/react-router/react-router.config.ts
  • packages/template-generator/templates/frontend/react/tanstack-router/package.json.hbs
  • packages/template-generator/templates/frontend/react/tanstack-start/package.json.hbs
  • packages/template-generator/templates/frontend/solid/package.json.hbs
  • packages/template-generator/templates/frontend/svelte/package.json.hbs
  • packages/template-generator/templates/frontend/svelte/src/routes/+page.svelte.hbs
  • packages/template-generator/templates/packages/ui/package.json.hbs
💤 Files with no reviewable changes (3)
  • apps/cli/test/electrobun-addon.test.ts
  • packages/template-generator/templates/frontend/react/react-router/react-router.config.ts
  • packages/template-generator/templates/addons/electrobun/apps/desktop/package.json.hbs

Comment thread apps/cli/test/auth.test.ts Resolved
…t public dir

- compose build args now interpolate the same frontend-prefixed env names
  users fill in apps/web/.env (NEXT_PUBLIC_/VITE_/PUBLIC_ variants), and the
  generated root .env mirrors those names
- next docker runner always copies public/ (user-added static assets), with
  mkdir -p in the builder so the copy never fails when the dir is absent
@AmanVarshney01

Copy link
Copy Markdown
Owner Author

Addressed review comments in 1d21818:

  • Codex (Clerk env key) — valid. Compose build args now interpolate the same frontend-prefixed names users are told to fill (NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY/VITE_CLERK_PUBLISHABLE_KEY, same for the Convex URL), and the generated root .env mirrors those names.
  • CodeRabbit (next public/) — right concern, but the committable suggestion would break every non-PWA build: the base next template has no public/ dir and COPY from a nonexistent path fails. Implemented as RUN mkdir -p apps/web/public in the builder + unconditional copy in the runner, so PWA assets and any user-added static files are always included.
  • CodeRabbit (add nuxt to DOCKER_SERVER_OUTPUT_FRONTENDS) — not applied. Unlike next/svelte/astro, the desktop addons don't switch nuxt.config.ts to a static preset; the desktop bundle uses the separate generate script while the docker image still runs build and gets a full .output server. The combo works.
  • CodeRabbit (auth.test.ts 1.6.15) — not applied. That assertion covers the Convex Better Auth path, which intentionally pins better-auth to 1.6.15 (CONVEX_BETTER_AUTH_VERSION in auth-deps.ts — the version @convex-dev/better-auth is tested against), separate from the main dependencyVersionMap entry. The test passes.

…in peer ranges

Codex review findings, verified against npm peer metadata and proven with strict-peer npm installs:
- @polar-sh/better-auth@1.8.4 peers @polar-sh/sdk ^0.47.0 and @polar-sh/checkout@0.4.0 peers stripe react <=^5.6.1 / stripe-js <=^8.11.0, so the ^0.48.1/^6.7.0/^9.9.0 bumps made fresh polar scaffolds fail npm installs with ERESOLVE; pins now sit at the top of the supported ranges (^0.47.1/^5.6.1/^8.11.0)
- react-router-devtools@6.2.1 (latest) depends on @tanstack/devtools-vite ^0.4.1, which peers vite ^6||^7 only, so the react-router template pins vite ^7.3.6 (RR8 supports ^7||^8) until a devtools release supports vite 8
Both combos re-verified: npm installs clean, react-router app builds on vite 7.
@AmanVarshney01
AmanVarshney01 merged commit 6672565 into main Jul 4, 2026
3 checks passed
@AmanVarshney01
AmanVarshney01 deleted the feat/template-deps-docker-hardening branch July 4, 2026 13:54

This branch was successfully deployed

1 active deployment
Preview — 728e7e62 Deployed Jul 4, 2026 by vercel[bot]
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