All Projects β†’ yohangz β†’ java-play-react-seed

yohangz / java-play-react-seed

Licence: MIT license
πŸŒ€ Java Play 2.7.x + React seed project with full-fledged build process

Programming Languages

shell
77523 projects
javascript
184084 projects - #8 most used programming language
scala
5932 projects
java
68154 projects - #9 most used programming language
HTML
75241 projects
Batchfile
5799 projects
CSS
56736 projects

Projects that are alternatives of or similar to java-play-react-seed

java-play-angular-seed
🍁 Java Play 2.7.x + Angular 8 with Angular CLI seed project with full-fledged build process
Stars: ✭ 53 (+23.26%)
Mutual labels:  sbt, play-framework, seed-project
Sbt Ignore Play Generated
Configure linters and coverage tools to ignore Play's generated source files.
Stars: ✭ 10 (-76.74%)
Mutual labels:  sbt, play-framework
play-angular-typescript.g8
A giter8 template for a Play Angular 4 Typescript application
Stars: ✭ 91 (+111.63%)
Mutual labels:  sbt, play-framework
Play Reactive Slick
This is Play Template with a nice User Interface. If you want to use Play as web framework and Postgres as Database then this demo project can be used as a starting point for your application.
Stars: ✭ 40 (-6.98%)
Mutual labels:  sbt, play-framework
Play Spark Scala
Stars: ✭ 51 (+18.6%)
Mutual labels:  sbt, play-framework
Scala Play React Seed
❄️ Java Play 2.7.x + React seed project with full-fledged build process
Stars: ✭ 180 (+318.6%)
Mutual labels:  sbt, play-framework
Scala Play Angular Seed
πŸ€ Scala Play 2.7.x + Angular 8 with Angular CLI seed project with full-fledged build process
Stars: ✭ 85 (+97.67%)
Mutual labels:  sbt, play-framework
sbt-sass
A fork of the sbt-sass repository which seems to be abandoned.
Stars: ✭ 32 (-25.58%)
Mutual labels:  sbt, play-framework
sbt-travisci
An sbt plugin to integrate with Travis CI
Stars: ✭ 44 (+2.33%)
Mutual labels:  sbt
xsbt-webstart
A Webstart plugin for sbt
Stars: ✭ 12 (-72.09%)
Mutual labels:  sbt
address-index-api
Address Index is an application which resolves addresses
Stars: ✭ 26 (-39.53%)
Mutual labels:  play-framework
sbt-project-switcher
A sbt plugin to switch project in a snappy way⚑️
Stars: ✭ 36 (-16.28%)
Mutual labels:  sbt
playwarts
WartRemover warts for Play Framework.
Stars: ✭ 23 (-46.51%)
Mutual labels:  play-framework
playframework
Gradle Play Support
Stars: ✭ 41 (-4.65%)
Mutual labels:  play-framework
sbt.github.com
See https://github.com/sbt/website for the source
Stars: ✭ 21 (-51.16%)
Mutual labels:  sbt
play-silhouette-reactivemongo-seed
Seed Application for PlayFramework, Silhouette and ReactiveMongo
Stars: ✭ 22 (-48.84%)
Mutual labels:  play-framework
sbt-spark-submit
sbt plugin for spark-submit
Stars: ✭ 94 (+118.6%)
Mutual labels:  sbt
sbt-marathon
An sbt plugin for launching application containers on the Mesosphere Marathon platform.
Stars: ✭ 23 (-46.51%)
Mutual labels:  sbt
tap
Text Analytics Pipeline (TAP)
Stars: ✭ 17 (-60.47%)
Mutual labels:  play-framework
Aton
Open web computer laboratory administrator
Stars: ✭ 15 (-65.12%)
Mutual labels:  play-framework

MIT License

Java Play React Seed

Use play framework to develop the web application backend/services and frontend using React Create App, all in a totally integrated workflow and single unified console. This approach will deliver perfect development experience without CORS hassle.

Read more @ http://bit.ly/2A1AzEq

Java Play React Seed

Used Summary

How to use it?

Prerequisites

Let's get started,

  • Fork or clone this repository.

  • Used any of the following SBT commands which will intern trigger frontend associated npm scripts.

    sbt clean           # Clean existing build artifacts

    sbt stage           # Build your application from your project’s source directory

    sbt run             # Run both backend and frontend builds in watch mode

    sbt dist            # Build both backend and frontend sources into a single distribution artifact

    sbt test            # Run both backend and frontend unit tests
  • This seed is not using scala play views. All the views and frontend associated routes are served via React code base under ui directory.

