PlayFast is an omakase-style production-ready PlayFramework template.
You can see the demo here: https://play.nanakorn.com
It comes with libraries and code conventions that help you get started quickly. Setting up all these components and conventions would take from hours to weeks. You can clone the repository, run it locally, run tests, and deploy a working version within minutes.
Here are the main features:
- Modern JavaScripts framework integration (only Svelte + TailwindCSS for now) with Hot-Module Reloading (HMR) and Typescript support for local dev.
- Deployment pipeline to Dokploy, which should be easily adaptable to Render.com and Heroku.
- Postgres integration that supports Enum.
- Test frameworks with browser testing.
- Pre-configured scalafmt and scalafix.
- (not done yet) Github Actions configuration with sharded tests.
It also includes multiple code conventions that I've used over the years like:
- Processing a JSON data in POST request and propagating validation errors.
- Passing the data between frontend and backend in a semi-strong typed manner.
- Accessing a database and avoid the N+1 queries using the hydration pattern.
- Clone the repository with:
git clone https://github.com/tanin47/playframework-template - Install jdk, scala, and sbt. SDKMAN is recommended for managing multiple JDKs, and GraalVM 21.0.7 for JVM.
sdk install java 21.0.7-graal -ysdk install scala 3.3.5sdk install sbt 1.11.1
- Install node and npm. NVM is recommended for managing multiple Node versions.
nvm install 22,nvm alias default 22, andnvm use 22
- Install Postgres.
- Using Homebrew is recommended. Run
brew install postgresql - Start Postgres with
brew services restart postgresql
- Run
npm installin order to install all npm packages. - Run
cd setup && ./setup_db.shin order to set up the postgres database.
- You may need to adjust the credentials
setup_db.shto be able to connect to your local Postgres.
- Open 2 terminal windows. One runs
sbt run(for Play server), and another runsnpm run hmr(for Hot-Reloading Module). - Visit http://localhost:9000
sbt testto run all tests.- To publish a production Docker image for deployment:
sbt stage docker:publish
Please file an issue if you would like PlayFast to expand to support a library and framework that you want or if you have any question.