Workspace

A workspace is a single place for all of your organizations code and projects.

The workspace is often the root directory in a Polylith codebase, and it's where we work with all our building blocks and projects. A workspace is version controlled in a monorepo, and its subdirectories look like this:

▾ workspace
  ▸ bases
  ▸ components
  ▸ development
  ▸ projects

An alternative is to let the monorepo host more than one workspace, e.g.:

▾ workspace1
  ▸ bases
  ▸ components
  ▸ development
  ▸ projects
▸ workspace2
▸ workspace3

We can summarise the main ideas like this. Components encapsulate functionality while the bases decide how the code should be exposed and executed, e.g. as a command line tool, a lambda function, or a REST API. This separation allows us to easily change how our code is executed by including an arbitrary set of bricks in each project, that can later be used to build the artifacts we need. Finally, the development project is used to improve the development experience.

If you want to see an example of a complete Polylith codebase, go to the RealWorld example app or the usermanager-example app.

Last updated