Choosing a technology stack that will suite your applications needs is crucial. Although you can pretty much use any programming language to create a backend application, some will make it easier to start with, some will make it easier to maintain it down the line. So which stack did we choose?
Creating robust, fast and secure backend is one of the most important parts creating web application. Most (if not all) logic and calculations is done on the server side.
In GoodSoft we use Scala language for almost all of our backends. For our use case, it’s key features are:
- Static typing
- OOP and FP styles
- Huge amount of libraries
- Great community and documentation
The first one saves us a lot of time since most errors can be caught during compilation. We don’t have to guess what type will be returned or explicitly check if some variable is what it should be.
Combination of object oriented programming and functional programming styles allows us to model our systems with objects and perform calculations using functional paradigms. The second one makes it much easier to debug methods, since the result should depend only on passed arguments and not some hidden states.
Scala not only has its own first party libraries, but since it runs on JVM and compiles to bytecode it can use all Java libraries. This provides us with a huge amount of possibilities when searching for solutions.
Since we are building backend server applications we need some form of a web framework. PlayFramework is a Scala based framework that provides all necessary tools for creating web apps. It’s an Open Source project created by Lightbend and its community. Its key features are ease of use – it uses convention over configuration, allows for hot code reloading while developing and is fully stateless. The last part is important. It helps in creating easily scalable applications. Another key feature is support for asynchronous I/O operations. It allows us to process and service long requests without blocking HTTP threads.
Data access and database
Our database of choice is PostgreSQL. We use it for its fast read and write speeds and great handling of complicated SQL queries.
For simplifying database access in our server applications, we use Quill. It’s a library that allows us to write Scala code to access data. Another important aspect of using Quill is the ability to completely switch databases. In the future we would be able to migrate data to other engines and Quill should handle everything for us.
Every application we create is different. Some may need to store huge amounts of files, others need to run on a small server in the client’s office. For this reason we deploy to many different environments like AWS or VPS.