questions about firebase and web hosting with firebase - javascript

I want to publish a website using firebase but I have the following questions:
For how long can I use firebase for free?
Can I add a custom domain name if I have one while publishing the website?
If I publish my website and it started getting more views, will I have to pay for firebase?

Please visit the Firebase Pricing Site
Yes you can use a custom domain name after deploying the website. There is an opportunity in the Firebase console "Add Custom Domain".
You will have to pay for the services when you exceed the free reads etc. in the free firebase plan. But you have to switch to the Blaze Plan first. When you didn't switch to the Blaze Plan, you will just get no more answers from the database etc. after exceeding the free plan.

If you are on Spark plan, you have 360 MB/day bandwidth i.e. once your usage exceeds for the day your website will not be served. This involves all the images, html and css files that you deploy to Firebase hosting. On the other hand, storage is used to store your websites files (you can also request to store previous versions of your website and rollback anytime.)

Related

Should I use Local Web Storage as a Database for a small website?

I am creating a forums website for a roleplay with my friends and not many people are going to use it. But I want to add a feature of user creation, deletion and login/logout.
Should I use Local Web Storage of the browser as a database for that or should I look into other alternatives?
Thank you in Advance
No. You should buy an online service, e.g. AWS Cloud Databases. And you also need an online web server.
Local storage is unreliable, and easy to lose when cleaning browser caches.
If you are new and want to experiment, you can try using services like AWS amplify. You can build full blown website without having to worry about storage or anything. Also you don't have to worry on pricing as it would cost based on the usage and ideally cost nothing as you can use the free tier.

Generate expiring download link for newly purchased item

I am building a simple static website selling a single pdf file using the Stripe checkout api.
I would like to be able to generate an expiring download link after the customer successfully purchased the pdf.
I am really not sure about how to do this, but I was thinking about using firebase to store the file in a bucket and somehow use a cloud function to generate a temporary download link that expires after some time, but I am not sure how to go about this (or if this is even the best solution).
Can anyone give me some help about which direction to go here?
Firebase'd download URLs don't expire, although you can revoke the from the Firebase console.
But a better fit for your use-case might be to use Cloud Storage's signed URLs, which have a built-in expiration attribute. You can generate these with the Cloud Storage SDKs or Firebase's Admin SDKs, all of which should only be run in trusted environments - such as your development machine, a server you control, or Cloud Functions.
Also see:
A guide to Firebase Storage download URLs and tokens.
Get Download URL from file uploaded with Cloud Functions for Firebase

Firebase as backend for mobile app, that has multiple admins/multisite

The problem is the following.
Client wants an app, that can be sold to different users via Play Store and AppStore. This app has to have a backend server, but users should be able to see only the data that belongs to their user. This is so far a simple authentication/permission problem, but it gets trickier.
If we had a single backend with User Accounts with permission to manage only data that belongs to them, then whoever sells the app will have to pay for the Firebase account for customers traffic usage too.
So the client wants to sell a pair of app + backend, where backends monthly fees are paid by the customer.
Is there a way to configure something like that in Firebase, and make it easy and friendly enough for the customers to set up their account from the app on first startup?
This format unmanaged user seperator. Firebase has simple authentication. Is is not useful for multicompany. Seperate database or develop custom backend.
It sounds like a fairly standard white-labelled app. I recommend keeping each of the re-sold apps in a separate project, which makes it trivial to then charge each buyer separately for their usage.

how to choose files always from my account using dropbox drop-in app?

