1 / 43

Firebase: Evolution, Features, and Benefits

Explore the history, evolution, and various features of Firebase, a backend service developed by Google. Discover how Firebase has revolutionized app development with its real-time database and cloud storage capabilities. Learn about the introduction of Cloud Firestore and its advantages over the Firebase Realtime Database. Understand the flexibility, scalability, and simplicity of using Firebase in your app development projects.

silvas
Télécharger la présentation

Firebase: Evolution, Features, and Benefits

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. History • Firebase evolved from Evolve Company in 2011. • A prior startup founded by James Tamplin and Andrew Lee. • And then, separate as a “Firebase Company” in April 2012. • Firebase was acquired by Google in October 2015. • In January 2017, Google acquires Fabric and Crashlytics from Twitter. • Firebase was been lunching Cloud Firestore, a Document Database, in October 3,2017.

  2. Firebase is a backend service developed by Google itself, enabling a bunch various features to the developer with easy integration strategies.A Backend service provide web/mobile developers a way to link their apps to a backend cloud storage and APIs exposed by back end applications.

  3. Firebase

  4. Realtime Database changed how we build apps Serverless Real-time Offline

  5. Two things we’ve long wanted to improve User:{ Lena:{ birthday: 11/01/2017 address: Amsterdam },……. }, Friends:{ Lena:{Tim:true},…. } Scale without sharding Simpler Data modeling & querying

  6. Introduction to Cloud Firestore • Flexible , Scalable database • Data တွေဝင်လာတဲ့အချိန်ဆိုရင်Realtime Listenerနဲ့ application က data တွေကို sync လုပ်ပေး • Offline လဲsupport ပေး ။ networkရရင်လဲ တန်းsyncလုပ်ပေး • Cloud-hostedဖြစ်တယ် • No SQL database ဖြစ်ပီးnative SDKs နဲ့ တိုက်ရိုက်ချိတ်နိုင်တယ် • Native Node.js, Java, Python, and Go SDKs, in addition to REST and RPC APIs မှာသုံးနိုင်တယ်

  7. Data Structure Document Collection

  8. YES Totally…no..Just…no Wrong

  9. Truly Serverless Firebase Auth Security Rules Cloud Functions Cloud Firestore App+ Client SDKs Firebase Hosting

  10. Powered by Google Cloud’s Infrastructure Scalable Serverless Reliable & available

  11. Realtime Database

  12. Firebase Cloud Firestore v/s Firebase Realtime Database • Nowadays, Firebase brought a new feature “Cloud Firestore.” which is similar to “Firebase Realtime database” . • “Realtime database” is structured as a JSON tree. • “Cloud Firestore” is stored data in a documents which is a set of key-value pair and collection formats.

  13. More Structure data Realtime Database stored data in JSON tree but Cloud Firestore stored data in documents which is very similar to JSON.

  14. Better Querying In the Realtime database, We can only sort or filter on a property in a single query, not both sort and filter on a property while In the Cloud FireStore, You can chain filters and combine filtering and sorting on a property in a single query. If you want to fetch data in descending order then Cloud fireStore is very useful for you but in the Realtime database, There is no available any query for it. You can also chain multiple “where” methods to create more specific queries (logical AND) in Cloud FireStore.

  15. Pricing

  16. Usage • Realtime Database is Firebase's original database. It's an efficient, low-latency solution for mobile apps that require synced states across clients in realtime. • Cloud Firestore is Firebase's new flagship database for mobile app development. It improves on the successes of the Realtime Database with a new, more intuitive data model. Cloud Firestore also features richer, faster queries and scales better than the Realtime Database.

  17. Why Should we use????

  18. Flexibility • DBMS ထဲကHierarchical data Structures တွေကိုအလွယ်တကူပြောင်းလဲယူသုံးလို့ရတယ်။ • Data တွေကိုDocumentsထဲသိမ်းတယ် ထပ်ပီးတော့collectionsအနေနဲ့Firestore ထဲမှာစီစဉ်သိမ်း • အဲ့ Documents တွေမှာcomplex nested objects တွေsub-collectionsအနေနဲ့ ပါဝင်နိုင်တယ်။

  19. Storing Data in Cloud Firestore

  20. Expressive Querying Simple Queries Create a reference to the cities collection CollectionReferencecitiesRef = db.collection("cities"); Create a query against the collection. Query query = citiesRef.whereEqualTo("state", "CA"); Query capitalCities = db.collection("cities").whereEqualTo("capital", true); The where() method takes three parameters: a field to filter on, a comparison operation, and a value. The comparison can be <, <=, ==, >, or >= citiesRef.whereEqualTo("state", "CA"); citiesRef.whereLessThan("population", 100000); citiesRef.whereGreaterThanOrEqualTo("name", "San Francisco"); // Create a reference to the cities collectionCollectionReference citiesRef = db.collection("cities");// Create a query against the collection.Query query = citiesRef.whereEqualTo("state", "CA"); citiesRef.whereEqualTo("state", "CA"); citiesRef.whereLessThan("population", 100000); citiesRef.whereGreaterThanOrEqualTo("name", "San Francisco")

  21. Expressive Querying Compound Queries(Right) citiesRef.whereEqualTo("state", "CO").whereEqualTo("name", "Denver");citiesRef.whereEqualTo("state", "CA").whereLessThan("population", 1000000); citiesRef.whereGreaterThanOrEqualTo("state", "CA").whereLessThanOrEqualTo("state", "IN");citiesRef.whereEqualTo("state","CA")        .whereGreaterThan("population", 1000000); Invalid Filter ranged (X) • citiesRef.whereGreaterThanOrEqualTo("state", "CA").whereGreaterThan("population", 100000);

  22. Order and limit data Valid: Range filters and orderBy on the same field citiesRef.orderBy("name").limit(3); citiesRef.orderBy("name",Direction.DESCENDING).limit(3); Invalid : Range Filters and first orderBy on the different field citiesRef.whereGreaterThan("population", 100000).orderBy("country");

  23. Paginate Data with Query Cursors • Query cursors define the start and end points for a query, allowing you to: • Return a subset of the data. • Paginate query results. • However, to define a specific range for a query, you should use the where() method described in Simple Queries.

  24. Pagination Example

  25. // Construct query for first 25 cities, ordered by population Query first = db.collection("cities")        .orderBy("population")        .limit(25);first.get()    .addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {        @Override        public void onSuccess(QuerySnapshotdocumentSnapshots) {            // Get the last visible documentDocumentSnapshotlastVisible = documentSnapshots.getDocuments()                    .get(documentSnapshots.size() -1);            // Construct a new query starting at this document,            // get the next 25 cities.            Query next = db.collection("cities")                    .orderBy("population")                    .startAfter(lastVisible)                    .limit(25);            // Use the query for pagination        }    });

  26. Add a simple cursor to a query startAt(A) and startAfter(A) //Get all cities with a population >= 100,000 , ordered by population db.collection(“cities”) .orderBy(“population”) .startAt(100000); endAt(A) and endBefore(A) //Get all cities with a population <=100,000,ordered by population db.collection(“cities”) .orderBy(“population”) .endAt(100000);

  27. Set multiple cursor conditions //Will return all Yangon db.collection(“cities”) .orderBy(“name”) .orderBy(“state”) .startAt(“Yangon”); //Will return “Yangon,Sanchaung” and “Yangon,LaThar” db.collection(“cities”) .orderBy(“name”) .orderBy(“state”) .startAt(“Yangon”,”Sanchaung”);

  28. Manage Indexes in Cloud Firestore • Cloud Firestore requires an index for every query, to ensure the best performance. • All document fields are automatically indexed, so queries that only use equality clauses don't need additional indexes. • If you attempt a compound query with a range clause that doesn't map to an existing index, you receive an error.

  29. Secure Data with Cloud Firestore • Cloud Firestore offers robust access management and authentication through two different methods, depending on the client libraries you use. • For mobile and web client libraries, use Firebase Authentication and Cloud Firestore Security Rules. • For server client libraries, use Cloud Identity and Access Management (IAM). Setup Cloud Firestore Security Rules service cloud.firestore{ match/databases/{database}/documents{ match/{documents=**}{ allow read, write: if false; } } }

  30. Public // Anyone can read or write to the database, even non-users of your app.service cloud.firestore { match /databases/{database}/documents {// Match all documents, recursively, with a wildcard and the "=**" recursive modifiermatch /{document=**} {      allow read, write;    }  }} User // Grants a user access to a document matching their Auth user Idservice cloud.firestore { match /databases/{database}/documents {// Collection named "users", document named after the userIdmatch /users/{userId} {      allow read, write: if request.auth.uid == userId;   }  }}

  31. Private // Access to documents through the Cloud Firestore mobile/web// client libraries is completely disallowed. Documents may still be// accessible through the Cloud Firestore server client libraries;// the Cloud Firestore REST and RPC APIs; and the Cloud Datastore// client libraries and APIs.service cloud.firestore {  match /databases/{database}/documents { match /{document=**} {      allow read, write: if false;    }  }}

  32. Libraries and Frameworks A-Frame Angular Backbone.js Flutter React Redux Vue.js

More Related