Skip to content

Add grails-vite-spa v8 guide#500

Merged
jamesfredley merged 1 commit intomasterfrom
add-grails-vite-spa-v8
May 3, 2026
Merged

Add grails-vite-spa v8 guide#500
jamesfredley merged 1 commit intomasterfrom
add-grails-vite-spa-v8

Conversation

@jamesfredley
Copy link
Copy Markdown
Contributor

Summary

Final Grails 8 sample-app-flavour guide in the eight-guide series (PRs #479, #493, #494, #495, #496, #497, #498, #499). Two-tier integration: Grails 8 rest_api JSON backend plus a Vite + React SPA frontend in a single Gradle multi-project, packaged into one bootJar with the SPA served from the same origin as the API. Replaces the long-broken Webpack-era React/Vue profiles.

Greenfield - no upstream rename

New grails-guides/grails-vite-spa repo created public with grails8 as default branch. Vue 3 path is documented as a one-line plugin swap; the existing legacy react/vue repos are left alone.

What's in the PR

  • conf/guides.yml - new grails-vite-spa registry entry, alphabetical insertion before grails-vs-nodejs.
  • 14 chapter .adoc files.
  • Vendored snippets: settings.gradle, build.gradle (with frontendTasks tag), Book domain, UrlMappings, BookController, SpaController, two .gson views, frontend/{package.json, vite.config.js, index.html, src/main.jsx, src/App.jsx}.

Layout

backend/ is a Gradle subproject. frontend/ is plain npm; three root Gradle tasks (npmInstall, frontendBuild, copyFrontendToBackend) bridge the two halves. backend:processResources depends on copyFrontendToBackend, so plain ./gradlew :backend:bootJar produces a single jar serving SPA at / and API at /api/**.

Verification

  • ./gradlew validateGuides -PvalidationMode=both returns 86 guides, 0 errors.
  • ./gradlew renderGuide_grails_vite_spa_8 --rerun-tasks --no-configuration-cache renders all 14 chapter HTML pages, no Unresolved directive errors.

Series complete

This is the last of eight Grails 8 guides shipped as a stack of independent PRs: Tailwind (#493), Docker bootBuildImage (#494), GitHub Actions CI/CD (#495), REST Library API (#496), HTMX (#497), Multi-project (#498), Spock test tour (#499), and now Vite SPA (this one).

Two-tier integration guide: Grails 8 rest_api JSON backend plus a Vite/React SPA frontend in a single Gradle multi-project, packaged into one bootJar with the SPA served from the same origin as the API. Replaces the long-broken Webpack-era React/Vue profiles.

Greenfield - new grails-guides/grails-vite-spa repo created public on the grails8 default branch.

The 14 chapters cover the multi-project layout, the JSON backend (Book + RestfulController + JSON views), the SpaController forwarder for client-side routes, the Vite/React frontend, vite.config.js with /api proxy, the dev mode (two servers behind one origin), the prod build (one bootJar), and why CORS never appears.

Verified locally: validateGuides -PvalidationMode=both returns 86 guides 0 errors; renderGuide_grails_vite_spa_8 --rerun-tasks --no-configuration-cache renders all 14 chapter HTML pages, no Unresolved directive errors.

Assisted-by: claude-code:claude-opus-4-7
Copilot AI review requested due to automatic review settings May 3, 2026 22:54
@jamesfredley jamesfredley merged commit e698300 into master May 3, 2026
5 checks passed
@jamesfredley jamesfredley deleted the add-grails-vite-spa-v8 branch May 3, 2026 23:00
@jamesfredley jamesfredley review requested due to automatic review settings May 3, 2026 23:15
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