Placeholder Image

Subtitles section Play video

  • Hey, and welcome back to class every time with your host, the ex Google ex Facebook tackle it.

  • This is going to be a bit of a technical episode.

  • We're actually going to be doing some coding.

  • I'm going to show you how I might build Twitter, and we're going to build this start to finish from said they have the website that domain getting the database set up, building the back and then the front end as well.

  • So that's what we'll be doing in this video.

  • Why don't we get started?

  • All right, So the first thing you want to do is set up a Web domain.

  • I usually go to them, keep dot com and you can use any number of these service is and just search for the remaining that you like.

  • Tweet them out dot com.

  • Sure.

  • Fine.

  • Why don't we just go with that?

  • You know, you can rename it later.

  • No, I'm just joking.

  • You can't rename it, but we just go through with this and I'll show you how you can get the set out so quick come from order.

  • And yet it's going to run me nine bucks, but I'll make it back through all the ads on this video.

  • Click some of those.

  • As for me quick balls, thanks to our sponsor, Curiosity Stream, a subscription video streaming service that offers thousands of documentaries and nonfiction titles from some of the roads.

  • Best filmmakers, including exclusive originals, check them out a cure us the stream dot com slash tack lied.

  • All right, so not that I have this set up.

  • I just go into the dashboard and, you know, sometimes it might take a little bit of time.

  • It's usually pretty quick.

  • Actually, I could go into advanced E N s.

  • And what you want to do is rot this domain name to your own Web server.

  • So why don't we go get a Web server set up?

  • There are many different Web hosting.

  • Service is out there like Amazon AWS Digital Ocean, Google Cloud.

  • You can even use fully managed service is like fire base.

  • I'm going to be using IBM Cloud because that's just what I'm you stoop all of these interfaces, they're pretty similar.

  • I'm going to click, Create resource here, and there's things called virtual servers.

  • It's essentially like a paper you server.

  • There's one mission where many people can rent and the computing power and memory are just all divided up on Many people can see here I can click a multi tendon public virtual server.

  • You can choose the location.

  • I'm gonna have mine in Dallas.

  • You can decide how much power you want.

  • Like for virtual CP use and 32 gigabytes of Ram.

  • I'm just gonna pick the most minimum one just to keep things slow on cause choose the OS you want.

  • You know, Red Hat, Debian, Microsoft.

  • I personally use Santo s.

  • Any of these are pretty much find, though.

  • You can pick us, storage this care.

  • I'm going to go with just 25 gigabytes And yet that pretty much looks good.

  • So I will click, Create.

  • All right, cool.

  • So now I have a web server set up here.

  • I can click into it and essentially they're getting this.

  • Our provisions.

  • Now here in the bill, you can see at the cost of nine cents per hour.

  • They're anticipating about 12 hours of usage per day 397 hours per month, which comes out to $33.71 or so, and I'm showing you how to set up a Web server and domain because I think this is one of the most important things that any self respecting Web developer can do.

  • You really need a platform for you to distribute your work.

  • If you don't have that, then it just gets really de motivating coming up with pet projects that you can't show to anybody now.

  • With that said, the server is all set up already.

  • What we need is a figure out with the I P address of it is, and then route the domain name over.

  • So if I go into the stash board, I can see what the I P addresses.

  • I'm going to copy that, going to this advance the anus, and I will sign that to the www and the at addresses.

  • And that was said these to be a records, which allows me to just assign I p addresses to these click accept.

  • And by now, this domain name should be riding over.

  • So if I access, tweet them without calm.

  • Now the site is broken because it's probably going to that virtual server.

  • I need to look into it.

  • So in order to log in you use sssh the terminal to be able to log in to that.

  • So, yeah, if I go into the pastor's section, I can see what the user name and password are that they assigned and this keyboard starting to get loud, so I'll switch over to something more quiet for us.

  • All right.

  • Where were we?

  • So I say sshh route at the I P address.

  • All right, Nice.

  • We're in now.

  • The first and likely do is just copy my Bashar CFO, and we just essentially just listen.

  • Sure.

  • Custer.

  • I personally like and I recommend that you could get something like this.

  • Said that as well.

  • You and these are just random said things that just make determine the more useful for me.

  • It sets up the prompt the way I like it.

  • So I will STP this over into the server.

  • All right.

  • Close.

  • I've copied that over.

  • And now I figured out that I don't have a max, So the first thing we want to do is start installing some programs.

  • Young install Imax should do it.

  • And that was just just only a bunch of packages.

  • Imax has so many crazy dependencies.

  • Now let's talk about the tax Tak.

  • I generally use Lynn Nix, Apache, my sequel or Maria D B and PHP with some man cash.

  • So I'm going to show you how I might get this set up.

  • But you can easily adapt this to any type of text back that you may want to use.

  • You could use know Js, python, Django flask, Ruby on rails.

  • But this standard lamp tech stock is probably one of the most simplest, and it's also very powerful.

  • Many start ups are using lamp as waas.

  • Even Facebook is on the standard database PHP main cash this type of text back so you can definitely do a lot of damage.

  • Just with this set up.

  • In order to get a party Web server set up, you issue a command.

  • Yum.

  • Install http d we just short for http Damon.

  • So now if I run service http de status, I can see it is not running.

  • And now if I run, start well, it should be running now.

  • So now I can try accessing the Web site tweet demo dot com was it?

  • And yet you can see I've work to have this website up and running on my own wishing with my own Web server.

  • The next thing we need to do is actually configured their server.

  • So I will go to slash http d dot com.

  • So this is a standard path word.

  • This is set up.

  • I know this because, you know, if you just dig around, you'll be able to figure out the documentation to tell you that this is where it's all set up and you can see Okay, the document root is far www slash html.

  • So I think that works for us so we can go over there.

  • All right, So if I add the index that HT amount and input like hello there and save it and then access tweet them.

  • Oh, I can see that my custom content is already starting to show up.

  • Now the next that we need to do isn't stopped PHP.

  • So you run young and stark hp, and that is pretty much going to get PHP all set out for you here.

  • And by the way, these days, another common technique is to use container ization through dr to get Web server set up so that you don't even have to configure like monolithic Web servers.

  • But overall, this is still probably the simplest and fastest way to get yourself going.

  • Now we can remove index dot html that we have been using and change this to a PHP file which allows us to generate more dynamic content.

  • If I use the special command, actually, pay should be invoked.

  • Then it was up.

  • All the details and information about this installations I can go through here and check.

  • All right, so we need a database server.

  • So I'm going to install Maria de B Server and Maria de B, which is just a client of that.

  • This is essentially like my sequel, which is one of the most basic and common forms of day, the basis.

  • So now, fireman Service, marry a D B status.

  • I can see that it is not active.

  • I will start that.

  • And now if I run my sequel Okay, you can see I'm running this here.

  • Let's create database created a the base.

  • So now we're using the my secrets in text and not create a table like saying create table users.

  • We're gonna have a your I d field, which is an integer we'll make that a primary key, although increment And we need the I P address, which is like a bar.

  • Char will say it's, Ah, 64 characters and it needs to be unique.

  • Okay, there you go.

  • You're going to try and create connection connection because my sickle connect the TV host equals local host on the user is say route.

  • Okay, if I tried to run this bicycle connect doesn't exist.

  • So you actually need to install that?

  • My secret extension for PHP We just run Yemen style PHP dash bicycle and deep.

  • Now, if I run index dot PHP, I can see that I am printing to research I d.

  • So this is all set up is already connected, and I can actually make 1/4 share as well.

  • Lance equals like database, which is the database name.

  • And then we can make a Cory even select star from users given the connection, and then we can print the result.

  • And if I were to go into the database shell tables and could say, describe users and insert into users just impotent I p address like 1 to 7.0 point 0.1 and it starts.

  • I them slack star from users.

  • We can see what insert it now if I had to run the script print are on the room, which prints and the ray and I can see I am up putting that value So we have the database connection set up Now.

  • Now, in practice, what I like to do is just crazy.

  • And rapper functions around this, like our Korea function called the Quarry, were given their quarry.

  • It will automatically make that Cory into the database and return the values I just copy these valleys put inside a dysfunction.

  • So now I'll be able to make a number of different database quarries.

  • So let's talk about the tables that we need here and the fields we need.

  • The easiest table would say the user I d and their i p address.

  • Right?

  • And we're not going to use usernames or just use I p addresses.

  • We need a table for life tweets, right?

  • We're given the your I.

  • D.

  • We also have, like, a post, right, And then we also need follows were given a U idea user.

  • We also know who the follower off that is.

  • So I think these are the three primary tables.

  • We need to get this set up so we'll go into our database and get this stuff set up And our issue.

  • Some sequel statements like I'll create the tweets database, create database tweets.

  • We have a your I D, which is the integer Oh, and he's also need primary keys, So tweet I d would be like an inter jury will be a primary key.

  • This will also be other incriminating.

  • I will have a your i D, which is another interest her and then the post, which we can make, like, say, far char 1 40 right?

  • Because it's going to be 100 40 characters.

  • Oh, the date as well, right, because we want to be able to sort this would be a date time, So we'll add some indices like key on the date.

  • And though I have a key on the user, I d and the date So that's a compound key so that give your chronological feed of every tweet as well as we want to be able to filter by user, I d.

  • S can't create that create table, and then we also need to create table for the follows where we have a your i d which is int and a follower, which isn't.