The fastest way to create a production-ready React + Spring Boot full-stack application
Website β’ Quick Start β’ Features β’ Documentation β’ Examples β’ Troubleshooting
react-springboot-cli is a powerful CLI tool that instantly bootstraps a complete full-stack project with a React frontend and Spring Boot backend. Stop wasting hours on project setup and configuration - get a production-ready monorepo structure in seconds.
β
Save Time: Go from zero to coding in under a minute
β
Best Practices: Pre-configured with industry-standard tools and structure
β
Flexibility: Choose your preferred languages and build tools
β
Full Control: No hidden abstractions - you own all the code
β
Production Ready: Includes build wrappers, proper packaging, and deployment config
- π Vite (Recommended) - Lightning-fast HMR and modern build tooling (Vite 7)
- βοΈ Create React App - Battle-tested, stable React setup (React 19)
- β Languages: Java, Kotlin, or Groovy
- π Spring Boot: 4.0.1, 3.5.9, or 3.4.0
- π§ Build Tools: Maven or Gradle (with wrappers included)
- π¦ Packaging: JAR or WAR deployment options
- π― Java Versions: 17, 21, or 25 (LTS)
- π Security: Optional Spring Security integration
- π Monorepo Style: Organized
client/andserver/directories - π Auto-Configuration: Templates parameterized with your choices
- π Documentation: Auto-generated
HELP.mdwith stack-specific instructions - β Ready to Run: Both frontend and backend work immediately
Run directly with npx (no global install needed):
npx react-springboot-cli [project-name]Or install globally via npm:
npm install -g react-springboot-cli
react-springboot-cli [project-name]The CLI will guide you through configuration:
π react-springboot-cli
? Project name: my-awesome-app
? Select Frontend Framework: Vite (Recommended)
? Select Backend Language: Java
? Select Build Tool: Maven
? Select Packaging: Jar
? Group ID: com.mycompany
? Select Spring Boot Version: 4.0.1 (Latest Stable)
? Java Version: 25
? Add Spring Security?: Yes
π Creating project my-awesome-app...
- Frontend: vite β copied to client/
- Backend: java (maven) β configuring for com.mycompany.myawesomeapp...
- Security: enabled -> adding Spring Security...
β Project created successfully!
Your generated project will look like this:
my-awesome-app/
βββ client/ # React Frontend
β βββ public/
β βββ src/
β β βββ components/
β β βββ App.jsx
β β βββ main.jsx
β βββ package.json
β βββ vite.config.js # or package.json for CRA
β βββ ...
βββ server/ # Spring Boot Backend
β βββ src/
β β βββ main/
β β βββ java/ # or kotlin/groovy
β β βββ com/
β β βββ mycompany/
β β βββ myawesomeapp/
β β βββ DemoApplication.java
β β βββ HelloController.java
β βββ pom.xml # or build.gradle
β βββ mvnw # Maven wrapper
β βββ ...
βββ HELP.md # Stack-specific quickstart guide
βββ README.md
Frontend:
cd my-awesome-app/client
npm install
npm run dev # Vite: http://localhost:5173
# or npm start # CRA: http://localhost:3000Backend:
cd my-awesome-app/server
# Maven
./mvnw spring-boot:run # Unix/Mac
mvnw.cmd spring-boot:run # Windows
# Gradle
./gradlew bootRun # Unix/Mac
gradlew.bat bootRun # Windows
# Server runs on http://localhost:8080Before using react-springboot-cli, ensure you have:
- Node.js: Version 18.0.0 or higher (Download)
- Java Development Kit (JDK): Version 17 or higher (JDK 25 recommended for Spring Boot 4.x) (Download)
- npm or yarn: Package manager (comes with Node.js)
node --version # Should be >= 18.0.0
java --version # Should be >= 17 (25 for latest features)| Argument | Description | Example |
|---|---|---|
[project-name] |
Specify project name directly | npx react-springboot-cli my-app |
| (none) | Interactive mode (prompts for all options) | npx react-springboot-cli |
-
Vite (Recommended)
- β‘ Ultra-fast Hot Module Replacement (HMR)
- π― Optimized for modern development
- π¦ Smaller bundle sizes
- π§ Better TypeScript support
-
Create React App
- π‘οΈ Battle-tested and stable
- π Extensive documentation
- π Familiar to most React developers
- Java: Industry-standard, extensive ecosystem
- Kotlin: Modern, concise, null-safe
- Groovy: Dynamic, flexible, powerful DSL
- Maven: Convention-over-configuration, XML-based
- Gradle: Flexible, Groovy/Kotlin DSL, faster builds
- JAR: Embedded server, easy deployment
- WAR: Traditional servlet container deployment (Tomcat, etc.)
- Spring Security: Optional integration
- Adds
spring-boot-starter-security - Configures Basic Authentication
- Disables CSRF (for easier development)
- users can be added via
application.propertiesorSecurityConfig
- Adds
The Group ID follows Java package naming conventions:
β
Valid: com.mycompany, org.example, io.github.username
β Invalid: MyCompany, com.My-Company, 123company
- Java 17: LTS (Long-Term Support) - Recommended for compatibility
- Java 21: LTS - Modern features and performance
- Java 25: Latest LTS - Cutting-edge features (Spring Boot 4.x)
npx react-springboot-cli my-store
# Choices:
# - Frontend: Vite
# - Backend: Java
# - Build Tool: Maven
# - Packaging: Jar
# - Group ID: com.mystore
# - Java Version: 17Result: E-commerce starter with Vite HMR and Spring Boot REST API
npx react-springboot-cli blog-platform
# Choices:
# - Frontend: Vite
# - Backend: Kotlin
# - Build Tool: Gradle
# - Packaging: Jar
# - Group ID: io.myblog
# - Java Version: 21Result: Modern blog platform with Kotlin's concise syntax
npx react-springboot-cli enterprise-app
# Choices:
# - Frontend: Create React App
# - Backend: Groovy
# - Build Tool: Maven
# - Packaging: War
# - Group ID: com.enterprise
# - Java Version: 17Result: Enterprise application deployable to existing Tomcat servers
react-springboot-cli automatically configures:
β
Package Structure: Creates proper Java package hierarchy from your Group ID
β
Build Wrappers: Includes mvnw/gradlew so projects work without global installations
β
CORS Configuration: Pre-configured for local development (client β server)
β
ServletInitializer: Auto-added for WAR packaging
β
Sample Controller: Working REST endpoint at /api/hello
Example React Component:
// client/src/App.jsx
import { useState, useEffect } from 'react';
function App() {
const [message, setMessage] = useState('');
useEffect(() => {
fetch('http://localhost:8080/api/hello')
.then(res => res.text())
.then(data => setMessage(data));
}, []);
return <h1>{message}</h1>;
}
export default App;Example Spring Controller:
// server/src/main/java/com/example/demo/HelloController.java
@RestController
@RequestMapping("/api")
@CrossOrigin(origins = "http://localhost:5173") // Vite dev server
public class HelloController {
@GetMapping("/hello")
public String hello() {
return "Hello from Spring Boot!";
}
}Problem: Target directory already contains a project with the same name.
Solution:
# Choose a different name
npx react-springboot-cli my-app-v2
# Or remove the existing directory
rm -rf my-app # Unix/Mac
rmdir /s my-app # WindowsProblem: Dependencies not installed.
Solution:
cd client
npm install
npm run dev # or npm start for CRAProblem: Java environment variable not configured.
Solution:
Windows:
# Find Java installation
where java
# Set JAVA_HOME (example path)
setx JAVA_HOME "C:\Program Files\Java\jdk-17"
cd client
npm install
npm run dev # or npm start for CRAProblem: Java environment variable not configured.
Solution:
Windows:
# Find Java installation
where java
# Set JAVA_HOME (example path)
setx JAVA_HOME "C:\Program Files\Java\jdk-17"Mac/Linux:
# Add to ~/.bashrc or ~/.zshrc
export JAVA_HOME=$(/usr/libexec/java_home) # Mac
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk # LinuxRestart your terminal after setting JAVA_HOME.
Problem: Maven wrapper not executable.
Solution:
cd server
chmod +x mvnw
./mvnw spring-boot:runProblem: Template placeholders not replaced (rare bug).
Solution: This shouldn't happen with the latest version. If it does:
- Delete the generated
server/directory - Re-run
npx react-springboot-cli@latest - If issue persists, report a bug
Problem: Another application is using the default Spring Boot port.
Solution: Change the port in server/src/main/resources/application.properties:
server.port=8081Then update frontend API calls to use http://localhost:8081.
Problem: Frontend can't access backend due to CORS policy.
Solution: Add CORS configuration to your Spring controller:
@CrossOrigin(origins = "http://localhost:5173") // Vite
// or
@CrossOrigin(origins = "http://localhost:3000") // CRAFor production, configure proper CORS in WebConfig:
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/api/**")
.allowedOrigins("https://your-production-domain.com")
.allowedMethods("GET", "POST", "PUT", "DELETE");
}
}Problem: Gradle version mismatch.
Solution: Use the included wrapper (recommended):
./gradlew --version # Check version
./gradlew clean build # Use wrapper, not global gradleStill stuck? Here's how to get help:
- Check HELP.md: Your generated project includes stack-specific guidance
- Search Issues: GitHub Issues
- Ask Questions: Start a Discussion
- Report Bugs: Open an Issue
When reporting issues, include:
- Node version:
node --version - Java version:
java --version - OS: Windows/Mac/Linux
- Full error message
- Steps to reproduce
Create .github/workflows/ci.yml in your project:
name: CI/CD Pipeline
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
jobs:
frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./client
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'npm'
cache-dependency-path: client/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: frontend-build
path: client/dist # or client/build for CRA
backend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./server
steps:
- uses: actions/checkout@v3
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '25'
cache: 'maven' # or 'gradle'
- name: Build with Maven
run: ./mvnw clean package -DskipTests
# For Gradle, use:
# - name: Build with Gradle
# run: ./gradlew build -x test
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: backend-jar
path: server/target/*.jar # or server/build/libs/*.jar for GradleCreate .gitlab-ci.yml in your project:
stages:
- build
- test
- deploy
variables:
MAVEN_OPTS: "-Dmaven.repo.local=.m2/repository"
frontend-build:
stage: build
image: node:18
before_script:
- cd client
- npm ci
script:
- npm run build
artifacts:
paths:
- client/dist/ # or client/build/ for CRA
expire_in: 1 hour
backend-build:
stage: build
image: openjdk:17-jdk
before_script:
- cd server
script:
- ./mvnw clean package -DskipTests
artifacts:
paths:
- server/target/*.jar
expire_in: 1 hour
cache:
paths:
- .m2/repositoryDocker Compose (docker-compose.yml):
version: '3.8'
services:
frontend:
build: ./client
ports:
- "80:80"
depends_on:
- backend
environment:
- REACT_APP_API_URL=http://localhost:8080
backend:
build: ./server
ports:
- "8080:8080"
environment:
- SPRING_PROFILES_ACTIVE=productionFrontend Dockerfile (client/Dockerfile):
FROM node:18-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM nginx:alpine
COPY --from=build /app/dist /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]Backend Dockerfile (server/Dockerfile):
FROM openjdk:25-jdk-alpine AS build
WORKDIR /app
COPY . .
RUN ./mvnw clean package -DskipTests
FROM openjdk:25-jre-alpine
WORKDIR /app
COPY --from=build /app/target/*.jar app.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "app.jar"]Release Date: 2025-12-23
- Java 25 Support: Full integration with the latest LTS release.
- Spring Boot 4.0.1 Integration: Updated templates for next-gen Spring.
- Modern Dependencies: React 19 (19.2.3) and Vite 7 (7.3.0) by default.
- Runtime Checks: Proactive Java version validation to ensure build compatibility.
- Improved Templates: Standardized version handling via placeholders.
- TypeScript support for frontend
- Spring Boot version selection
- Database configuration (PostgreSQL, MySQL, H2)
- Docker configuration generation
- Testing framework setup
- Authentication templates (Spring Security + JWT)
- API documentation (Swagger/OpenAPI)
- Multiple frontend frameworks (Vue, Angular)
- Microservices template option
- GraphQL support
- Cloud deployment templates (AWS, Azure, GCP)
- Kubernetes manifests generation
- Monitoring setup (Prometheus, Grafana)
Want a feature? Request it here!
Contributions are welcome! Here's how you can help:
Found a bug? Open an issue with:
- Clear description of the problem
- Steps to reproduce
- Expected vs actual behavior
- Your environment (OS, Node version, Java version)
Have an idea? Open a discussion or feature request!
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
# Clone the repository
git clone https://github.com/KOWSIK-M/react-springboot-cli.git
cd react-springboot-cli
# Install dependencies
npm install
# Test locally
node bin/index.js test-project
# Link for local testing
npm link
react-springboot-cli my-test-appThis project is licensed under the MIT License - see the LICENSE file for details.
- β Free for personal and commercial use
- β Modify and distribute freely
- β Private use allowed
- β No warranty or liability
- βΉοΈ Must include original license notice
Built with β€οΈ using:
- inquirer - Interactive CLI prompts
- chalk - Terminal string styling
- fs-extra - Enhanced file operations
Inspired by:
- create-react-app - React tooling
- Spring Initializr - Spring Boot bootstrapping
- create-vite - Vite project scaffolding
- GitHub: @KOWSIK-M
- Issues: GitHub Issues
- Discussions: GitHub Discussions