Giter Site home page Giter Site logo

jonasermert / spring-boot-react-bundle Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gossie/spring-boot-react-bundle

1.0 0.0 0.0 281 KB

Demo project to deploy front- and backend together on heroku.

Home Page: https://spring-boot-react-bundle.herokuapp.com/

Java 23.79% TypeScript 37.86% HTML 35.98% Procfile 2.36%

spring-boot-react-bundle's Introduction

spring-boot-react-bundle

This is a demo project that shows how it is possible to deploy a react frontend and a Spring Boot backend into a heroku dyno. The following paragraphs describe the actions you need to perform.

Creating an heroku app

When creating the heroku app I recommend to use the heroku cli. Use the following commands to create the app and add the required buildpack.

  • heroku create <your-app-name>
  • heroku buildpacks:set heroku/java --app=<your-app-name>

Project structure

The project consists of to sub projects. The react project is located in the frontend directory and the Spring Boot project in the backend directory. To let heroku know that the main project is the Spring Boot project, there is a parent pom.xml in the root directory. That way, when heroku builds checks out the code and starts the build the parent pom and the backend module are built.
To let heroku know that the jar file is now in the target directory of the backend, the Procfile is needed.

Bundling the frontend into the backend jar

The frontend project is built using the com.github.eirslett:frontend-maven-plugin. The maven-resources-plugin is used to copy the content of the resulting build directory to the backend's target/classes/static directory.

Deployment to heroku

Just connect your heroku app and yout GitHub repository on the heroku app's "Deploy"-tab.

spring-boot-react-bundle's People

Contributors

gossie avatar

Stargazers

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