Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ playfast Public template

An omakase-style PlayFramework template. Ready to deploy in minutes.

License

tanin47/playfast

Repository files navigation

PlayFast: Production-ready PlayFramework Template

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:

  1. Modern JavaScripts framework integration (only Svelte + TailwindCSS for now) with Hot-Module Reloading (HMR) and Typescript support for local dev.
  2. Deployment pipeline to Dokploy, which should be easily adaptable to Render.com and Heroku.
  3. Postgres integration that supports Enum.
  4. Test frameworks with browser testing.
  5. Pre-configured scalafmt and scalafix.
  6. (not done yet) Github Actions configuration with sharded tests.

It also includes multiple code conventions that I've used over the years like:

  1. Processing a JSON data in POST request and propagating validation errors.
  2. Passing the data between frontend and backend in a semi-strong typed manner.
  3. Accessing a database and avoid the N+1 queries using the hydration pattern.

How to use

  1. Clone the repository with: git clone https://github.com/tanin47/playframework-template
  2. 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 -y
  • sdk install scala 3.3.5
  • sdk install sbt 1.11.1
  1. Install node and npm. NVM is recommended for managing multiple Node versions.
  • nvm install 22, nvm alias default 22, and nvm use 22
  1. Install Postgres.
  • Using Homebrew is recommended. Run brew install postgresql
  • Start Postgres with brew services restart postgresql
  1. Run npm install in order to install all npm packages.
  2. Run cd setup && ./setup_db.sh in order to set up the postgres database.
  • You may need to adjust the credentials setup_db.sh to be able to connect to your local Postgres.
  1. Open 2 terminal windows. One runs sbt run (for Play server), and another runs npm run hmr (for Hot-Reloading Module).
  2. Visit http://localhost:9000
  3. sbt test to run all tests.
  4. To publish a production Docker image for deployment: sbt stage docker:publish

Request a feature or have a question?

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.

About

An omakase-style PlayFramework template. Ready to deploy in minutes.

Resources

License

Stars

Watchers

Forks