How are we building a business using Flutter and Firebase?
We are building a business in India around all services and products that pet parent needs to make their pet’s life better.
And in this era of being mobile-first, we decided to make our Android & iOS apps the storefronts. And for anyone building a startup today, time is a very crucial resource and thus building two codebases for the Android & iOS apps didn’t make any sense, and thus Flutter came into the picture.
We were playing around with Flutter for a while even before we came up with this idea. But this time we had to take a serious look at things. And Flutter’s showcase page did an excellent job at convincing us that a production app can very well be built using Flutter.
So we started building our frontend with Flutter, and once we passed the learning curve, it became so much fun to work with Flutter. The active and quick support from the community and in some cases, directly from the Google team only made the journey smoother.
We very quickly realised that we need a scalable backend (to handle authentication and business logic), scalable storage (to host files for web and user data) and a database (to store transactional data, inventory data and much more).
But building all this using traditional technology stacks would increase our GTM(Go-To-Market) time exponentially. And thus we went on a hunt for alternative solutions, and Firebase came like a Santa Claus bearing all the gifts.
It offered a realtime database (Cloud Firestore).
An advanced authentication platform (Firebase Authentication).
A web hosting platform (Firebase Hosting).
A file storage platform (Cloud Storage).
A backend logic handling platform (Cloud Functions).
Plus a lot of other things (at the time of writing this article, Firebase has 18 products in its suite).
And digging in we found that Firebase team has built Flutter plugins for almost all of the Firebase products under the FlutterFire project and thus making it our obvious choice for the backend.
To deep dive, I will now give a brief on how we are using products mentioned above with the relevant screenshots of the apps built solely on nothing else but Flutter :)
Firebase Authentication offers multiple sign-in providers ranging from Email and Phone to Yahoo, and in our case, we chose Google, Facebook and Email.
Cloud Firestore is a highly flexible and scalable NoSQL database it has two main units of data, documents and collections.
A collection is the collection of documents and documents themselves can contain other collections. It’s not as tricky as the sentence makes it sound.
Here is how the data looks on the console:
Here is how it looks on the app:
Firebase Hosting allows its users to host static and dynamic web apps, and it comes with a global CDN(Content Delivery Network).
We used it to create a coming soon website for our business.
Cloud Storage lets you store user-generated files in a safe and scalable way. For uploads and downloads, it handles all the network breakage and quality issues quite well.
We used it to store user data like the photos they use to create a pet profile and more.
Cloud Functions lets you write blocks of code which can be triggered with an HTTPS request or by other Firebase products.
We use it for multiple purposes ranging from sending order updates to handling inventory changes.
The best part about being in this eco-system of Firebase products is that everything is interconnected.
For example, I can trigger a Cloud Function to send a welcome email to users whenever a new user document is added to my ‘users’ collection on Cloud Firestore.
Or I can use a Cloud Function to resize all my images after they are uploaded to Cloud Storage.
There are many such use-cases which you can cover using Firebase, I have just scratched the surface with this article. But I will keep sharing my findings here.
Let me know in the comments how you plan on using Flutter and Firebase.
And I hope you learned something new today :)
If this article helped you in any way, spare a second to give it a few claps 👏(Medium lets you clap up to 50 times for an article)
You can reach out to me on Twitter @thecoffeehog or if you like to be old school then at uditravichugh@gmail.com