Skip to content

Demo project of a full stack Scala project deployed on fly.io

Notifications You must be signed in to change notification settings

sherpal/FlyIOScalaJVMDemo

Repository files navigation

Full Stack Scala JVM on fly.io demo

This repository is an example of an application with backend and frontend both in Scala that can be deployed easily on fly.io.

It features:

Dev setup

To run this project, you will need installed

  • node.js (v16+)
  • sbt
  • a jdk 11

The first time, run in one terminal:

cd frontend
npm ci

Then, in one terminal:

sbt
~frontend/fastLinkJS

In another terminal

sbt
~server/reStart

In a third (last) terminal

cd frontend
npm run dev

Then you can go to localhost:3000/static.

Prod setup

You can package the whole application into a fat jar with

sbt packageApplication

Then you can run it with java -jar dist/app.jar then go to localhost:9000.

You can also build a Docker image for the app with (note that the tag name does not matter)

docker build --tag demoscalaflyio .

Then run it with

docker run --rm -p 9000:8080 demoscalaflyio

and then go to localhost:9000.

Deploy to fly.io

The project contains a fly.toml file generated via fly launch.

You can apply it to your account via fly deploy and then see that it's live with fly open. (If not logged in already, you need to fly auth login.)

You need to have flyctl installed for this to work.

You can see more complete instructions here.

About

Demo project of a full stack Scala project deployed on fly.io

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published