This repo contains a minimal Spring Boot + React (Vite + TypeScript) setup with an OpenAPI-first workflow.
openapi/api.ymlis the source of truth for the HTTP API.backend/is a Spring Boot + Gradle service that implements the API.frontend/is a Vite React app that calls the API.
- Java 21+
- Gradle (local install is OK)
- Node 22+ and npm
cd backend
# Generates code from OpenAPI and runs static checks + tests
./gradlew clean buildcd frontend
# Install deps, generate API client, then run checks
npm install
npm run generate
npm run lint
npm test
npm run devcd frontend
# One-time browser install
npm run test:e2e:install
# Runs backend + frontend preview automatically and executes browser checks
npm run test:e2eGenerated artifacts are written to output/playwright/. In GitHub Actions, they are uploaded as artifact playwright-output in the frontend-e2e job.
- Backend:
openApiGenerateruns duringbuildto generate interfaces/models fromopenapi/api.yml. - Frontend:
npm run generateusesopenapi-typescriptto generate a typed client.
- VS Code is configured for format-on-save via
.vscode/settings.jsonand the devcontainer settings. - Java formatting uses
backend/config/formatter/formatter.xml(Google style) and is aligned with Checkstyle. - Frontend formatting uses Prettier with
frontend/.prettierrc.json. - OpenAPI-generated code is excluded from formatting and quality checks; keep edits in non-generated files.
- Prefer Lombok annotations to avoid hand-written Java boilerplate (constructors, getters/setters, builders).
- Dependency vulnerability scan:
./gradlew dependencyCheckAnalyze(reports inbackend/build/reports/dependency-check). - CycloneDX SBOM:
./gradlew cyclonedxBom(output inbackend/build/reports). - Combined security report task:
./gradlew securityReport. - For faster Dependency-Check scans, set
NVD_API_KEY(from the NVD API key portal) as an environment variable.
- CI uses a single SonarCloud project to scan both backend and frontend in one analysis.
- Required repository variables:
SONAR_ORGANIZATIONSONAR_PROJECT_KEY
- Required repository secret:
SONAR_TOKEN
- Keep SonarCloud Automatic Analysis disabled to avoid duplicate analysis with CI-based scanning.
- Current project key in this repo context:
BITXUJI_codex-springboot-react. - Recommended branch for checks:
main. - Coverage check (overall + new code):
- Call
mcp__sonarqube__get_component_measureswith metrics:coverageline_coveragebranch_coverageuncovered_linesnew_coveragenew_uncovered_lines
- Call
mcp__sonarqube__get_project_quality_gate_statusto confirm quality gate and coverage condition status.
- Call
- Issue check:
- Call
mcp__sonarqube__search_sonar_issues_in_projectswithprojects=["BITXUJI_codex-springboot-react"].
- Call
- If the key is unknown, first check GitHub repository variable
SONAR_PROJECT_KEY.
Run this sequence after every commit push, and before reporting "done":
- Confirm GitHub CI for the pushed commit is finished and green.
- Confirm the
sonarqubejob in that CI run iscompleted/success. - Confirm SonarCloud reflects the new analysis for
main:mcp__sonarqube__search_sonar_issues_in_projectsto verify the target issue isCLOSED.mcp__sonarqube__get_project_quality_gate_statusto verifyOK.mcp__sonarqube__get_component_measuresfor coverage metrics (coverage,line_coverage,branch_coverage,uncovered_lines,new_coverage).
- Only then confirm the change as complete.
- Tag a release (e.g.
v1.0.0) to trigger.github/workflows/release.yml. - Frontend: builds
frontend/distand uploadsfrontend-dist.zipto the GitHub Release. - Backend: publishes the Spring Boot jar to GitHub Packages (Maven); version is derived from the tag.
- GitHub Packages URL:
https://maven.pkg.github.com/BITXUJI/codex-springboot-react - Example tag commands:
git tag -a v1.0.0 -m "release v1.0.0"git push origin v1.0.0
- Start the backend:
./gradlew bootRun(port 8080). - Start the frontend:
npm run dev(port 5173). - Open the app; it calls
GET /api/helloand renders the response.
- Backend build with full warnings:
cd backend && task build:debug - Backend Javadoc with full warnings:
cd backend && task javadoc:debug - Backend tests with full warnings:
cd backend && task test:debug - Frontend tests with coverage:
cd frontend && task test:coverage - CI workflows locally:
act -W .github/workflows/ci.yml
- Check status:
git status -sb - View staged diff:
git diff --staged - View working tree diff:
git diff - Commit:
git commit -m "message" - Push:
git push