polylith 2026-10-12

Think I've worked myself into a mild spaghetti, can anyone divulge their method of managing configs across their polylith components/projects? Do you just rely on a single different config-file per-host to separate test/prod configs? (each located somewhere like /etc//config.edn) Or do you have your configs as resources, co-located with the related component; and you have some logic in your personal development. namespace that overrides the production config? Or do you have configs defined per-project? And/Or is config-management itself silo'd to a specific component? Prescriptions would be appreciated, I've finally hit a point where my brain is saying "I should really fix this before the next deployment". The way I see it, configs co-located with their related component is the most "self-contained/lego-brick"-esque experience, but that comes with the caveats of A) checking credentials into VC, and B) not having an immediate way to swap to a test-config

We have default configs in resources for the relevant components and then we override with /etc/<repo>/<component>.edn data—and we manage those files as part of a deployment (it's automated and each tier gets a different set of overrides, that come from outside the Polylith portion of our platform).

That means that dev, CI, QA, and production have their own set of EDN files, and so developers have a "deploy" step when setting up their environment the first time, and CI also includes a "deploy" step.

That also allows us to test config changes on individual machines in a cluster before rolling things out (via the regular per-tier deploy machinery).

(I will use the term "bricks" instead of components below because I use the Component library for my services) In my project I use the Component library for my services with a thin layer over it to figure out dependencies and configuration options. These services use Polylith's bricks. So the configuration goes from the services to the bricks. The composition of these services happens in the base of a project. And the required config is a product of this composition. I have an example config in each projects. If an option is missing the system will complain on startup. So I have the config per project decoupled from the individual Polylith bricks

Much appreciate the both of you gratitude, I'll try and bake something up with the recommendations in mind ⭐

My setup is much closer to that of @jeroenvandijk, except that I only keep test resources in components and bases; and prod resources in projects. Mostly though, I focus on reuse rather than ownership. That is, I maintain two bricks of resource files - test-resources and resources - and compose any usage from these across bases, components and projects. You're welcome to look at https://github.com/repldriven/mono and https://github.com/repldriven/queenswood as examples. They're both quite sophisticated and opinionated, and the latter builds on the former, but it works well, especially when you factor in that you'd probably like to use testcontainers for testing, deploy helm charts locally or on the cloud for deployment, or build your system as a modular monolith or multiple services on a whim.