Data Modeling for Systems
Lesson 9Beginner1h 14mAssessment-backed

Data Modeling for Systems

Learn how product behavior, access patterns, entities, relationships, and state transitions shape production data models.

What you will be able to do

Model data from product flows instead of starting with tables.
Identify entities, relationships, ownership, and state transitions.
Separate write models, read models, and derived views.
Understand how data models affect APIs, storage choice, and system boundaries.
Use a practical data-modeling brief before choosing SQL or NoSQL.

Data modeling is deciding what facts the system must remember, who owns them, how they change, and how they will be read. Good models start from product behavior, not from database fashion.

Start With Product Flows

Before tables or collections, write the flows. A product flow reveals the entities, state changes, consistency needs, and read patterns the model must support.

Data modeling flow from product actions to entities relationships and read models
Product actions reveal entities, relationships, state changes, and read models.
QuestionWhy it mattersExample
What action happens?Defines state changeUser places an order.
What facts must be stored?Defines entities and fieldsOrder, items, address, payment intent.
Who owns the data?Defines service boundaryOrder service owns order state.
How is it read?Defines indexes/read modelsOrder history by user and status.
What must be correct?Defines consistency needPayment state and order state must not conflict.

Scenario: Course Progress System

SkillSkore needs to track course progress: enrolled courses, completed lessons, module scores, assessment attempts, and certificate eligibility. A naive model stores a single progress percentage. A better model stores the events and state needed to explain that percentage.

EntityImportant fieldsWhy
EnrollmentuserId, courseId, enrolledAt, statusConnects a learner to a course.
LessonProgressuserId, lessonId, completedAt, timeSpentTracks learning progress.
AssessmentAttemptuserId, assessmentId, score, passed, submittedAtSupports strict scoring and retry logic.
ModuleScoreuserId, moduleId, score, unlockedAtSupports beginner/intermediate/advanced motivation.
CertificateuserId, courseId, issuedAt, finalScoreDurable proof of completion.

Write Model vs Read Model

The write model protects correctness. The read model makes screens fast. They can be the same for simple systems, but high-read products often add derived views, indexes, caches, or search documents.

ModelOptimized forExample
Write modelCorrect changesStore assessment attempt with immutable submitted answers.
Read modelFast displayShow dashboard with course progress, next lesson, and current score.
Derived viewPrecomputed summaryModule completion percentage by user.
Search modelText and rankingSearch lessons by title, concept, and keyword.
Analytics modelLong-term analysisDaily active learners and pass rates.

Design principle

Model the truth first, then add read optimizations. If you only model the current UI, the system breaks when product requirements evolve.

Cloud Storage Mapping

NeedAWSGCPAzure
Relational truthRDS/AuroraCloud SQL/SpannerAzure SQL
Document/key-value accessDynamoDBFirestore/BigtableCosmos DB
Object/filesS3Cloud StorageBlob Storage
Search modelOpenSearchVertex AI Search/Elastic on GCPAzure AI Search
Analytics storeRedshift/AthenaBigQuerySynapse/Fabric

Modeling Brief

SectionWhat to write
Core entitiesThe main nouns the system must remember.
OwnershipWhich service/module owns each entity.
State transitionsHow each entity changes over time.
Read patternsThe screens, APIs, jobs, and reports that read data.
Correctness rulesWhat must be consistent and what may lag.
RetentionHow long data must be stored and why.

Beginner Mistakes

  • Starting with SQL vs NoSQL before understanding access patterns.
  • Saving only the current UI state and losing important history.
  • Letting multiple services own the same data.
  • Ignoring read patterns until the application is slow.
  • Forgetting retention, audit, and deletion requirements.

Guided Practice

Practice task

Model a basic comments feature. List entities, important fields, owner, read patterns, and one correctness rule.

Sample Answer

PartExample
EntitiesPost, Comment, User, CommentReaction.
OwnerComment service/module owns comments and reactions.
Read patternsList comments by post, count comments by post, list recent comments by user.
Correctness ruleA deleted comment should not appear in normal reads, but may remain in audit history.
OptimizationMaintain comment count as derived data if reads are heavy.

Before You Continue

  • You should be able to model data from flows.
  • You should understand entities, ownership, read patterns, and state transitions.
  • You should know the difference between write models and read models.
  • You are ready to choose SQL or NoSQL based on the model instead of hype.