Thuta Learning
IntermediateDevOps & Toolsintermediate

Data Structure

Relax. We'll talk through this in plain words — no textbook voice.

Data Structure

If you think through your Firestore structure carefully from the start, your queries, rules, and performance will all be much better down the line.

Simple Notes App Structure

javascript
users/{userId}
  name: 'Sai'
  email: 'sai@example.com'

notes/{noteId}
  ownerId: '{userId}'
  title: 'Firebase လေ့လာရန်'
  content: 'Auth, Firestore, Storage စမ်းမယ်'
  createdAt: serverTimestamp()
  isPinned: false

Why add ownerId?

ownerId tells you which user owns a given note. In queries, you can use where('ownerId', '==', user.uid) to read only your own notes, and in Security Rules you can check ownership the same way.

Best practice

You can shorten document field names, but being clear matters more than being short. ttl instead of title, ct instead of createdAt — the longer, clearer names make life easier for whoever reads the code later.

Data Structure | Thuta Learning