Skip to content

Instantly share code, notes, and snippets.

@pathikrit
Last active April 24, 2021 17:36
Show Gist options
  • Star 82 You must be signed in to star a gist
  • Fork 15 You must be signed in to fork a gist
  • Save pathikrit/892a3a254c84f274a007ef9d763e11dd to your computer and use it in GitHub Desktop.
Save pathikrit/892a3a254c84f274a007ef9d763e11dd to your computer and use it in GitHub Desktop.
My highly opinionated list of things needed to build an app in Scala

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
Copy link

wsargent commented Sep 8, 2016

This is great!

@denisftw
Copy link

denisftw 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
Copy link

@Petesta
Copy link

Petesta commented Sep 8, 2016

@nairbv
Copy link

nairbv 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
Copy link

wsargent 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
Copy link

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
Copy link

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
Copy link
Author

@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
Copy link

guersam 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
Copy link

fanf 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
Copy link

fanf 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
Copy link

slouc 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