We can imagine the
bases folder as "drawer", which holds all of the bases in our workspace.
Each base has a standard Clojure project structure; with a
project.clj file (similar to
pom.xml, if you are used to Maven and Java), a
readme.md file, a
resources folder, a
src folder, and a
test folder. Each base is a project to allow us to compile them as individual artefacts, which guarantees that they are de-coupled from all the other building blocks.
As you hopefully remember from the block metaphor, a base's API is where it exposes its endpoints to the outside world. A base's API is simply a namespace, in this case called
api.clj The RealWorld example exposes a REST-API, but remember that Polylith doesn't restrict you to any particular API technology.
Bases should usually delegate the implementation of each endpoint to components. However, it's also possible to keep tightly coupled implementation within a base. In the RealWorld example the
handler namespace delegates each API endpoint to an appropriate component, but the
middleware namespace implements REST-API specfic middleware functions directly within the base.