How to replace DjangoFSM with a database-driven workflow engine (BPMN or alternative)?
Title:
How to replace DjangoFSM with a database-driven workflow engine (BPMN or alternative)?
Body:
We currently implement business processes using Django models + DjangoFSM (finite state machine). Each process is hardcoded:
states and transitions are defined in model fields
transition logic is implemented in viewsets
every process change requires code changes and redeploy
This leads to several problems:
DjangoFSM is not compatible with Django 6
tight coupling to Django (we plan to move to FastAPI or another backend)
impossible to support multiple customers with different workflows without forking code
no runtime configurability of processes
What we want instead:
store process definitions in the database
allow admins to configure workflows without code changes
validate process schemas
keep execution logic in backend code
avoid heavy proprietary BPM systems (prefer open-source or embeddable solutions)
ideally decouple from Django entirely
We are considering moving from FSM to a BPM-style approach (possibly BPMN), but we are unsure about implementation strategy.
Question:
What are practical approaches to implement a database-driven, customizable workflow engine in Python backend systems?
More specifically:
Are there lightweight or headless open-source BPM/workflow engines suitable for embedding?
Is BPMN worth implementing for this use case, or are simpler models (e.g., state machines + metadata) more practical?
What are common architectural patterns for separating workflow definition from execution logic?
We are not looking for full enterprise BPMS solutions, but rather something embeddable or extensible.
Additional context:
Current stack: Django, PostgreSQL
Target: possibly FastAPI + decoupled workflow engine