🔥 This is very much outdated. You should not use it w/o updating JS and Java dependencies. 🔥
Minimal example of an app running Spring Boot in the backend with a Vue.js SPA as frontend.
-
Spring Boot Application with a single HTTP service
-
Vue.js application with a sample component
-
Webpack Build for the frontend including live reload for development
-
API Proxy for the local frontend development server to target the locally running backend
-
Maven Build for the backend which also wraps the frontend build
-
A Dockerfile to create an image from the jar produced.
-
Travis build instructions running the maven and Docker build
The following frameworks where used:
-
Spring Boot v2
-
Vue.js v2 / Vue CLI 3
-
vue-router and vuex
-
SCSS styling support
-
Docker w/ a minimal JRE 11 base image based on alpine
TODO
-
Contract first implementation using swagger, generated server interfaces and JS client.
-
CircleCI build, as I prefer it to Travis these days
-
Run
mvn clean install
from the project’s root to build the complete application. -
Run
docker build -t wernerw/boot-vue-docker .
or use your own tag
You now have a docker image containig your backend and your frontend.
The generated API documentation is located at /doc/index.html
The docker image is pushed to https://hub.docker.com/r/wernerw/boot-vue-docker/
-
To run the jar directly, use
java -jar target/boot-vue-docker*.jar
-
To run inside a container on port 8080, use
docker run -p8080:8080 wernerw/boot-vue-docker
Run npm run serve
from src/main/frontend
to run the a local dev server for UI development.
The dev server will run on http://localhost:8081.
It proxies the requests to backend HTTP API expected to run on http://localhost:8080/api.
So you can run the backend from your IDE and the frontend in the dev server.
If you run the complete package, the frontend requests will be made against /api
on the same server.
If you are using IntelliJ/WebStorm, you need to configure the path to the webpack config that is provided by vue-cli for webpack aliases (i.e. @
for src
) to work.
Preferences › Webpack › webpack configuration file › <project root
› /src/main/frontend/node_modules/@vue/cli-service/webpack.config.js