Git Product home page Git Product logo

boot-vue-docker's Introduction

Spring Boot + Vue.js + Docker Template

Table of Contents

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

Building

  1. Run mvn clean install from the project’s root to build the complete application.

  2. 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

Running

  • 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

Development

Frontend

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

boot-vue-docker's People

Contributors

wwerner avatar dependabot[bot] avatar snyk-bot avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.