Polylith

Polylith is a software architecture that applies functional thinking at the system scale. It helps us build simple, maintainable, testable, and scalable backend systems.
A 39 minutes overview of the Polylith architecture, by Joakim Tengstrand and Furkan Bayraktar

What is Polylith?

Polylith is, first and foremost, an opinionated file structure for codebases (similar to how a framework forces you to structure your code in a particular way). Polylith's structure gives a host of benefits for the modularity, composability, testability, and "growability" of the codebase, and a near friction-free development experience when working with your code in an editor/IDE.

One of the key benefits is how it separates development from production, giving us the freedom to work with our code as if it was a single codebase, but choose to deploy it as any number of artifacts (services, tools, and libraries).

To make the development experience even more delightful, we've also built a tool which gives instant creation of the various building blocks, incremental tests (only test the code that's impacted by the last change), and project visualization.

What programming languages are Polylith for?

Polylith is language agnostic, and it should be possible to use it in almost any programming language. We in the Polylith team have only used it with the functional language Clojure so far, but there is nothing stopping someone from using it in a procedural language like C, or an object oriented language like Java, which we have an example of here. Even without tooling support, you will get most of the benefits.

Where to begin?

  • If you'd prefer to start with a high-level technical overview of the architecture, then skip straight to Polylith in a Nutshell.

  • If you learn faster with audio/visual presentations, then you can start by watching the videos.

  • If you want to jump straight into some code, then head over to the Polylith RealWorld example app.

  • If you're feeling concerned about how a new architecture might affect your deployment setup, then read Transitioning to Polylith.

  • If you prefer to start from the beginning, and take things at your own pace, then you're already in exactly the right place - just keep reading.

A brief introduction

Polylith is an architecture that allow us to compose systems out of LEGO-like bricks:

If you join us on this journey, then you'll discover how Polylith structures code to help you develop faster and communicate your ideas better. By the end, you'll understand how to combine building blocks into services and tools:

We hope you'll agree that Polylith makes building systems almost as fun as playing with LEGO®!

Let's start with why Polylith may be a good idea.