We can imagine the
services folder as a set of "shelves", which hold all of the services in a workspace.
A service is where we combine a set of building blocks into a deployable artefact. They are how we turn the monolithic development experience (having all our building blocks in one environment), into horizontally scalability, through the posibility to build and deploy multiple artefacts.
Each service in
services has a minimal project structure; with a
build.sh file, a
project.clj file, a
resources folder, and a
src folder. Making each service a project allows us to compile them as individual artefacts.
This assembly of selected building blocks into one service is achieved through the magic of symbolic links (notice the little arrows on the
src folders). The symbolic links refer to the corresponding folders for each component and base, which live in their respective "drawers". For example, the
user symbolic link in
services/realworld-backend/src/clojure/realworld/user points to the
Environments and services are similar (because they're both project folders) but have different purposes. Environments are used to develop code and therefore includes tests. Services don't have tests but do get built as deployable artefacts. Services can only have one base, but environments can have several bases.
Environments can also be used to execute code that you don’t want to deploy or mix with production code. For example, this could be scripts that fix problems with data, or exploratory code that explores external API’s.