App System
Application System configuration
The application is based on the Integrant micro-framework to manage system state and dependencies.
Configuration
The system is defined in the resources/config.edn file. We've extended the default configuration with the Aero library, which adds useful reader tags to enhance EDN configuration. By default, our system config supports three profiles: :test, :dev, and :prod. You can extend these profiles according to your requirements.
As a shortcut for the config extension we use small helper library integrant-extras which provides a set of useful functions to read and manage the system configuration.
But other than that, it's just regular Integrant configuration.
By default there are two components in the system: :myproject.db/db and :myproject.server/server.
The db component is responsible for managing the database connection pool, while the server component is responsible for starting the web server. You can add more components to the system as needed.
Each component pre-defined in the system comes with Malli schema for its arguments.
Development
The main entry point for development is the dev/user.clj file. This file contains several useful functions to manage the application in the REPL. The most important function is reset:
This function reads the system configuration and starts and restarts the system. We extend the default config.edn with the config.dev.edn file, which adds an extra component to start the Tailwind CSS watcher as part of the application system.
Production
In production, the main entry point is src/myproject/core.clj. It contains a -main function that runs the system using integrant-extras.core/run-system. This function is used when running the application from a JAR file.
The Slim library is used to build the JAR file. It's a wrapper around the tools.build library that simplifies the process of building JAR files. The configuration is defined in the deps.edn file under the :build alias. You can run the build with the following command:
This command will compile the output CSS file, hash static assets, create a manifest.edn file in the new resources-hashed directory, and build the JAR file.
Logging
For logging we use combination of standard org.clojure/tools.logging and ch.qos.logback/logback-classic. You can find logging config at resources/logback.xml.