I'm trying to learn DropBox API, I started learning using of creating Drop-in chooser APP. I created app and it works success, but before I choose the file, it needs to login on dropbox system. I want to set my app on my account, so for every user when they open my app, I want to give them possibility to choose files from my dropbox account. I want to create app and choose files without loggining on dropbox. I hope you understand what I mean...
The Drop-ins are part of the Dropbox web site, and are built to show the user their own accounts, so it's not possible to use the Drop-ins with a single pre-defined account for all users.
The Dropbox Core API was also designed with the intention that each user would link their own Dropbox account, in order to interact with their own files. However, it is technically possible to connect to just one account. The SDKs don't offer explicit support for it and we don't recommend doing so, for various technical and security reasons.
However if you did want to go this route, instead of kicking off the authorization flow, you would manually use an existing access token for your app. (Just be careful not to revoke it, e.g. via https://www.dropbox.com/account/security .)

Offline Web Apps and database sync

I need to ask for some advice regarding offline web applications and database sync.
Offline Scenario
We have a web site (HTML5) that needs to operate in an offline mode for extended periods of time with complex data, the product owner does not want the data put into local storage.
We have two options as I see it;
Use javascript to detect if we are offlline and if so point the urls to a local web server that replicates the stack at the data center and writes to an offline db
◦Biggest stumbling block is how, on the first load if you are offline do you get the location (URL) of the local web server? i.e. user goes to www.xyz.com, but you are offline so
Question 1: how to redirect him to localhost.xyz.com via javascript for that first call
Point all calls at the client , offline or not to a wcf service that checks offline status at the NIC and redirects every web and service call to the correct place
◦seems like a big job,
Question 2: is there any product/ opensource project you guys know off that does this?
Sync Scenario
•They want to use MS sync framework
◦But they have many clients syncing to different database, so you either need 1 sync service per client or some way to identify who the client syncing is and point them to the correct place
◦Need to minimize locking during sync as other clients are using the same tables during sync
Question 3: can the sync framework be extended to even do this
Question 4: What other options exist for database sync on MS platform?
Thanks
If the user puts the URL into their browser, they are going to go that URL. There is no javascript at that point. You would only have Javascript once a page is loaded. You will have to search for a better solution.
Here is an idea: Users ALWAYS go to the local website, and if the remote site is up, then you redirect them.
In terms of MS sync I do not know what it is, so I cannot help you there.
Re What other options exist for database sync on MS platform: there is also SQL Azure Data Sync, a windows azure web service. It is actually built upon the Microsoft Sync Framework you refer to.
There is an example in the book "Programming Microsoft SQL Server 2012" by Leonard Lobel & Andrew Brust (MS Press) - chapter 13 covers building occasionally connected systems that incorporate SQL Azure Data Sync, Windows Azure and the Windows Phone 7 development platform. In the sample solution, on the back end, an on-premise SQL Server database is kept synchronized with a public facing SQL Azure database in the cloud using SQL Azure Data Sync. The cloud database is exposed using WCF Data Services (also hosted in the cloud by deploying to Windows Azure) and consumed via OData by a mobile client application running on a Windows Phone 7 device. The sample solution detailed in the chapter demonstrates how these technologies work to keep data in sync across on-premise SQL Server, SQL Azure databases in the cloud, and local storage on Windows Phone 7 devices.
Sync Framework do not lock tables when synching.
depending on what client database you want to use on the client, you can either use Sync Framework itself which works with MS databases (SQL CE, SQL Express,LocalDB,SQL Server, SQL Azure) or you can use the Sync Framework Toolkit
whichever platform you choose, i would suggest simply writing to the local store and synching it rather than dynamically choosing which store to use when.
for example, if you went offline and you wrote to the local store. then your network monitor detects you are back online and redirects you to the online service, what would you do with the data you stored locally? or you transacted online and you suddenly went offline, how recent/updated is the local store for you to actually starting working agaisnt it?
You could use Service-Workers to make the website work while users are offline. see: Making PWAs work offline with Service workers. This allows your website to work for the users if they are offline (they need to have internet at least once every 24 hours).
Service-Workers also allows you to detect when your user is offline or online, and you can for example use the IndexedDB to store your offline changes and then synchronize them when the user is online again.
I don't know about MS Sync.

Categories

Resources