Microservices and Choices

Imagine you have a model with choices. The list of choices is up to now in the Python source code.

That’s fine if you have a monolith.

But if you want to move from monolith to microservices, how do you handle the choices?

A monolith has the big advantage that this is no problem, and you can have a ForeignKey to the model.

How do you handle this?

Your choices for a field doesn’t need to be a static field. The choices parameter can also be a callable to build that list dynamically. That callable could also be exposed as a service.

We use a different technique - for our Django projects having fields restricted to a specific list of options, those fields are defined as foreign keys to corresponding code tables.