ServerPod | The missing server for Flutter

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
you might be using restful apis Google Firebase or graphql as your backend and that's totally cool but what if I tell you that you can build your own backend with the same Dart language and hold on I'm not talking about some proof of concept project or just hello world application I'm talking about real world production application with the scalability a dbms inbuilt caching logging authentication file hosting and all sort of feature that you expect from production ready application I'm talking about server pod the missing server for flutter [Music] but first let's understand what is server pod server pod is an open source backend written in Dart language and it supports flutter out of the box with server pod you can create a dart method and the tool will generate a client code which you can use it just like you know a normal method call you do in your flutter application and if you're thinking about how it stores the data it uses a high performance postgres DB which is again an open source rdbms it has inbuilt caching mechanism with the help of redis which is a in-memory storage so now all of this will make even more sense when we will actually try out and see how it works so here's the basic requirement to start developing with server pod so first of all you need to have flutter and dart SDK install and flutter 3.0 is recommended higher than that next you need Docker so either if you're running on Windows Mac or Linux you can install the docker for desktop and lastly you need to install server pod CLI to execute all the commands so I already have flutter and Dot install and so you are so we only need to install Docker some of you may have it but if you don't have you can go ahead and download from this website over here and then just install and login with your GitHub account and just do a normal registration over there and you should be in a good position to start and once you have completed the installation you can go ahead and run this command inside terminal and it will install the server pod CLI for you to check whether everything is working properly you can write server pod and it should tell you what is the current version and it will give you the help command so let's go ahead and create our first project okay and I'm going to move to documents folder clear everything up and server or create and name of the project which I'm going to name demo part let's see it says that you don't have a Docker install or it's not running so to run the server pod command your Docker instance should be running so let's go ahead and just run it you don't have to do any other action just keep it running somewhere in the background so now our Docker is up and running let's go ahead and try to run the same command again hopefully it should work now so here it is actually creating multiple projects for you there's a demo pod client there's a demo pod flutter and of course demopod server now if you're running for the first time it may take couple of minutes to install all the dependencies so just bear with it here it is all the three projects so what I'm going to do I'm going to run the server first for that purpose let's go to terminal move to demo pod server like this and open Visual Studio code now inside server project first thing you have to look for is this endpoint files so inside lib Source there's a endpoint files which is actually your apis so hello is one of the API exposed to the client if you want to write any other API you can write here and if you want to create a different client so here this will be treated as example client if you want to create others you can create multiple files here as well now for the readabilities sake let me just go ahead and get rid of all the comments okay here we go now don't get me wrong that I'm just going to talk about the hello world application of course in the next video I will talk about the complete crud operation how to store how to create tables and all those stuff for now let's understand all the files structure it has all the naming convention it has so this is where you write API in the endpoint file okay this is something you need to care about now there's a second file which you need to know while writing API uh what if you want to pass something other than this primitive data type like if you want to pass your own model so let me show you a real quick demo I want to create one article basically so I will say article class dot yaml class name is article pills I have and similarly you can keep on adding fills here so just save this file go to terminal and run this command let me just clear you have to run the command server pod generate and now you will see the actual magic so server pod generate command is done if you go to the generated folder there's article class which is generated from your yaml and it has an article class it has all the properties Constructor serializable deserializable which you use like from Json to Json all the methods so you have the model created from this yaml file and we are not done yet if you want to create a table for the same model inside database you just have to say table and name of the table that's it and now let me also give you a quick tip you don't have to write generate always when you are into development you can just say watch parameter and each time now you are going to modify your file it is going to watch for changes and automatically run this command so you just save it your files your code will be generated automatically so I hope you got a little bit idea about how server works this uh endpoints class where you write all your apis and if you want to create your model you go ahead and create a yaml file for that and also there's a generated folder at the root level which contains all the SQL query automatically generated so that you can just copy this thing run in postgres and you have the table ready over there and there are some server part generated SQL as well which is used for logging purpose to lock the session to lock the time for apis on all sort of like inbuilt features and then there's a protocol.yaml which registers all of your methods and there's one more important folder config which has all the configuration for your different environment development production staging and there's a file for password which contains like database password for all different environments development staging production and whatever you want to keep it right so make sure that you don't check in this file the password DML file so overall This Server project has a complete configuration if you want to host this Docker image on any of the site this project contains all of the required information you just have to run some scripts and you are ready to go so here we have a dummy article and now we will go to the flutter project and try to get this article and if you remember we have enabled the watch for Generate command so it is automatically generating all the code for me so I don't have to write uh the generate command myself okay now I can stop generating automatic code here we have the flutter project now if I go to the main file just leave about all those code you will understand that later on inside call hello we are let me just maximize it okay we are already calling the hello method with whatever text we have entered and what I'm going to do I'm just going to duplicate this line and say test result okay we're not going to modify whatever we have written I just want to verify whether we are getting that newly generated method which is called get article and if it works means everything is working fine right so let's try that get article here we have it and it is asking for integer parameter which was expected so let's go ahead and pass any integer and then you have a test result of type let's see article make sense so it's just like calling another method inside your same program but in reality it's your server code which you're using with the same dot language so in the next video I'm going to create a brand new project with serverpod and I'm going to perform all the crud operation I'm going to insert record fetch it modify delete and we'll do maybe on article so make sure to subscribe the channel if you haven't already hit the like button and let me know in the feedback how you feel about server pod is it going to be worth trying and if you're excited to write your own backend code in that language that's it for this video I will see you guys in the next one
Info
Channel: CodeX
Views: 22,493
Rating: undefined out of 5
Keywords: flutter, tutorial, how to, android, ios, ui, serverpod, serverpod backend, backend with serverpod, flutter backend, dart backend, endpoints in serverpod, flutter with docker, docker images, dart server, flutter api, dart api, flutter tutorial, serverpod for flutter, flutter with serverpod, flutter server, flutter serverpod, crud operations, with serverpod, flutter course, dart flutter
Id: 3Q2vKGacfh0
Channel Id: undefined
Length: 9min 24sec (564 seconds)
Published: Mon Oct 03 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.