How to keep Firebase realtime database schema compatible in desktop application? - firebase

I am building a desktop application and added support for the Firebase realtime database. Because I am running a desktop application users will run different versions of my app.
As my app evolves, new features will be added and may require an update to the database schema as well. But I can't do this as I need to keep all client versions compatible.
For example, I have projects saved in the database at project/${uid}/${projectName}. Imagine in the future projects are not anymore tied to a user because I implement "collaboration" and want to change this path. How would I do this to keep all my clients up running?

You could store that path in realtime database and fetching the URL on client as required. I'm not sure what you mean by implement "collaboration" but if you want all the users to be on same version of your application then you would have to store the latest version in DB and verify the version yourself on client.
projects are not anymore tied to a user
In my opinion, if you could store a list of user UIDs who are a part of that project then that would be easier instead of structuring your app as projects/${uid}/projectname. If it is something like /projects/${projectId} then storing that list of authorized users would be much more easier.
There's Remote Config.
Firebase Remote Config is a cloud service that lets you change the behavior and appearance of your app without requiring users to download an app update.
You may have to use the REST API if your are building apps for desktop. Also as #Doug mentioned in comments, it may not synchronize all clients at same time.

Related

How to disable the multi tenant feature for a GCP project?

I have enabled the multi-tenancy feature for my firebase project in the GCP console following this guide but now there's no way to disable it back.
Will this affect any of project's behaviour?
As per the Public Documentation, currently there is nothing mentioned about how to disable multi-tenancy , however Google Support is aware of the issue and working on it. There will be some update in near future but currently it's not possible in UI or SDKs.
Will this affect any of the project's behaviour?
As per Firebase Documentation , multi-tenancy is not recommended for the Firebase Projects as mentioned with a reason :
Multi-tenancy can lead to serious configuration and data privacy
concerns, including unintended issues with analytics aggregation,
shared authentication, overly-complex database structures, and
difficulties with security rules.
Generally, if a set of apps don't
share the same data and configurations, strongly consider registering
each app with a different Firebase project.
For example, if you
develop a white-label application, each independently labeled app
should have its own Firebase project, and the iOS and Android versions
of that label should be in the same Firebase project. Each
independently labeled app shouldn't (for privacy reasons) share data
with the others.
To get more information related to the Firebase Authentication, you can refer to the doc.
If you want to continue in a multi tenant project below are some points which may help you perform certain activities on a multi tenant.
There are situations, however, where you want users to be manually or
programmatically created by an administrator, either using the Admin
SDK or Firebase console. In these cases, you can disable user actions
from the Firebase Authentication Settings page, which prevents account
creation and deletion by end-users. If you are using multi-tenancy,
you will need to make an HTTP request to disable these features on a
per-tenant basis.
You can also Manage Identity Platform tenants programmatically by User management,Identity verification,Import users,Access control with custom claims,User session management,Email action links,Tenant management by Create, list, get, update, delete tenants for a specific Identity Platform project , Manage OIDC and SAML providers on tenants.

Share local offline cache between two Firestore apps of same project

I have two apps that use the same Firebase project, so they use the same database when online.
I would like to know if there is some way to make them also share their offline data. In other words, if I make an offline write on app A, I would like to be able to read that document on app B while still offline (metadata pending write = true).
Perhaps if there was a way to change the Firestore local database location to a shared location for both apps, this could be achieved.
Apps (on iOS, Android, and Web) work in a sandboxed environment, and access to each other's sandbox is highly controlled. While it may technically possible to build a solution that shared the local cache, the Firebase SDKs in each app currently uses its own sandbox for its local cache and these can't be shared.
Also see:
How can I share local database of an existing app with a new app and make both work on it simultaneously?

Manage Firebase user accounts

I have an administrative panel that lists all users on my system. I would like to be able to delete the account of a saved user in firebase.auth().
I know the firebase provides an SDK for this, but I do not have a server on Node, my site is hosted directly on Firebase hosting.
Is there any other way to do this?
Create a Cloud Function (serverless) that deletes users using the Node.js Admin SDK. Then you can hit that endpoint whenever you want to delete a user: https://firebase.google.com/docs/hosting/functions
You do have a node server. It's free. You can install node on your laptop or even better you can stand one up online. I use the free tier of cloud9 IDE (I do not work for them and I'm not trying to sell anything).
Easiest of all, use Firebase's web console to delete a user, unless you have a need to build out a more elaborate system.

MeteorJS app architecture guideline required

I am building a marketplace Meteor app but I am confused about the app architecture. I want to build front end user interface for marketplace, Customer dashboard, Vendor dashboard, admin user interface and meteor mobile apps for customers and vendors. I know Meteor bundle everything in client folder and send it to the client. My question is do I need to use same hosted Mongodb database and create separate Meteor apps for
App 1 Marketplace user interface and Customer dashboard.
APP 2 Vendor dashboard.
APP 3 Admin user interface
App 4 Meteor Mobile App for Customers
APP 5 Meteor Mobile App for Vendors
OR
Create a single Meteor App for everyone. but in that case app size will increase.
OR
Create separate Meteor apps and connect all other apps to APP 1 (Marketplace App) through DDP to share publications and methods.
Please help me decide best architecture.
Option 1:
I've done so using a single MongoDb instance. I currently have four apps connected to it. It works really well.
Make sure you use the oplog for instant updates across all the apps.
Some of the security benefits of this approach were unexpectedly nice. For example, allow and deny rules being created with only one type of user in mind for each app. If someone has access to admin.yoursite.com for example, the permissions allow all sort of things for admins, but for the client facing app, the permissions can be locked down to only allow editing of the few things that are required.
You can get pretty far with this approach, I recommend it.
Option 2:
I wouldn't recommend making a large app that does everything.
Option 3:
Not to say there is no benefit to that sort of approach, but "APP1" in this case should probably be some sort of event log, which each app can subscribe to the events of and write events to, and update their own databases. This is the most complex (and expensive) solution, and I wouldn't recommend it until you are trying to scale really large. If you are interested in this type of approach I recommend looking into Event Sourcing/CQRS.

What would be the best approach to store data offline when working with web application in asp.net

I am writing a web application that will mostly be used on a mobile devices in asp.net C#. I was wondering what would be the best way to store data offline. This theory is what I have on mind:
When the user first access the website I want my code to export the entire schema and the data from the MSSQL database dynamically to JSON file (if it's possible) then the next step is to take that generated JSON file and create a local SQLite database with all the data from JSON. So later my application can read from it while the user is not online
please let me know what do you think or if this is not going to work because of something I am missing.
Thank you,
You have a few options, but it all depends on what your mobile app is like, what kind of data you are transferring (structured or unstructured), whether or not the ASP.NET site needs to serve web clients, etc.
Consider writing a mobile app using Cordova/PhoneGap. There are native plugins for various device platforms where you can store the data locally.
BreezeJS (http://www.breezejs.com/) is a native JavaScript framework for data access, including sync.
If you are creating a native iOS app, consider RestKit.
If you decide you want to create a native cross-platform app, you could use a technology such as Xamarin and use Azure Mobile Services to do data sync. You would have to convert your app to be a WebAPI however, which might not be feasible. (Disclosure: I work on this project)
Amazon has a sync service called Cognito.

Resources