Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
My highly opinionated list of things needed to build an app in Scala

Libraries

If you are using Play, these are reasonable alternatives to above since these have better out-of-the-box Play support:

Code Quality

sbt plugins

See also: https://github.com/lauris/awesome-scala

@wsargent

This comment has been minimized.

Copy link

commented Sep 8, 2016

This is great!

@denisftw

This comment has been minimized.

Copy link

commented Sep 8, 2016

Interesting selection.
I would add something for dealing with asynchronous code, for example Monix. There is no ScalaZ in the list, so instead of scalaz.concurrent.Task, you can use Monix Task or FS2 Task.
Also, adding sbt-coursier wouldn't harm :)

@rtfpessoa

This comment has been minimized.

Copy link

commented Sep 8, 2016

@Petesta

This comment has been minimized.

Copy link

commented Sep 8, 2016

@nairbv

This comment has been minimized.

Copy link

commented Sep 9, 2016

I'm a big fan of pebble for templates. They're like Django templates and support template inheritance. Written in Java but works fine in Scala.

For web I like spray / akka http. It looks like play is starting to investigate using that as well.

What are the tradeoffs of doobie vs scalikejdbc? They seem similar.

I'm surprised not to see scalariform in the list.

@wsargent

This comment has been minimized.

Copy link

commented Sep 9, 2016

Akka and Akka Streams already deals with asynchronous code, and Play builds on Akka Streams for Websocket stuff. And Akka already has a scheduler built in.

@nairbv Play has an experimental akka http backend, but it's behind the engine, and doesn't effect what you use on the front end. You can put together a Play app in 30 lines of code so it can be just as "light" as Spray's routing API is.

Play Authentication is Silhouette, and Authorization is Deadbolt.

Logging I would recommend godaddy logger and Logstash Logback Encoder rather than Play's Logger API right now.

@yawaramin

This comment has been minimized.

Copy link

commented Sep 9, 2016

Check out log4s instead of scala-logging. Benefits:

  • Easier entry point--you can get a logger (which correctly prefixes log output with the enclosing class/type name) anywhere using org.log4s.getLogger instead of having to mix in the Logging trait everywhere
  • Slightly nicer API design, e.g. you can do logger.error(throwable)("Got an unrecoverable error") to automatically get log output with the Throwable's error message (and I believe the top of the stack trace) interleaved
  • Both Scala 2.10 and 2.11 supported by a single Maven module name log4s (with scala-logging, I think they reorganised the modules between the two Scala versions)
  • No need for macro paradise in Scala 2.10.
@mdedetrich

This comment has been minimized.

Copy link

commented Sep 9, 2016

https://github.com/getquill/quill is very nice if you want a statically typed interface for PostGreSQL (it also uses an asyc driver so it has better performance)

For logging I use typesafe logging, but play-logging is equally as good. They both wrap over logback

Also you can add https://github.com/cb372/scalacache for caching and https://github.com/lloydmeta/enumeratum for sane enums (which also has interopt for circe!)

@pathikrit

This comment has been minimized.

Copy link
Owner Author

commented Sep 9, 2016

@mdedetrich - Yes, quill is cool but I prefer writing vanilla SQL because:

  1. I can copy paste the SQL from my Scala code into my DB console or into other parts of my company's codebase which maybe written in Python or Java.
  2. What if I need to use something not in the ORM (e.g. some PostgreSQL features like CAST or functions)?

I still want static checking of my vanilla SQL queries so I use this

@yawaramin, @mdedetrich, @denisftw - Thanks for the suggestions. I added scalacache, log4s, monix

@rtfpessoa: What are the benefits of sbt-coursirer besides faster downloads? I personally don't care about my download speed because I have pretty good internet and most of my jars are in my ivy cache anyway.

@wsargent - I am yet to find something regarding authorization and authentication that I like - I always have to do something custom so far. I will give Silhouette and Deadbolt one more try :)

@guersam

This comment has been minimized.

Copy link

commented Sep 10, 2016

A nitpick: none of doobie, slick or quill is an ORM and they emphasize not being ORMs actually. How about just DB?

@fanf

This comment has been minimized.

Copy link

commented Jun 14, 2017

For configuration, there is a new project which seems very good if you are in the "toward pure software" mood: https://cir.is/
From the site:

Lightweight, extensible, and validated configuration loading in Scala and Scala.js.
The core library is dependency-free, while modules provide library integrations.
"Ciris encourages compile-time safety by defining as much as possible of your configurations in Scala"

Documentation seems to be quite good, to!

@fanf

This comment has been minimized.

Copy link

commented Jun 15, 2017

And if you spend a lot of time and boilerplate copying things between case class, there is that little lib built on top of shapeless: https://github.com/scalalandio/chimney

@slouc

This comment has been minimized.

Copy link

commented Jul 7, 2017

Saw Play, stopped reading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.