Build your backend service in Scala 3 the easy way
import ... // import your dependencies
object app extends pillars.IOApp(DB, DBMigration, FeatureFlags, HttpClient): //define your apps modules
def infos: AppInfo = BuildInfo.toAppInfo // automatic description from your build
def run: Run[IO, IO[Unit]] = // enjoy!
for
_ <- logger.info(s"📚 Welcome to ${Config[IO].name}!") // logging is included in pillars-core
_ <- dbMigration.migrate("classpath:db/migrations") // you can access directly your modules
_ <- flag"feature-1".whenEnabled: // handy feature flag interpolation
db.use: session =>
for
date <- session.unique(sql"select now()".query(timestamptz))
_ <- Logger[IO].info(s"The current date is $date.")
yield ()
_ <- http.get("https://pillars.dev"): response =>
logger.info(s"Response: ${response.status}")
_ <- server.start(homeController, userController) // start your server with your controllers
yield ()
end for
end run
end app
libraryDependencies ++= Seq("com.rlemaitre" %% "pillars-core" % "0.4.2")
ivy"com.rlemaitre::pillars-core:0.4.2"
//> using dep com.rlemaitre::pillars-core:0.4.2
scala_artifact(
group="com.rlemaitre",
artifact="pillars-core",
version="0.4.2",
packages=["pillars.**"],
)
implementation 'com.rlemaitre:pillars-core:0.4.2'
<dependency>
<groupId>com.rlemaitre</groupId>
<artifactId>pillars-core</artifactId>
<version>0.4.2</version>
</dependency>
It offers a modular structure, allowing developers to use only the components they need, resulting in efficient and streamlined applications.
Using OpenTelemetry, Pillars includes built-in support for observability, allowing you to monitor and understand the behavior of your application. This can be crucial for identifying and resolving issues quickly.
Pillars uses Netty for HTTP servers and clients, which is known for its high performance and scalability. This can help to ensure that your application remains responsive under heavy load.
Pillars includes an admin server feature, providing a separate interface for administrative tasks. This can help to keep your main application server focused on serving user requests.
Pillars provides a streamlined interface for interacting with databases. This can help to reduce the complexity of your codebase and make it easier to manage data operations.
Pillars supports feature flags, allowing you to toggle features on and off without needing to redeploy your application. This can be particularly useful for testing new features or managing rollouts.
Read our documentation for how to use Pillars
Documentation