Unofficial Anvil Firebase Integration v0.1🔥

Hi @owen.campbell,

I’m not owning any Alphabet stock, thus I’m not gonna try to sell their product here.
Firebase, is a BaaS and this plugin is mainly focused on Firestore the NoSQL Database.

But, try to write an application in pure anvil that is:

  • live synced
  • Is so fast that you are spinner free
  • scales to a hundred million requests per day with ease
  • Automatic Sharding
  • works offline/online with automatic syncing
  • stores images on a global CDN
  • Working across plattforms
    (what if you build a native Android app in addition to your anvil app? Rest Endpoints & custom JWT Auth :face_with_spiral_eyes:)

Saying that as a true anvil-believer, at least for now this can hardly be achieved in pure anvil.

Of course those requirements do not apply for most personal cases, but for someone building a scalable SaaS buisness this should be on your mind when choosing your database.

thanks for pointing that out by the way!

Mark

10 Likes

Thank you! Level of ignorance now reduced slightly which is always good.

5 Likes

Check out https://fireship.io , he pretty much does “insert framework/stack here” + FireBase tutorials.
I don’t have any need for it now, but if I wanted to scale the lazy way I would probably use it :sweat_smile:

He also has a pretty killer YouTube channel called Fireship , if your into that kind of thing. (short videos on modern app development)

3 Likes

Can’t wait to play with it and see it grow!

1 Like

Thank you, looking forward eagerly to trying this!

1 Like

Hi all,

We just shipped the stable version 0.4 which includes more powerfull serialization (mostly datetime objects), stablity improvements and the ability to call cloud functions.

Link to official Docs:

Also - just out of curiosity, does anyone use this dependency in production?

Happy coding🥳
Mark

5 Likes

Thank you Mark. I’m still looking for a project that needs this for production …perhaps I’ll just choose to use it for some in house production solutions next… I’ll let you know as soon as it gets put to the test.

1 Like

I want to! but this scared me away LOL

Rigthfully so!
However - we invested quite some time into this dependency and V0.4 is stable and we are using this library now ourselfs for one of our production apps.

So we won’t introduce any breaking changes for this dependency.:wink:

6 Likes

Thank you for the confirming the state @mark.breuss and Merry Christmas by the way! :slight_smile:

1 Like

I replaced all the database functionality in a little app used to sign up students for recital performances at Rockfactory, with this dependency. It’s a very low bandwidth app, but serves as a legit proof of concept. Thanks for a great and easy to use integration - the live automatic syncing is really cool!

3 Likes

Automatic syncing of data entered while offline is also a seriously useful feature that comes for free, and saves an enormous amount of potential work where that’s a requirement. I expect to use this integration for lots of projects in the future!

1 Like

Wow, I missed this when you first announced it, but now I’m excited! This gives me hope that I could stay with Anvil and retain performance if usage of my app scales like I hope it will over the next year or two.

Have you considered open-sourcing it, like on GitHub? That would definitely give me greater comfort as far as using it in production.

2 Likes

@nickantonaccio great to hear it works out for you :ok_hand:

@hugetim
I think the dependency will most likely end up beeing open sourced.

So far it just wasn’t worth the hassle to properly open source it - to be honest.
But if more people start using/show interest in it, we will dedicate some time to open source it on github. :ok_hand:

4 Likes

Here’s a version of the example app cleaned up to my OCD-ish liking. :slight_smile: Mostly, I hid or commented out the parts that are not used in the actual demo:
https://anvil.works/build#clone:GIFR6NZ4TBG3X5FV=H6LN5TCYYBIFK4HUIOXA76XE

Also, some docs feedback: the “Getting started with Firebase for the web - Firebase Fundamentals” video didn’t tell me how to create a Firebase project as I was expecting it to (though that turned out to be pretty self-explanatory). Instead, the contents were pretty redundant to your docs, with the one exception being the reassurance that it really is safe to expose that project_config info on the client side.

Hi @hugetim,

thanks for the feedback!
I cleand up the docs and added a note that security is indeed all enforced via security rules. (They act similar to row level security on postgres)

1 Like

@mark.breuss Do you also have a custom wrapper for the server-side python sdk (reading between the lines from an old post of yours)? I would be interested in that, also, for one. I’ll share my own server-side “hello world” in a separate thread.

I would not call it a wrapper, generally you can just use the official python sdk in anvil as is. Get started with Cloud Firestore  |  Firebase

I have some helper functions that enable authenticating to firebase with anvil users and so on but nothing major. Maybe the basic functions could be included in the anvil-firebase dependency for ease of use.

1 Like

Mark, I’ve noticed now that including your firebase third-party dependency in my app slows down server calls by around 3 seconds (without persistent server enabled). I’m guessing this is because the dependency is importing some things in a server module (perhaps firebase_admin) even though the server is not needed for the documented features of the dependency, as far as I understand. If I’m right about this, could you actually remove the server module from the dependency?

Hi @hugetim,

yes - thats mos likely whats going on here.
I just changed it to be lazy loading and your cold starts should be fine now.

Its currently only on the development / published branch.
Will try to do some test and push a proper version out later this day.

Mark

Update:
I published the above updates in a new version 0.6

1 Like