Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork99
❄️ Scala Play + React seed project with full-fledged build process
License
playframework/play-scala-react-seed
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
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
Fork or clone this repository.
Used any of the followingSBT 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 usingscala play views. All the views and frontend associated routes are served viaReact code base under
ui
directory.
├── /app/ # The backend (scala play) sources (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
- Frontend build command mapping configuration.
├── /project/ │ ├── FrontendCommands.scala
- PlayRunHook implementation to trigger
npm run start
onsbt run
.
├── /project/ │ ├── FrontendRunHook.scala
- Asset controller wrapper serving frontend assets and artifacts.
├── /app/ │ └── /controllers/ │ └── FrontendController.scala
- This file contains the build task hooks to trigger frontend npm scripts on sbt command execution.
- New and modified npm scripts ofCreate React App generated package.json.
- CheckUI README.md to see all available frontend build tasks.
├── /ui/ │ ├── package.json
├── /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 prefixapiPrefix = "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 thepublic
folder.
- Simply replace the ui directory with the build of your choice
- Make output directory ROOT/public/
- Implement a proxy to localhost:9000
- Play Java React Seed
- Play Scala Angular Seed
- Play Java Angular Seed
- Scala Play Vuejs Seed byDuncan Nevin
- Java Play Vuejs Seed byDuncan Nevin
This software is licensed under the MIT license
About
❄️ Scala Play + React seed project with full-fledged build process
Topics
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Sponsor this project
Uh oh!
There was an error while loading.Please reload this page.
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors15
Uh oh!
There was an error while loading.Please reload this page.