FIREBASE VS SUPABASE - [FLUTTERFLOW]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's going on ambitious family in this video I'm going to compare superbase versus Firebase by showing you an example application that I've built that I've integrated with both database providers many of y'all ask which database is better for my use case some of y'all just fall into shiny object syndrome and you want to use one database over the other maybe just because one is SQL and it looks like it can be more performant but honestly it really depends on various factors like your skill level your comfort with with working with data how much experience you have with something like spreadsheets or even as far down as to what type of thinker you are if you're a more visual thinker or if you're a more data oriented and datadriven thinker so what I'm showing you here is an example app that I've built as part of one of our courses at ambitious Labs called No code AI Pro where we've built out a AI Chef assistant okay so this app is integrated with Firebase and since flutter flow is a drag and drw no code tool that actually writes real flutter code flutter is in fact a programming language that was developed by the Google team so as far as flutter goes flutter has uh flutter is part of the overall Firebase or Google uh developer um ecosystem so the flutter language is built in that same design pattern that Firebase and that the rest of the Google developer kind of libraries and dks are built around so because Firebase is a Google product fire story is a Google product and and flutter itself is a Google product all three of them were designed to work very seamlessly together so when you think about what's going on under the hood flutter and flutter flow have a very tight integration under the hood of um uh flutter flow here so when you're working with fir store from flutter flow notice that you actually already have a dedicated tab called fire store and when you go to create a new project from flutter flow you're actually taken through a setup uh that encourages you to start with Firebase like for example if we go test new project here and we create blank you'll actually see that setup Firebase is right here at the bottom that's because flutter as a framework and flutter as a language is very tightly integrated and it works very very well so if you're a beginner or if you want as least problems as possible and you want to stay within the flutter flow ecosystem for as long as you can I highly recommend you start with Firebase if you are comfortable working outside of the flutter flow ecosystem and you see this as you know an opportunity just for you maybe to build the UI in flutter flow and then go out and create uh a separate database service that you'll maintain separately then you could potentially think about superbase but the first question I would ask is how familiar are you with the overall uh ecosystem of software development are you comfortable using a different front end and a different database and then solving problems where the two might not connect with each other right because flutter and superbase are going to have a completely different integration under the hood when you think about the code than flutter and Firebase so number one your comfort level working outside of the flutter flow ecosystem if you're comfortable working outside the flutter flow ecosystem then you can think about superbase Okay cool so let's go back to that project that I just had open and we'll explore some of the obvious differences between the both um so here uh like I mentioned flutter flow already has an integration with uh Firebase so as you can see here um this integration with Firebase allows me to quickly Define what my database needs to look like so I can say new collection hit create and I can actually just create Collections and collections are essentially buckets of data where you'll be storing the same type of data um flutter flow even allows me to use AI features to generate a collection type or I can start from scratch and build one out myself where I have you know ID um ID uh and we can have another field here for like you know description and we can essentially build out the shape and the structure of our database right here within um our um flutter flow dashboard so as you can see here I've already designed the database for this application uh this is ANC that's part of our noode AI Pro course where we teach people how to build their own AI powered applications that they can design build launch and monetize uh it's kind of like an app called VY that I built on the App Store that generates a few thousand dos uh of Revenue every month and we teach you exactly how to build that but what I what I have here is a database that's already designed uh in Firebase next we're going to recreate this exact application by connecting to super base and uncovering any obvious clunkiness or major differences in both Integrations and finding out what's different along the way so let's jump in and start by integrating our superbase project we'll head over to settings and find superbase that would ideally be under Integrations here we'll enable superbase and then let's go back to super base uh to find our API URL I'll head over to the dashboard where I've actually already created a project for this um clone then I will scroll down to find my project URL I'm not worried about y'all seeing this because I'm going to kill this project right after so I've copied my API URL and then we need our anonimous key so a nonpublic we'll hit copy and paste that over beautiful we hit get schema and see what happens so far nothing I wonder why it looks like I've done this correctly because I remember doing this once before so I'll head back over to table editor and see if I by adding a new table if I can get my original schema to open up so we'll say users and we'll say the table that stores all of our users we'll keep Road level security on because it wants us to and let's just keep everything the same and hit save all right so cool we've added a new table called users now let's head back to that original application aha okay so that worked so so that's the first major difference is that rather than us creating our schemas from within flutter flow if you integrate with superbase it's the reverse of that you're going to have to go into superbase first design out all your tables all your schemas from superbase and then import those schemas back into flutter flow so that to me doesn't seem very beginner friendly right because as a beginner you may not know how to design databases first of all uh it seems like this integration is not very tightly coupled because uh if things change back here at superbase there's no real time sync between superbase and flutter flow so we're going to have to keep coming back here to reget our schema and this is where you'll this is where those of you who have knowledge in like Version Control and maintaining different Services across um you know parts of the stack where you have an independently operating front end and an independently operating back end this will be good for those of youall who know how to manage that but if you're already thinking about uh how you're going to manage two separate Services I highly recommend you stay away from superbase but that leads me to the next major difference is that superbase is a completely different platform you're working with SQL tables and SQL is much different than Firebase in that SQL looks like a spreadsheet where you have rows and columns and in order to look up data in rows and columns you have to write SQL statements okay and so SQL statements uh essentially are a type of uh searching language it's called a query language to be exact it's not a programming language but it's a language that you would need to learn in order to query data from superbase um I haven't recreated my tables here yet but if I were to show you the major difference um in a SQL database and a Json database is something like this this is that exact same application that's actually working inside of a fir store database and essentially how it works is uh people ask the AI Chef questions and then the AI cheef returns answers so for each question that's asked to the AI chef we have a question and the answer let me show you how that works so back here um in you our home screen somebody can ask the AI Chef uh what what recipes they can make based on what they have in their fridge so you will um type in so you will type in the ingredients that you have available will make an API call and then the result of that API call will get saved to the database and that's exactly what we're saving here we have tomatoes pasta garlic cream and sausage and then we will return the answer of that back into our answer field here and so This Is Us creating one document per call to our AI Chef so that's how we would do it here in Json in a j so that's how we would do it here in a fir store database where you have documents that are attached by key value Pairs and if we wanted to do the same thing back over at super base we would want to create a new table we'll call this question because that's the same uh name as the collection there and we'll say list of question answer pairs asked by the user we'll hit save beautiful we'll let this get created and now let's figure out how we could insert that data into superbase so we'll first head back to settings we'll get the schema let's see if we can redo this now we got questions okay so let's actually get rid of using users for now from here H we'll keep it so now we have questions and so questions have ID and created at okay we didn't set the shape of questions yet so let's say um we want to change our columns how would we do that maybe we drop this down hit edit table we'll go ID we'll change the shape of the table to say question and this will be a string type we'll say text we'll add another one we'll say answer and we'll say text boom okay so what I'm noticing that's very different here is that these column types are actually the same column types that a real SQL database would use so if you were familiar with SQL this is actually going to give you a lot more control than Firebase you're going to have more control in the sense of you can actually write real SQL statements here for default values a lot of the terminology and the uh mechanics are very similar to SQL where you can have unique values nullable values defined as an array and you can have very precise control over each type of data that enters your database and this can be incredibly powerful for those of you who are data junkies data science backgrounds you know business intelligence business analytics backgrounds who are very tight about the type of data and the way that you store data so if you're thinking about you know building an application for a datadriven use case or you're building an application where you're going to be wanting to run queries complex mathematics you want to run maybe potentially a data science team on top of that data and have them create queries um then you may want to opt for something like super base where you can actually maintain the same uh principles as SQL and that's going to give you a lot more control okay so let's go ahead and create these we'll hit save beautiful it's doing some work fantastic so our table of re question questions has been created we have ID created that question and answer now let's head back to flutter flow and figure out how to save this data okay so to find the action that is actually saving the data to the database I'm going to head to my bottom sheet because that's where I actually populate the um response of the recipe um I'm going to hit save recipe and I'm going to find the create document called that's actually created for Firebase and I'm going to recreate that exact same Thing by searching for superbase insert row okay and then I'm going to set the table to questions and it looks like I set the fields the exact same way where I'm actually just going to focus on um okay so it seems like it only knows ID and created at that's probably because I didn't refresh my schema and now I have my schema refreshed so this is something that I'm always going to have to remember if I wanted to work with superbase is that anytime I make a change to my superbase database I'm going to have to come back to flutter flow to resync it which is much different than Firebase in that you're just making the changes out of here so good heads up we'll come back to our action flow editor click edit row and let's add those fields for question and answer and then I'm going to map my question and answer to um the component variables that I already know about so I have users ingredients here which would be the question and then the answer would be uh the api's response okay beautiful let's resolve some of these bugs superbase database invalid for ID that's probably because I didn't pass an ID here um let's go random data random integer this is definitely not best practice if you wanted a random if you wanted an ID you would actually want it to autogenerate from here so let's actually figure out if we can do that first okay so it looks like it will figure that out first we have default value primary so it should figure that out I'm actually just going to get rid of the created at time just to not deal with it okay let's come back to flutter flow let's get rid of the created at uh and then the ID I wonder if we can just remove this it' be ideal if we can remove it and let it do its thing on its own yes we can okay beautiful so we can leave ID alone and let's go back to our settings and resync our super base table beautiful we should get this error to resolve any second collection new collection currently has no Fields okay that was from when I was messing around earlier so let's go and get rid of this and we should resolve those bugs fantastic so now I'm going to run this application and see what it's like to insert data into super base awesome so after a little wait we got our API response to show up I'm going to hit save recipe and that actually should save some recipes I do see in the API Explorer here that the request to superbase did fail I got a 401 unauthorized and the message that I can see here in the API call says new row violates Rowl security policy for table questions okay so that means we need to go check our row-level security policy and essentially what that means is that superbase allows us to set rules at literally the line by line level of our database there must be some rule in here that's telling us that we are not authorized to make edits to that table called questions and this is something I'm actually not sure how to debug so we're about to find out together what we'll look at here first is the settings for the table Aha and I'm noticing that there is a view policies and it does seem that uh no policies are created yet which could be a problem because that means that no one can access this so if I click on new policy it does look like I have two op options get started and a little bit more custom by going full customization I'm going to say get started quickly and it gives us a few options here enable read access to everyone which means that anybody would be able to connect to this database and read enable enable insert access for authenticated users only which means that only people who are logged into my app would be able to access this database but that means I'd likely have to use superbase authentication so I would actually have to move from fir store to superbase authentication because that's the only way superbase would know if someone's authenticated I could even do it this way where I can enable access for based on their email this is cool if you're building a B2B product I used to build a B2B SAS company and only certain types of clients uh should have been able to access certain databases for example I was selling my software to schools and we only wanted certain school students to access data for that specific School school so like if you were going to Kentucky you were not able to access University of Florida so this was actually a role security implementation that I had to do for my application but I had to write The Code by hand so to see this uh as a no code um solution is very cool okay so you can do the same thing delete access for users based on your ID so you don't want everyone to be able to delete data from databases sometimes so this could be interesting and then enable insert access for users based on their user ID uh this is cool especially for people who um are like super admins or you are trusting certain people for example like if you are the platform owner you may want to only give yourself access to certain databases and not everyone else so for this case just to get our app working I'm going to enable read access to everyone this is kind of like security rules in Firebase but it's a lot more granular so we'll go finish set up this policy where we'll do we'll leave everything as it is and just let super base kind of poate everything create policy enable read access for all users on public questions as permissive for select to public using true what you see here is an example of a SQL statement and this goes back to what I mentioned around having to be comfortable looking at SQL Clauses and SQL statements if this is completely giberish to you and you have no interest in learning it and you are only trying to use superbase for you know shiny object syndrome I recommend you walk away now because in order to be successful with the database like superbase you need to be able to roll up your sleeves and look at some of these uh features SQL statements so that you can actually solve problems in the same way that I am right now with y'all cool we hit save policy and now let's go retry that if we clear our API portal here and hit submit ideally when this is done we should be able to get that recipe back up hit save and the API should go through okay so we got the API response and now it's the moment of truth I'm going I'm going to clear my API portal here hit save looks like we are still not able to get in okay new row violates row level security policy for table questions did we do something wrong here okay so we did enable read access for all users but hey we didn't enable WR access so that's where we messed up CU we actually can't even write to this table so what's even the point okay so we have schema public let's go back and figure out how to update the policies on the questions table to include right so we have select but we don't have insert so I feel like we're going to have to delete this and do it all over again damn so we deleted that policy and I'm going to say new policy get started quickly we'll say enable read access for everyone hit use and then we'll say select and insert or let's just say all okay all review before I just make the change I want to understand what the initial squl statement was create policy policy name on public question for select aha so I didn't read this statement it needs to be for select and for insert so that's where I messed up initially I didn't read the SQL statement and that's exactly why someone who's inexperienced with SQL could potentially struggle with this so I'm going to use this template anyways but I noticed the first time around that we had this field for allowed operation I'm going to adjust this to all before I go back to review and now I'm noticing I see as permissive for all meaning I am a able to use all uh major so I'm able to use all the major commands and the major commands in SQL is typically select insert update delete uh those are the four major ones so it looks like by using the All keyword I can give a roow level policy where anyone can do anything to this database which is extremely unsafe but for the sake of getting this to work we can try it out okay save recipe Aha and this time we got a status 2011 which means created awesome we look at the response and it does look like we have ID3 question and answer returned if we head back over to superbase we look at the table aha we do see the data there so that's awesome okay so the major differences I think we've uncovered is that there's a reverse sync not a normal syn like there is with Firebase so you actually have to design the tables in super base first and then import them back into flutter flow and keep resyncing the table every time you make a change we've also noticed that there is roow level security that we have to worry about and we need to be able to read and make sense of SQL statements when working with superbase so again just to recap this all if you are in any of those industries that I mentioned data analytics data science business analytics and you are really good at working with SQL and you're just looking to get into app development for uh the sake of having a pretty front end I think super base could be for you or if you're building an app that's you know computationally heavy there's a lot of you know mathematics or statistics involved like you're building a sports analytics app or a stock analytics app then superbase could potentially be for you but if you're a beginner and you're building you know a consumer app or even a lot of B2B apps uh you could do really well with Firebase so I hope this video was helpful and you guys learned something new um if you have any questions about the difference between Firebase and superbase feel free to join our free Discord community and be happy to answer any of your questions
Info
Channel: Ambitious Alim
Views: 6,170
Rating: undefined out of 5
Keywords:
Id: c7IzR0Ojj6c
Channel Id: undefined
Length: 22min 57sec (1377 seconds)
Published: Thu Nov 23 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.