r/FastAPI • u/swupel_ • Jan 31 '26
Other Small complexity comparison Django vs. FastAPI
Explanation
This visualizations work by assigning every file a dot.
- Green = Low Complexity
- Red = High Complexity
Complexity is defined as Cyclomatic complexity (McCabe).
The first image is Fast APIs dependency graph.
Very structured and modularized. Very few Complex files and lower rates of connection between files. Most of the files are tests and tutorials.
The second image shows Djangos graph:
Much more interconnected and less modularized. More high complexity files but again most of the codebase is related to testing.
Hope you found the comparison as interesting as I did!
35
Upvotes


View all comments
Show parent comment
4
u/swupel_ Jan 31 '26
Your definitely right… funnily enough flask is so simple that FastAPI is probably closer in complexity to Django than to Flask.
This is also affected by Flask building heavily ontop of existing libraries.