Menu

Using an in-memory DAG (NetworkX) + Postgres for prerequisite tracking in FastAPI: Good architecture or over-engineered?

Reading 0:00
15s threshold

Hey guys need some help..

I’m designing the backend for an adaptive learning platform using FastAPI + PostgreSQL, and I’m weighing two approaches for handling curriculum prerequisite paths.

The Setup:

Instead of a linear syllabus, the curriculum is modeled as a Directed Acyclic Graph (DAG) with ~300 to 400 CS concept nodes

When a student passes a quiz (>= 80\%), downstream dependent nodes unlock based on topological order.

If a student fails a topic, the backend traverses upstream dependencies to find the earliest unmastered bottleneck node, locks downstream progress, and builds a targeted review path.

The quiz questions are a mix of pre-mapped benchmark items and dynamically generated MCQs grounded in textbook text.

Which one should I go with:

Approach 1 (In-Memory NetworkX):

Define the static graph structure once, load it into Python memory via networkx on FastAPI startup, run ancestor/descendant lookups and topological sorts in Python, and write user mastery states/scores back to…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.