Add Next.js feature option and update documentation#439
Open
DiyRex wants to merge 4 commits into
Open
Conversation
… alongside the existing React/HTMX options.\nScaffolds a Next.js 15 app via create-next-app (App Router, TS,\nTailwind, ESLint, src/, @/* alias) and initializes shadcn/ui with\nbutton + card components. Writes frontend/.env.local with\nNEXT_PUBLIC_API_URL pointing at the Go backend and a next.config.mjs\nwith standalone output and an /api/* proxy rewrite.\n\nMutually exclusive with React and HTMX. Integrates with the docker\nand makefile templates (frontend service on :3000, make run starts\nboth Go + Next dev servers). Docs page added under advanced-flag/.
…s required by generator (filippo.io/edwards25519 v1.2.0\nneeds Go >= 1.24; golang.org/x/sys v0.43.0 needs Go >= 1.25) made\n'go get' fail inside freshly-generated projects on CI runners pinned\nto Go 1.23. With GOTOOLCHAIN=auto (default on Go 1.21+), bumping the\ngenerated go.mod's go directive to 1.25.0 lets the toolchain\ntransparently fetch a compatible Go version at install time.\n\nAlso bumps the go-blueprint repo's own go directive to 1.24.0 so\nbuilding the generator itself doesn't trip the same limit.
…tive deps required by generator (filippo.io/edwards25519 v1.2.0\nneeds Go >= 1.24; golang.org/x/sys v0.43.0 needs Go >= 1.25) made\n'go get' fail inside freshly-generated projects on CI runners pinned\nto Go 1.23. With GOTOOLCHAIN=auto (default on Go 1.21+), bumping the\ngenerated go.mod's go directive to 1.25.0 lets the toolchain\ntransparently fetch a compatible Go version at install time.\n\nAlso bumps the go-blueprint repo's own go directive to 1.24.0 so\nbuilding the generator itself doesn't trip the same limit." This reverts commit d308ab7.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.
Problem/Feature
Add Next.js as a first-class frontend option in the advanced-features set, alongside the existing React (Vite) and HTMX/Templ choices. Users who want a modern full-stack setup with App Router, TypeScript, Tailwind, and shadcn/ui can now scaffold everything with a single flag, wired up to the Go backend out of the box.
Description of Changes
--feature nextjsflag — addedNextjsconstant incmd/flags/advancedFeatures.goand appended it toAllowedAdvancedFeatures. Shows up automatically ingo-blueprint create --help.cmd/steps/steps.go).cmd/create.goandcmd/program/program.go.CreateNextJSProject()incmd/program/program.gothat:npx create-next-app@latest frontend --ts --app --eslint --src-dir --tailwind --use-npm --import-alias "@/*" --no-turbopacknpx shadcn@latest init -d) and addsbutton+cardas baseline componentsfrontend/.env.localwithNEXT_PUBLIC_API_URL=http://localhost:<PORT>(read from the project's root.env, same pattern used for React'sVITE_PORT)frontend/next.config.mjswithoutput: "standalone"and an/api/*→ Go backendrewrites()rule so server-side fetches work without CORSsrc/app/page.tsxwith a demo page using shadcn<Button>+<Card>that fetches from the Go backendcmd/template/advanced/files/nextjs/(page.tsx.tmpl,next.config.mjs.tmpl) and matching//go:embed+ accessors incmd/template/advanced/routes.go.{{ if .AdvancedOptions.nextjs }}blocks inDockerfile.tmpl(multi-stage build using Next's standalone output, runs on:3000) anddocker_compose.yml.tmpl(frontend service withNEXT_PUBLIC_API_URLpointing at theappservice).runtarget's conditional somake runboots both the Go server and the Next.js dev server. Templ/Tailwind build steps are correctly skipped whennextjsis selected.docs/docs/advanced-flag/nextjs.mdand nav entry indocs/mkdocs.yml. README's Advanced Features list and usage examples updated (satisfies issue 📋Update documentation if the PR introduces a new feature!📋 #218).CLI example
Local verification
go build ./...andgo vet ./...pass.frontend/contains Next.js 15 App Router layout withsrc/,components/ui/button.tsx,components/ui/card.tsx,.env.local,next.config.mjs.make runstarts Go (:8080) and Next.js (:3000) together; demo page's "Fetch from Go server" button round-trips successfully.make docker-runwith--feature nextjs --feature dockerboots both services.--feature nextjs --feature react→ only Next.js takes effect; no.templartifacts when--feature nextjs --feature htmxcombined.Note on CI status
All failing checks on this PR are pre-existing upstream CI issues unrelated to this change. Last successful merge on
mainwas in July 2025, and every PR opened against the repo since Q4 2025 hits the same failures because the Go ecosystem has moved past the pins in.github/workflows/:Linting Generated Blueprints Core / Advanced — runner pins Go 1.23 (
.github/workflows/generate-linter-*.yml), but transitive deps of the supported database drivers now require newer Go:filippo.io/edwards25519 v1.2.0(pulled viago-sql-driver/mysql) requires Go ≥ 1.24golang.org/x/sys v0.43.0(pulled via several framework deps) requires Go ≥ 1.25Result:
go getinside the generated project fails → no.gofiles get written → golangci-lint reportscontext loading failed: no go files to analyze(exit 5). This is a deadlock: bumping the generated project'sgodirective unblocksgo getbut then tripsgolangci-lint v1.63.4(built with Go 1.23), which refuses projects whosegodirective exceeds its own build version (the Go language version (go1.23) used to build golangci-lint is lower than the targeted Go version).Fix requires bumping the workflow pins —
go-version: '1.23.x'→'1.24.x'(or'stable') andgolangci-lint@v1.63.4→v1.64+. I intentionally left the workflow files untouched in this PR but am happy to add that bump if maintainers prefer.Integrations Test — scylla cell —
internal/database/database_test.go:38:26: cannot use port (constant "19042/tcp" of string type nat.Port) as string value in argument to wait.ForListeningPort.testcontainers-gochangednat.Porttype; the scylla template needs astring(port)cast. Unrelated to Next.js; fix is a one-line change to the scylla database test template.Locally, with Go 1.24+ and a recent
golangci-lint, the full 147-job matrix passes on my feature branch (I reproduced the CI steps 1-for-1 —script -q /dev/null -c "go run main.go create -n <fw> -f <fw> -d <db> -g <git>"thengolangci-lint run). I can provide logs or a screencast if that helps review.Checklist