7: The Server
Published February 16, 2018Run time: 00:15:03
Most mobile applications (especially on-demand apps) require a server to keep everything running smoothly. In this episode, Tim and Rob explain what a server is and the role it plays in your mobile software system.
In this episode, you will learn:
- Why the server is "The One App To Rule Them All"
- How "the cloud" plays into your server
- What is the "front end" and "backend" of an app
- Enough about databases and APIs to make you dangerous
This episode is brought to you by The Jed Mahonis Group, who builds mobile software solutions for the on-demand economy. Learn more at http://jmg.mn.
Recorded January 11, 2018
Edited by Jordan Daoust
Episode Transcript:
Tim Bornholdt 0:00
Welcome to Constant Variables, a podcast where we take a non-technical look at mobile app development. I'm Tim Bornholdt.
Rob Bentley 0:06
And I'm Rob Bentley. Let's get nerdy.
Tim Bornholdt 0:22
So what are we talking about today, Rob? We're going to talk about what a server is.
All right. And not one at Perkins, right? I know you're fond of talking about that type of server.
Rob Bentley 0:31
No. For all of you who don't know, I used to work as a server at Perkins, but we're talking about something completely different today.
Tim Bornholdt 0:37
It'd be foolish to talk about that on a show like this. So yeah, we're going to talk about computer servers. So very high level, basically, a server is a computer program. And what it does is it transmits information to clients. So in the mobile app space, a client would be your mobile app. And the server basically sits out in the cloud, and it waits for the app to request something of it and then it returns back that information.
Rob Bentley 1:01
Right. So... right.
Tim Bornholdt 1:04
I mean, that's pretty much it, cut. We're done with the episode. No, we'll go a little bit further indepth here.
Rob Bentley 1:09
So when you're talking about a server, what exactly does that server do then?
Tim Bornholdt 1:13
So a server does a lot of things. It really is the brains of the app. At a high level though, a server stores information in a database. That's number one. Number two is it keeps information synchronized across multiple clients. So this is, you know, what we would call the single source of truth or one app to rule them all. It's the one place that you can make sure, no matter when you check it or where, wherever, whatever app you check it with, that all your information is stored in this cloud and on the server, and that's where it is always correct. And it also does a lot of other kinds of tasks that you would want centralized in one place.
Rob Bentley 1:50
Stuff like sending out push notifications, credit card processing. If your app has in-app purchases, it'll verify the receipts of those. Just logging in and creating accounts, authentication. That kind of thing.
Tim Bornholdt 2:02
Right. So there's tasks that you don't necessarily want to trust that your app is going to do that correctly. Because if you don't have that single source of truth, and you have a server that, you know, it's like, these are my computers, I'm handling this. If you have it kind of out in the world and your app is just running it, people might be able to do malicious things with it. So that's what you would want, those tasks to be able to be run by your server.
Rob Bentley 2:26
So where are these servers? I've heard of server farms, and then you know, the cloud but like, what actually happens, like where are the servers?
Tim Bornholdt 2:37
So back in the early days of the Internet, and really, that's still how it is now, but really, if you wanted to get an app like this up and running, you would need to go out to some sort of store, kind of like a Best Buy for really big nerds, and buy a really big machine. Spend tens of thousands of dollars on a machine. And then this machine would run the server software on it and put it in a server farm. You would spend thousands of dollars a month on bandwidth costs and electricity and everything you need to power this and maintain this server. Well, that was then. What we do now, though, is what we talked about. We talked about the cloud. What you're really talking about are things like virtual private servers. Now, that is basically those machines I was talking about before that are really big and beefy and cost a lot of money. Companies maintain those for you. And they just give you a portion of it. And you kind of have your own server. Like things like virtual reality; it's like virtual server just running off on somebody else's machine. You don't really care about the infrastructure part of it; you really just care about that little server that gets virtualized there. And this would be things like, if you hear about Amazon AWS or Azure from Microsoft. We use a service called Linode. Digital Ocean is another one that a lot of people may have heard of. These are services that say, "You can put your stuff on my computers," and that's how you're going to run your server.
Rob Bentley 3:58
So this helps you if you just wanna set it up from your own computer. If you want to build a server, you're actually hosting it on someone else's machine. Instead of like on Silicon Valley, if you've ever seen that, where they have all the computers and wires in the garage, you don't have to do that. You can just sign up for one of these companies. And then you have your server space.
Tim Bornholdt 4:17
Exactly, instead of spending thousands of dollars per month, it'd five bucks a month to start to get this up. And the big thing here that has an advantage over that is you can theoretically quote unquote, infinitely scale to however large you want. It's gonna get pretty expensive if you're hosting it on someone else's machines. But you can scale up without actually needing to ever physically touch a computer. You can use your terminal and just do everything from your own machine from the comfort of your own office, if you want to build up your own server.
Rob Bentley 4:45
As opposed to getting a spike in traffic and then rushing out to Circuit City.
Tim Bornholdt 4:50
And then rushing over to the server farm and installing it yourself. So really, when you talk about where a server exists, it exists in the cloud.
Rob Bentley 5:00
Right. Also with the cloud, you'll hear a lot of terminology: back end and front end. So we're going to explain that also.
Tim Bornholdt 5:09
Yeah. So when it comes to this type of space, the back end is what most people tend to refer to for things you don't actually see. So you're talking about things like the database, the API, which we'll discuss both of those in a little bit. Also your mobile apps that you download from the App Store, those are going to have somewhat of a back end component. So it's a little confusing, but just generally, back end is things you don't see and front end is things you do see.
Rob Bentley 5:35
Which we use terms like UI and UX, that's user interface. That would be the front end. So that's the actual app you're touching on your phone or clicking around on your computer, the web front end.
Tim Bornholdt 5:46
Exactly. And if you're maintaining your app in the back end, if you're using the admin panel, that's basically the front end of the back end. It gets a little, again, confusing and nuanced, but more or less, it's just front end things you do see; back end things you don't see So we want to talk a little about a couple of terms that you're going to hear. These are the different components that when someone talks about a server or the back end, these are the things that we're talking about in those terms. So let's start with databases. What's a database, Rob?
Rob Bentley 6:16
It's all your data and how it's organized and collected. Simply.
Tim Bornholdt 6:21
Nice. Yeah, there you go. It's a large collection of information that's easily searchable. That's the key is you can have a large collection of information, but to be able to just run a query against it and get back information really fast, that's the whole point of a database. So rudimentary, really, like what's the most simple thing you can think of as a database, Rob?
Rob Bentley 6:38
Probably Microsoft Excel.
Tim Bornholdt 6:40
Exactly.
Rob Bentley 6:41
Even a spreadsheet.
Tim Bornholdt 6:43
Yeah, or even just a piece of paper. Like that, technically, can be a database, you know, but when we're talking about mobile apps, usually at a bare minimum, you're using something called SQL Lite. And that's something that you would have on the app. So Rob does a lot of iOS development specifically. So if Rob is handling a ton of data and needs to be able to search through it really quickly, putting it in a database that lives in the app and being able to run queries against it is way faster than having just something held in memory. Tt's just a lot easier to use a database rather than just trying to run it as one line of code or whatever.
Rob Bentley 7:19
So yeah, this is what servers do then is maintain these databases,
Tim Bornholdt 7:24
Right. So on the front end, we would use something called SQL Lite. Most servers, you're going to use MySQL or Postgres, or something like that. And if you're talking about terabytes and petabytes of data, if you have a lot of data, if you're Facebook or something to that scale, you're going to use other things that we're not going to get into on this show. But needless to say, these are the basic things that you're going to need to have to build an app and this is what the server would host is that software running that database. So what your server actually does is, we use an acronym called CRUD. So that would be create, read, update, destroy. And those four things is exactly what you can do with a database. So you can create new entries into that database, you can read them, fetch them ondemand, you can update them, you can delete them. And importantly, you can run queries against them to grab, like, give me everybody in my database whose first name is Rob, and it will give you a list of, here's everybody that's Rob.
Rob Bentley 8:20
Right. So if you're making a profile on a social network, you can create the profile, you can look at someone else's profile, you can update your email address, or you can say, I don't want a profile anymore and delete it.
Tim Bornholdt 8:30
Exactly. So yeah, that's exactly what a database does is it enables that interaction. So we talked about databases. Let's move on to API's, which are my favorite thing. It's kind of a nerdy thing to have as your favorite, I suppose.
Rob Bentley 8:44
API's are my favorite.
Tim Bornholdt 8:45
I love API's. API is application programming interface. So an API is basically a contract between anyone who wants to access the server and then the person who created the server. And this contract is how you would be able to find or fetch information from the server and get it back.
Rob Bentley 9:03
Right. So if we're using the Facebook or any social network example, your front end would use the API. Say you want to look at someone's profile, you hit the button to say, Oh, I want to look at this person. The app then uses the API to request the data for that profile from the server. The server then takes that data and interprets it. And then it sends back the data the app needs to display through the API. It's kinda like the bridge between the server and the front end.
Tim Bornholdt 9:29
Exactly. It's a common language so that no one in the client is directly interacting with your database or things that live on the server. It's kind of a middleman that can kind of negotiate all that for you.
Rob Bentley 9:42
It allows the front ends to do certain things, but not others.
Tim Bornholdt 9:45
Exactly. So the next component to a back end, and actually our final component that we're going to talk about here today, would be an admin panel. And this is basically how you manage your app, how you take care of any of those little components that you need to take care of when you're managing a mobile app.
Rob Bentley 10:03
Right. That's why we call it the front end to the back end.
Tim Bornholdt 10:05
Exactly. So the first big and obvious thing that most apps are going to use an admin panel for would be user management. So if you need to add new users, if you need to change their permissions, like you need to add somebody who now is an admin, or somebody who's in this group, you use the admin panel to do that. Edit their profile, update their credit card information, reset their password. I can't tell you how many times... It's so funny. We have a lot of apps where we'll put the app out, no one will have ever used the app. We'll launch it on day one. And more often than not, at least one person will email and say I forgot my password. And it's like, the service hasn't even been around for 24 hours and you already forgot your password? It's little features like that that we build into the admin panel that allow you to manage your app.
Rob Bentley 10:54
So yeah, there's, you know, a lot of things that the admin panel can do, but generally just managing your data and being able to do more than the front end can through the API. You have a special API just to do things you need to do. It's things you don't want everyone to be able to do.
Tim Bornholdt 11:10
Yeah, it's things that are very specific to managing your business. This is where, if you're really talking about where the magic happens, this is really where it works. This is really where it happens.
Rob Bentley 11:20
Like if your app has payments involved, you can see all the payments and the transactions. You can refund and void and do things like that that you need to do, where you wouldn't want a customer having that kind of control.
Tim Bornholdt 11:31
Right. And another big thing that an admin panel helps out with is content management. So if we didn't have a server, every time that you wanted to change any content in your app, if you have pictures or videos or like, let's say, if Facebook didn't have a server, what Facebook would need to do is they would update the app in the store and put it through App Review. It'd be like once a day, here's the new version of the app with everyone's new what's going on in their lives. That's not how it works. So this is where you can actually having the admin panel is where you would go in and change the content inside your app.
Rob Bentley 12:03
Also, on the server, the admin panel is where you would look at analytics. And how people are using your app.
Tim Bornholdt 12:09
Like we said, this is where the magic happens. That's where business is built. So you can use analytics to track what your users are doing inside the app, you can see the trends over time of this feature that we rolled out, are people actually using it? Is it worth the investment to continue to build that out? Or should we just push it aside? Having those analytics accessible inside the admin panel is crucial to being able to answer those questions.
Rob Bentley 12:34
Right. And when a lot of people come to us, they don't even think about the admin panel at all. It's more, what does the front end look like? That's what everyone focuses on.
Tim Bornholdt 12:42
Well, yeah, that kind of leads in perfectly to our final thoughts for the day. I think, when you're talking about mobile apps, people think that the thing you go into the App Store or the Play Store, you download the app that that's the thing that you're going to consider the app. Where as soon as you get into the space, you'll learn real quickly that the app is the server. That is the app.
Rob Bentley 13:04
Right. I think that's it, right? It's the app.
Tim Bornholdt 13:08
Yeah. It's where all the the brains of the operation happen. It's where you manage your users. It's where you change the content. It's where all the data gets synced up and cleaned and processed and everything. That's really where the, like we said, I've said three times now, it's where the magic happens.
Rob Bentley 13:27
It's the most difficult part of the app, because if it's not right, it really affects everything.
Tim Bornholdt 13:32
Yeah. And it's also the most... because it's the hardest to do, that usually means it's the most time intensive to build. And that usually means that's the most expensive part of the app. And building the front end to an app is pretty straightforward. But the back end is really where the challenges occur and keeping all that data in sync and all those things we talked about with like sending out push notifications and doing credit card processing and verifying receipts. It's like, those are things you don't want to screw up.
Rob Bentley 14:03
Yeah, exactly.
Tim Bornholdt 14:04
So that in a nutshell is what a server is. If you really want to learn more, feel free to reach out to us on Twitter and we're happy to talk. I love talking about servers. And not the Perkins kind.
Rob Bentley 14:16
Yeah, talk to me about that kind.
Tim Bornholdt 14:18
Yeah, exactly. Show notes for this episode can be found at ConstantVariables.co. You can get in touch with us by emailing Hello@constantvariables.co. I'm@TimBornholdt on Twitter. Rob is @ScottMahonis. Today's episode was edited by the incomparable Jordan Daoust. This episode is brought to you by The Jed Mahonis Group, who builds mobile software solutions for the ondemand economy. Learn more at JMG.mn.