Fix/stax fullstack setup - #4
Merged
Merged
Conversation
Add empty list guard in ProjectServiceImpl.enrichProjectsWithFields to prevent IndexOutOfBoundsException when fetching projects on an unpopulated database.
…th bypass - Remove strict-dynamic nonce CSP header from Next.js middleware that was blocking modern browser script execution on statically prerendered routes. - Add local proxy rewrites for backend API routes (/api/* and /streaming/*). - Add local unauthenticated development fallback in ProjectsTable. - Add missing .env.template with local development defaults.
…arations - Add variables.tf for quickstart with sensible defaults. - Fix Cloud Run UI and backend resource definitions and dependencies. - Fix IAM role bindings.
- Add local execution commands and environment variables. - Document directory layout and troubleshooting.
anantbhargava-lgtm
requested review from
prashantgarg-coder,
thebarnaby and
xinyij-goo
as code owners
September 9, 2026 17:30
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.
Summary
This PR resolves multiple blockers identified when building, running, and deploying Stax across the Frontend (Next.js), Backend (Spring Boot), and Terraform infrastructure. All components have been verified locally and validated for deployment.
Key Changes
1. Backend (
server/)IndexOutOfBoundsExceptioninProjectServiceImpl.enrichProjectsWithFields()when querying projects on an empty database (if (projects == null || projects.isEmpty()) return List.of();).2. Frontend (
frontend/)strict-dynamicnonce-based Content Security Policy header inmiddleware.ts. Statically prerendered HTML pages lacked the generated nonces on script tags, causing modern browsers to block all React client bundle execution and locking the page in an unhydrated shell. Strict CSP is now optionally toggled viaENABLE_STRICT_CSP=true.no-cache, no-store, must-revalidateresponse headers in middleware to prevent browsers from caching broken static shells.rewritesinnext.config.jsfor/api/*and/streaming/*targetingNEXT_PUBLIC_API_BASE_URL(defaulthttp://localhost:8080), eliminating CORS issues in local development.MainConfig.isAuthEnabledtoNEXT_PUBLIC_AUTH_ENABLEDso developers can run and test Stax without mandatory Google OAuth configuration..env.template: Added the missing template file infrontend/with standard local development defaults.onErrorcallback inProjectsTable.tsxto ensure loading spinners clear if an API request fails.package.jsonto point to../.git/hooksfrom within thefrontend/subdirectory.3. Terraform Infrastructure (
terraform/quickstart/)variables.tf: Parameterizedproject_id,region,admin_email,artifact_registry_repo, andgcs_bucket_namewith sensible defaults.main.tfand hardcoded bucket name incloud_run_backend.tfwith variables.roles/adminwithroles/resourcemanager.projectIamAdmin.google_project_iam_bindingto additivegoogle_project_iam_memberto prevent accidentally revoking existing project permissions.user:,serviceAccount:, orgroup:prefixes are correctly formatted.var.artifact_registry_repo.4. Documentation (
README.md&terraform/README.md)backend/toserver/.cd serverandcd frontendbefore executing commands.NEXT_PUBLIC_API_BASE_URLandNEXT_PUBLIC_APP_BASE_URLconfiguration.gcloud run deploycommands interraform/README.mdto reference correct source directories (server/andfrontend/).Testing & Verification
mvn clean compile,mvn package -DskipTests). Verified server boots and serves endpoints (/api/projects,/api/auth/health,/api/datasets,/api/model/list) returning HTTP 200 OK.1,904 tests passing), and verified Next.js production build (next build). Tested local web UI in browser — confirmed React hydration succeeds, tables populate, and API proxy routing works without errors.terraform initandterraform validateacross providers (hashicorp/googleandhashicorp/random). Verified dry-run plan (terraform plan) generates resource topology without syntax or reference errors.