Complete Directory Layout

β”œβ”€β”€ /app/                                 # The backend source (controllers, models, services)
β”‚     └── /controllers/                   # Backend controllers
β”‚           └── FrontendController.scala  # Asset controller wrapper serving frontend assets and artifacts
β”œβ”€β”€ /conf/                                # Configurations files and other non-compiled resources (on classpath)
β”‚     β”œβ”€β”€ application.conf                # Play application configuratiion file.
β”‚     β”œβ”€β”€ logback.xml                     # Logging configuration
β”‚     └── routes                          # Routes definition file
β”œβ”€β”€ /logs/                                # Log directory
β”‚     └── application.log                 # Application log file
β”œβ”€β”€ /project/                             # Contains project build configuration and plugins
β”‚     β”œβ”€β”€ FrontendCommands.scala          # Frontend build command mapping configuration
β”‚     β”œβ”€β”€ FrontendRunHook.scala           # Forntend build PlayRunHook (trigger frontend serve on sbt run)
β”‚     β”œβ”€β”€ build.properties                # Marker for sbt project
β”‚     └── plugins.sbt                     # SBT plugins declaration
β”œβ”€β”€ /public/                              # Frontend build artifacts will be copied to this directory
β”œβ”€β”€ /target/                              # Play project build artifact directory
β”‚     β”œβ”€β”€ /universal/                     # Application packaging
β”‚     └── /web/                           # Compiled web assets
β”œβ”€β”€ /test/                                # Contains unit tests of backend sources
β”œβ”€β”€ /ui/                                  # React frontend source (based on Create React App)
β”‚     β”œβ”€β”€ /public/                        # Contains the index.html file
β”‚     β”œβ”€β”€ /node_modules/                  # 3rd-party frontend libraries and utilities
β”‚     β”œβ”€β”€ /src/                           # The frontend source codebase of the application
β”‚     β”œβ”€β”€ .editorconfig                   # Define and maintain consistent coding styles between different editors and IDEs
β”‚     β”œβ”€β”€ .gitignore                      # Contains ui files to be ignored when pushing to git
β”‚     β”œβ”€β”€ package.json                    # NPM configuration of frontend source
β”‚     β”œβ”€β”€ README.md                       # Contains all user guide details for the ui
β”‚     └── yarn.lock                       # Yarn lock file
β”œβ”€β”€ .gitignore                            # Contains files to be ignored when pushing to git
β”œβ”€β”€ build.sbt                             # Play application SBT configuration
β”œβ”€β”€ LICENSE                               # License Agreement file
β”œβ”€β”€ README.md                             # Application user guide
└── ui-build.sbt                          # SBT command hooks associated with frontend npm scripts

What is new in here?

FrontendCommands.scala

  • Frontend build command mapping configuration.
    β”œβ”€β”€ /project/
    β”‚     β”œβ”€β”€ FrontendCommands.scala

FrontendRunHook.scala

  • PlayRunHook implementation to trigger npm run start on sbt run.
    β”œβ”€β”€ /project/
    β”‚     β”œβ”€β”€ FrontendRunHook.scala

FrontendController.scala

  • Asset controller wrapper serving frontend assets and artifacts.
    β”œβ”€β”€ /app/
    β”‚     └── /controllers/
    β”‚           └── FrontendController.scala

ui-build.sbt

  • This file contains the build task hooks to trigger frontend npm scripts on sbt command execution.

npm scripts

β”œβ”€β”€ /ui/
β”‚     β”œβ”€β”€ package.json

Routes

β”œβ”€β”€ /conf/
β”‚     β”œβ”€β”€ routes
  • The following route configuration map index.html to entry route (root). This should be placed as the initial route.
GET        /             controllers.FrontendController.index()
  • All API routes should be prefixed with API prefix defined under application.conf (Default prefix apiPrefix = "api")

Example API route:

GET        /api/summary  controllers.HomeController.appSummary
  • The following route is being used to serve frontend associated build artifacts (css, js) and static assets (images, etc.). This should be placed as the final route.
GET        /*file        controllers.FrontendController.assetOrDefault(file)

Note: On production build all the front end React build artifacts will be copied to the public folder.

Can be used to implement any front end/ui build!

  • Simply replace the ui directory with the build of your choice
  • Make output directory ROOT/public/
  • Implement a proxy to localhost:9000

Looking for some other frontend framework or language choice

Contributors


Yohan Gomez

Lahiru Jayamanna


Gayan Attygalla

License

This software is licensed under the MIT license

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].