Spring Boot & React.js project template
Jul 20, 2017 · 1 min read

Building modern web services usually involves a frontend and backend component. Here, a project template using Spring Boot for the backend and React.js (based on webpack and create-react-app ) for frontend is presented. Both are part of the same project. The maven build bundles the whole application to a single JAR file.
Build process:
- Run unit tests
- Build optimized production build (webpack)
- Bundle frontend and backend components into a single JAR
Obtain the project:
git clone https://github.com/knalum/spring-react.git
Run development mode:
- Navigate to src/main/frontend and run
yarn install - Open the pom.xml file in your IDE and run the application
- Navigate to the src/main/frontend folder (where package.json is located) and run
yarn start - Open http://localhost:3000
In development mode, changes to frontend are applied immediately using hot reload
Build for production:
Get a bundled JAR by running:
mvn clean install
Run jar file and open http://localhost:8080 to open the web app.
