Access firestore directly from mobile app or via backend server?
System Design question:
I'm using firebase for my mobile app with firestore as the DB and firebase functions as the backend.
Do I:
- Access firestore directly from the mobile app
- Only allow indirect access via a middleware/backend server(e.g. firebase functions)
I'm looking for guidance from a system design standpoint which of the two alternatives is better.
Traditionally I think accessing the DB directly from the client would be frowned upon but in the official firestore documentation google seems to actually encourage direct access without any backend server in between.
firebase model-view-controller architecture google-cloud-firestore system-design
add a comment |
System Design question:
I'm using firebase for my mobile app with firestore as the DB and firebase functions as the backend.
Do I:
- Access firestore directly from the mobile app
- Only allow indirect access via a middleware/backend server(e.g. firebase functions)
I'm looking for guidance from a system design standpoint which of the two alternatives is better.
Traditionally I think accessing the DB directly from the client would be frowned upon but in the official firestore documentation google seems to actually encourage direct access without any backend server in between.
firebase model-view-controller architecture google-cloud-firestore system-design
add a comment |
System Design question:
I'm using firebase for my mobile app with firestore as the DB and firebase functions as the backend.
Do I:
- Access firestore directly from the mobile app
- Only allow indirect access via a middleware/backend server(e.g. firebase functions)
I'm looking for guidance from a system design standpoint which of the two alternatives is better.
Traditionally I think accessing the DB directly from the client would be frowned upon but in the official firestore documentation google seems to actually encourage direct access without any backend server in between.
firebase model-view-controller architecture google-cloud-firestore system-design
System Design question:
I'm using firebase for my mobile app with firestore as the DB and firebase functions as the backend.
Do I:
- Access firestore directly from the mobile app
- Only allow indirect access via a middleware/backend server(e.g. firebase functions)
I'm looking for guidance from a system design standpoint which of the two alternatives is better.
Traditionally I think accessing the DB directly from the client would be frowned upon but in the official firestore documentation google seems to actually encourage direct access without any backend server in between.
firebase model-view-controller architecture google-cloud-firestore system-design
firebase model-view-controller architecture google-cloud-firestore system-design
asked Nov 26 '18 at 6:34
deekay42deekay42
737
737
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Both Firebase database products are designed to be used on the client. One of its killer features is the automatic realtime syncing of changes. So definitely its meant to be consumed from the client. Thats not to say you cant consume from the server as well. But its all about setting up your rules effectively so that you can query from the client. You will need to use Firebase Auth if you want to secure your database. Some links to relevant docs.
Firestore Security Rules
Example of some Security Rules for querying
Firebase Auth
And incase you already have an authentication method in place and cant migrate to Firebase Auth you can use Custom Auth where when you authenticate the person you issue them with a Firebase Token which you can login them in with in the app.
add a comment |
I'm looking for guidance from a system design standpoint which of the two alternatives is better.
IMHO, the question shouldn't be asked, which is better because each one of those products, Cloud Firestore and Cloud Functions for Firebase are two different products with different mechanisms but the same purpose.
As also Jack Woodward mentioned in his answer, the first solution can help you keep your data in sync across client apps. As in case of Firebase realtime database the main feature is the realtime feature. In both bases your data is stored as JSON and synchronized in realtime to every connected client.
Regarding the second option, as in the official documentation:
Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your code is stored in Google's cloud and runs in a managed environment. There's no need to manage and scale your own servers.
If you are simply asking what can you do with Cloud Functions, please see the use cases of Cloud Functions:
- Notify users when something interesting happens.
- Perform Realtime Database sanitization and maintenance.
- Execute intensive tasks in the cloud instead of in your app.
- Integrate with third-party services and APIs.
Hi! Can I help you with other informations? If you think that my answer helped you, please consider accepting it by clicking the checkmark (✔️) on the left side under the vote arrows. Should change the color in green. I'd appreciate it. Thanks!
– Alex Mamo
Nov 27 '18 at 9:16
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53475832%2faccess-firestore-directly-from-mobile-app-or-via-backend-server%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Both Firebase database products are designed to be used on the client. One of its killer features is the automatic realtime syncing of changes. So definitely its meant to be consumed from the client. Thats not to say you cant consume from the server as well. But its all about setting up your rules effectively so that you can query from the client. You will need to use Firebase Auth if you want to secure your database. Some links to relevant docs.
Firestore Security Rules
Example of some Security Rules for querying
Firebase Auth
And incase you already have an authentication method in place and cant migrate to Firebase Auth you can use Custom Auth where when you authenticate the person you issue them with a Firebase Token which you can login them in with in the app.
add a comment |
Both Firebase database products are designed to be used on the client. One of its killer features is the automatic realtime syncing of changes. So definitely its meant to be consumed from the client. Thats not to say you cant consume from the server as well. But its all about setting up your rules effectively so that you can query from the client. You will need to use Firebase Auth if you want to secure your database. Some links to relevant docs.
Firestore Security Rules
Example of some Security Rules for querying
Firebase Auth
And incase you already have an authentication method in place and cant migrate to Firebase Auth you can use Custom Auth where when you authenticate the person you issue them with a Firebase Token which you can login them in with in the app.
add a comment |
Both Firebase database products are designed to be used on the client. One of its killer features is the automatic realtime syncing of changes. So definitely its meant to be consumed from the client. Thats not to say you cant consume from the server as well. But its all about setting up your rules effectively so that you can query from the client. You will need to use Firebase Auth if you want to secure your database. Some links to relevant docs.
Firestore Security Rules
Example of some Security Rules for querying
Firebase Auth
And incase you already have an authentication method in place and cant migrate to Firebase Auth you can use Custom Auth where when you authenticate the person you issue them with a Firebase Token which you can login them in with in the app.
Both Firebase database products are designed to be used on the client. One of its killer features is the automatic realtime syncing of changes. So definitely its meant to be consumed from the client. Thats not to say you cant consume from the server as well. But its all about setting up your rules effectively so that you can query from the client. You will need to use Firebase Auth if you want to secure your database. Some links to relevant docs.
Firestore Security Rules
Example of some Security Rules for querying
Firebase Auth
And incase you already have an authentication method in place and cant migrate to Firebase Auth you can use Custom Auth where when you authenticate the person you issue them with a Firebase Token which you can login them in with in the app.
answered Nov 26 '18 at 9:14
Jack WoodwardJack Woodward
62149
62149
add a comment |
add a comment |
I'm looking for guidance from a system design standpoint which of the two alternatives is better.
IMHO, the question shouldn't be asked, which is better because each one of those products, Cloud Firestore and Cloud Functions for Firebase are two different products with different mechanisms but the same purpose.
As also Jack Woodward mentioned in his answer, the first solution can help you keep your data in sync across client apps. As in case of Firebase realtime database the main feature is the realtime feature. In both bases your data is stored as JSON and synchronized in realtime to every connected client.
Regarding the second option, as in the official documentation:
Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your code is stored in Google's cloud and runs in a managed environment. There's no need to manage and scale your own servers.
If you are simply asking what can you do with Cloud Functions, please see the use cases of Cloud Functions:
- Notify users when something interesting happens.
- Perform Realtime Database sanitization and maintenance.
- Execute intensive tasks in the cloud instead of in your app.
- Integrate with third-party services and APIs.
Hi! Can I help you with other informations? If you think that my answer helped you, please consider accepting it by clicking the checkmark (✔️) on the left side under the vote arrows. Should change the color in green. I'd appreciate it. Thanks!
– Alex Mamo
Nov 27 '18 at 9:16
add a comment |
I'm looking for guidance from a system design standpoint which of the two alternatives is better.
IMHO, the question shouldn't be asked, which is better because each one of those products, Cloud Firestore and Cloud Functions for Firebase are two different products with different mechanisms but the same purpose.
As also Jack Woodward mentioned in his answer, the first solution can help you keep your data in sync across client apps. As in case of Firebase realtime database the main feature is the realtime feature. In both bases your data is stored as JSON and synchronized in realtime to every connected client.
Regarding the second option, as in the official documentation:
Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your code is stored in Google's cloud and runs in a managed environment. There's no need to manage and scale your own servers.
If you are simply asking what can you do with Cloud Functions, please see the use cases of Cloud Functions:
- Notify users when something interesting happens.
- Perform Realtime Database sanitization and maintenance.
- Execute intensive tasks in the cloud instead of in your app.
- Integrate with third-party services and APIs.
Hi! Can I help you with other informations? If you think that my answer helped you, please consider accepting it by clicking the checkmark (✔️) on the left side under the vote arrows. Should change the color in green. I'd appreciate it. Thanks!
– Alex Mamo
Nov 27 '18 at 9:16
add a comment |
I'm looking for guidance from a system design standpoint which of the two alternatives is better.
IMHO, the question shouldn't be asked, which is better because each one of those products, Cloud Firestore and Cloud Functions for Firebase are two different products with different mechanisms but the same purpose.
As also Jack Woodward mentioned in his answer, the first solution can help you keep your data in sync across client apps. As in case of Firebase realtime database the main feature is the realtime feature. In both bases your data is stored as JSON and synchronized in realtime to every connected client.
Regarding the second option, as in the official documentation:
Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your code is stored in Google's cloud and runs in a managed environment. There's no need to manage and scale your own servers.
If you are simply asking what can you do with Cloud Functions, please see the use cases of Cloud Functions:
- Notify users when something interesting happens.
- Perform Realtime Database sanitization and maintenance.
- Execute intensive tasks in the cloud instead of in your app.
- Integrate with third-party services and APIs.
I'm looking for guidance from a system design standpoint which of the two alternatives is better.
IMHO, the question shouldn't be asked, which is better because each one of those products, Cloud Firestore and Cloud Functions for Firebase are two different products with different mechanisms but the same purpose.
As also Jack Woodward mentioned in his answer, the first solution can help you keep your data in sync across client apps. As in case of Firebase realtime database the main feature is the realtime feature. In both bases your data is stored as JSON and synchronized in realtime to every connected client.
Regarding the second option, as in the official documentation:
Cloud Functions for Firebase lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your code is stored in Google's cloud and runs in a managed environment. There's no need to manage and scale your own servers.
If you are simply asking what can you do with Cloud Functions, please see the use cases of Cloud Functions:
- Notify users when something interesting happens.
- Perform Realtime Database sanitization and maintenance.
- Execute intensive tasks in the cloud instead of in your app.
- Integrate with third-party services and APIs.
answered Nov 26 '18 at 10:33
Alex MamoAlex Mamo
42.7k82860
42.7k82860
Hi! Can I help you with other informations? If you think that my answer helped you, please consider accepting it by clicking the checkmark (✔️) on the left side under the vote arrows. Should change the color in green. I'd appreciate it. Thanks!
– Alex Mamo
Nov 27 '18 at 9:16
add a comment |
Hi! Can I help you with other informations? If you think that my answer helped you, please consider accepting it by clicking the checkmark (✔️) on the left side under the vote arrows. Should change the color in green. I'd appreciate it. Thanks!
– Alex Mamo
Nov 27 '18 at 9:16
Hi! Can I help you with other informations? If you think that my answer helped you, please consider accepting it by clicking the checkmark (✔️) on the left side under the vote arrows. Should change the color in green. I'd appreciate it. Thanks!
– Alex Mamo
Nov 27 '18 at 9:16
Hi! Can I help you with other informations? If you think that my answer helped you, please consider accepting it by clicking the checkmark (✔️) on the left side under the vote arrows. Should change the color in green. I'd appreciate it. Thanks!
– Alex Mamo
Nov 27 '18 at 9:16
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53475832%2faccess-firestore-directly-from-mobile-app-or-via-backend-server%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown