This is a full-stack starter project using:
- ⚛️ React (Vite) for the frontend
- ☕ Spring Boot for the backend
React-SpringBoot-Boilerplate/
├── backend/ # Spring Boot backend (Java 21)
│ ├── src/
│ └── pom.xml
├── frontend/ # React frontend (Vite + React 18+)
│ ├── src/
│ └── package.json
├── README.md
⚠️ Before starting the backend, make sure to:
- Set the correct backend URL and DB credentials in
application.properties- Create a
.envfile if usingspring-dotenvto load environment variables
cd backend
./mvnw spring-boot:runRuns on: http://localhost:8080
spring-boot-starter-data-jpa– For database operationsspring-boot-starter-web– For building REST APIsspring-boot-devtools– For live reload and fast developmentmysql-connector-j– To connect to MySQL databaselombok– For reducing boilerplate codespring-boot-starter-test– For writing testsspring-dotenv– For loading environment variables from.env
cd frontend
npm install
npm run devRuns on: http://localhost:5173
If you want to use a different port like 3000, update both CORS settings and the proxy configuration.
CORS is enabled in CorsConfig.java (backend).
Make sure allowedOrigins matches your frontend port (e.g., http://localhost:5173).
For smoother local development, add a proxy to vite.config.js:
export default {
server: {
proxy: {
'/api': 'http://localhost:8080'
}
}
}Use a .env file in the frontend to manage base URLs:
VITE_API_BASE_URL=http://localhost:8080Then fetch like this:
fetch(`${import.meta.env.VITE_API_BASE_URL}/api/hello`)- Add Docker support
- Setup authentication (e.g., JWT)
- Integrate a database (MySQL/PostgreSQL)
- Setup a CI/CD pipeline
Feel free to fork this repo and contribute via PRs!
MIT License. Use freely and customize to your needs.
- Created and maintained by Skywalker690.
- Special thanks to the open-source community for tools and inspiration.