_CORE
AI & Agentic Systems Core Information Systems Cloud & Platform Engineering Data Platform & Integration Security & Compliance QA, Testing & Observability IoT, Automation & Robotics Mobile & Digital Banking & Finance Insurance Public Administration Defense & Security Healthcare Energy & Utilities Telco & Media Manufacturing Logistics & E-commerce Retail & Loyalty
References Technologies Blog Know-how Tools
About Collaboration Careers
CS EN
Let's talk

Google Firestore — Serverless NoSQL

06. 06. 2023 1 min read intermediate

Cloud Intermediate

Google Firestore — Serverless NoSQL

GCPFirestoreNoSQLReal-time 5 min read

Firestore datový model, real-time listeners, security rules a offline podpora.

Datový model

// collections → documents → subcollections
await setDoc(doc(db, 'users', 'uid123'), {
  name: 'Jan Novák', email: '[email protected]',
  createdAt: serverTimestamp()
});

Real-time Listeners

onSnapshot(query(collection(db, 'messages'),
  where('roomId', '==', 'room-42'),
  orderBy('createdAt', 'desc'), limit(50)
), snapshot => {
  snapshot.docChanges().forEach(change => {
    if (change.type === 'added') renderMessage(change.doc.data());
  });
});

Security Rules

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{userId} {
      allow read: if request.auth != null;
      allow write: if request.auth.uid == userId;
    }
  }
}

Summary

Firestore = ideální pro mobile/web apps s real-time sync a offline podporou.

Need Help with Implementation?

Our team has experience designing and implementing modern architectures. We’re happy to help.

Free Consultation

Share:

CORE SYSTEMS tým

Stavíme core systémy a AI agenty, které drží provoz. 15 let zkušeností s enterprise IT.