A URL shortener application requires three core components: a controller to handle API requests, a service layer for business logic including short code generation using B62 character set (A-Z, a-z, 0-9) with uniqueness validation, and a repository for database persistence. The short code generation process involves creating random 6-8 character codes, checking for uniqueness in the database, and handling concurrent requests to prevent collisions. The application uses Spring Boot with Spring Data JPA for database management, and requires proper JSON serialization handling for Java records using @JsonProperty annotations.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
Coding everyday till I make: $5000 - Day 3Added:
I mean, you regret it. You regret the Bro, I'm the first Oh, Cricket. What's good, bro? Your name is just the hardest name ever. Oh, can you see my screen clearly, though? The first question I should ask because I don't want to start the stream and then you guys can see my screen. How are you? I'm I'm I'm I'm doing pretty much good.
I'm doing great, bro. How about you, daddy? Bucket API. So, how about we start with filtering today? How are you doing, Bruski? Let me hope you're doing great.
Cricketa. Cricketa. Bro, your name I think it's command B if I'm not mistaken. How do I close this off? Oh, it's actually command one. Command one.
Okay, it's like this. All right. Command one.
I'm good, bro. I'm doing great. I'm doing great for real. Thank you so much.
Wait, can you guys see my screen clearly, though?
Can you see my screen clearly?
Why am I all the way in the corner here?
Put this somewhere here. I think it's better.
What?
What's up with my internet, bro?
What am I doing?
I'm trying to build filter link, which is the URL shortener. So, today today's the day to finish up everything, right?
Let me put uh view How do we zoom in, bro?
Oh, make text bigger.
What's going on? Okay, we don't have any problems again.
Cricket cricket analysis.
How did you even think of that name?
Cricket.
Cricket analysis. Oh, wait. Your name is actually cricket analysis.
Oh, cricket analysis. Not cricket analysis.
Whoa. Okay.
Is it is it clear?
Oh, you are Ahmed Mal. Yeah, bro. You keep changing your name every time. I don't know who you're running from.
Wait, I don't know who you are running away from.
Okay, let's continue grinding.
Let's have a look at the link service.
So, how will the controller look like?
Because for some reason, TGBT has like so much words for me and I don't get it.
Uh what's going on here? Let me first let first remove this and let me start it over.
Uh so we need to start with authentication the core MVP create short URL create short URL redirect um posgress storage. So that's all. No alt, no analytics, no nothing yet. So let's go back here. Yesterday we I think we finished we finished working on the we finished working on the exceptions.
So today Oh, you changed you just changed the name. Okay, you just changed the name. I get it now.
All right.
You just change the name. That's great.
That's good. Let me just put my cap like this so I can lock in. So let's look at um how will a controller look like? We need to just create a short URL.
Redirect posgress storage and that's it.
How do you even create a short URL?
I don't know. Let's say for example uh let's say h wait we can say cons. What am I thinking? What am I doing? We need to think of uh we need to create a string and that string is going to be I think we can just call this random characters.
Random characters. And we're going to have A B C D E F G H I J K L M N O P Q R S T U V W X Y Z, right? And uh the same thing for like the capital the cubs. So, um, A B C D E F G H I J K A L M N O P O P.
Wait, from here I need to make this.
Okay, browse.
A B C D E F G H I J K L M N O O P Q R S T U V W X Y Z.
Yeah. And then from there we go to zero one two three four five one zero one 2 3 4 5 6 7 8 9 and that's it. So this is these are the random characters that we're going to create that we're going to use. And then we pick random characters. I think uh do we need to loop through this and then append it to the URL? I don't know how we're going to do that, but uh it's room for us to think about the actual system design, right?
So um how do we do that? Project name is called filter link. Filter link is just like a URL shortener application.
So what do we need to do? We get the original URL from the user. So we need to create that controller. And before I do this, right, I'm just going to uh command X this. And before I do anything, I I just want to create um I want to create a new uh I'm just going to say get checkout checkout dashb feature and we're going to go inside the link service. I think it already exists, right? So, we're just going to say get check out uh link service.
Okay. And then we can just say get pull.
I think I think it's up to date if I'm not mistaken. Yeah, it's up to date. So, we are just going to go ahead and not that. Uh now, just paste this here.
And this is what we have. So we need to go inside the controller and go inside the links. And within the links, we need to create uh link controller.
And inside this link controller, we're just going to annotate this as our address controller. And then we're going to get request mapping.
We're going to have API slash I mean slash API slash v1 slash links that is the base URL and then we're going to get required argument constructor so we don't have to write uh the get us I mean not get us in setups but the constructors hey akash what's good my brother how you doing how's life bruski let me hope you're doing great today we're grinding you feel me we're grinding today so um I'm going to go ahead and just create like a public method First of all, let's have a get mapping that is going to be I think we can say get link get original URL maybe um slash links /get wait how do you how do you get the original URL the user has to provide that right we need to ask that from the user so that means uh within the link link response. I mean create link create link. We're not going to need the custom slug. I'm going to remove it. Let's go back to the models first.
Let's go to link. Um we're not really going to need the slug. We have the original URL.
And uh for now, we're not going to need the short code. I don't I don't think we're going to need the short code.
Well, short code can be like anything from the random characters, right?
ask DBD if we are on the same page like let's say let's say I have I have uh this modus and I want to know I want to know um is the short code short code necessary for the MVP MVP given Um uh given we have random characters that we can choose.
We can I think we can choose six to eight characters from perform the shortcut.
And also um how is the user not how is how how shall we get the input from the user or the original URL original URL.
Okay, let's keep it MVP friendly. So I'm going to look at this. I'm going to say hey first judge my reasoning as well. Uh let's say judge my reasoning my reasoning as well and guide me accordingly.
Yo hello. How are you doing? C C sh Hello. Your name is C S H Q E. I don't know how to pronounce that but it sounds like sik or seashik.
How you doing brother? um guide my reasoning as u I mean judge my reasoning as well and guide me through how we can sharpen sharpen my reasoning uh reasoning I'm not asking for the answer direct for the answer directly but rather more uh reasoning so I can build intuition build intuition along the way. So I think that is what we are going to do. I'm just going to press this and uh this is what we have so far. I want to paste my entire sue.
Oh su. Okay. Why did you add the O there? Why did you add I mean the Q there? Why can't you just use O instead of the Q? All right. So this is what we have currently. I'm just going to say this what I have. Uh let me also just send the rest of the modus so that we can get corrected accordingly. Uh and we don't just rush ahead without knowing if we are on the right track or not. Uh remember this part of this is like building with AI not just copying code from AI but building with AI and letting AI teach us you know. So, I could just go on like YouTube and look up how to build this and just come to you guys on stream like I already know it and it just sounds stupid. But I want to learn with you guys as well and show you guys how I learn new stuff cuz I've never built anything like this cuz the name su is taken. That's why Oh, the name su is taken. Okay. Sorry. Who took your name, brother?
Somebody stole your name, man. You should crash out. All right. I think I have user. What did I put? Uh okay.
Okay. I have us already and I have mappers and and this other stuff. So that's fine.
I could just send this um I have request DTO which is wrong which is fine. I feel like they uh stuff to AI to polish it for us. Okay.
All right. Let's see what we're going to what we're going to get.
All right, bro. Is this stuff really tripping? No, it's not. So what's going on?
Your reasoning is actually moving in the correct direction. The important thing now is separating core core business, bro. Like what's up with this?
I'm going to have to use like the chat GP for the website cuz this is just annoying.
The new the new update just made this unnecessarily small. I think you guys can't even see it.
Okay. So my reasoning is moving in the correct direction. The important thing now is separating the core business problem implementation details and future scalability concerns. Right now you're mixing all three togethers slightly which is normal. First is short code necessary. Yes, very necessary because the short code is the actual identifier user. So this is the correct flow to say nullable false. And what's going on here? Currently, this allows duplicates. So we need to add unique true. Oh yeah, cuz yeah, that's a fact. If we do it like this, it means we allowing duplicates.
We have some drop frames, bro. I think it's because of the rain.
I think it's because of the rain, right?
So we need to go to the link service uh short code here. We need to make this unique true. All right.
What else?
Uh because a BZ1 123 must belong to one link only. This is very important reasoning principle. If something is used, if something is used as lookup identifier, it usually needs uniqueness constraints. Oh, I I think I'm now understanding I'm now understanding the entire stuff, which is nice. Um, >> you know, don't worry, everything is fine.
All right.
So I think that is okay. Now uh you're thinking about generations correct?
Generate random characters A to Z A Z to 9 fix six to eight characters is correct. You already identified correct uh you you already identified the character space the code length and the randomness. Good. But sharpen the reasoning father. Right now your brain is still focus on how do I generate a shortcut?
But we need to now think about the better engineering question is what guarantees must the shortcut satisfy that changes everything. What guarantees must the short code satisfy?
Okay, a backend engineer thinks like this. But this stuff is like super small. So let me open it on let me go to let me use hit here chart GPG.
Okay.
Um accomplish.
All right. I think this is now clearer right. So that we can zoom in this one.
I think I think I can zoom this one.
Take it up to like 200 so you guys can see what I'm seeing clearly. Uh so what's going on here?
Okay. Okay. Okay. Okay.
Yes. So here's the thing. A bucket engineer thinks like this, right?
Requirement questions. Does it need to be unique? Yes. Does it need to be guessable? Uh, preferably no. Does it need to be human readable somewhat. Does it need to scale eventually? Yes.
Canclusions happen? Yes. So check DB regenerate if exist. So that is that uh this is stronger reasoning than how do I randomly generate characters. Now your redirect reasoning is very good. This part redirect 302 status code. So we can check we can track analytics. Excellent reason. You identified redirect type matters. Analytics happen during redirect flow. This is back end thinking instead of uh 301. Your intuition is correct. 301 is permanent redirect and browsers aggressively cach it bad for analytics accuracy sometimes uh temporary redirect is 302 and request always reach reaches the back end better for click click tracking analytics and dynamic redirect so good instance here so let's look at this your click table this is where your architecture s become interesting you already separated link from clicks this is good uh relational model because one link many clicks. This is exactly correct. Yes, one link and many clicks. I think we have that right.
We have um one okay one one user can generate many links. Uh also on the link on the clicks instead of calling it clicks I'll just call it click. Right?
Let's rename this to like clicks. So it it just has like this uh table name as click and then we have clicks here which makes sense.
Uh let's continue. Uh but your MVP does not need full click tracking yet. This is important. You currently have IP IP address, country, device. This already analytics infrastructure for MVP. You only need the click count inside the link. So why? Let's see. For the MVP, I think we are going to track this though.
It's fine. We could just keep it as uh we could just only keep the click count.
Where is it? Where is the click count?
This is the click count though as an integer. But it's fine for now inside the link. Why? Because every redirect creating DB rice gio/device passing adds complexity IP extraction ads proxy complication. So, I think that uh that said we can remove that from the MVP.
Yeah, I'm thinking about removing that from the MVP as well. So, that's fine.
I'm going to go ahead and remove it from the MVP. So, uh we leave the link table only and then we just increment the click count every time during the redirect. So, I think that is that and then if we want to ever increase uh stuff later, we can just go ahead and increase it. So I'm going to remove the click table entirely and we're not going to worry about it. So we are just going to increment this every time. I think that will make more sense and then we can have the user uh as well as Yeah, I think the user also makes sense to be there. So let's see.
So first two we we can add the clicks table, IP tracking and device passing.
This is important in general disciplines. delay complexity until the simpler version proves useful. So that's what we're going to do. Now your DTO design is improvement. This is one area where your intuition is still junior level. Bro, come on. Come on now. You're exposing entities directly inside DTOS.
User user inside DTOS. Avoid this. Why this is bad? Because entities are database models internal processor structures. DTOS are API contracts. This should not tightly coupled. So the better detail thinking instead of user user string email depending on the API we need. So we are going to have instead of this we are now going to have something like because of authenticated user comes from the JWT the front end should only send the original this and the custom slide. Yeah that's that makes sense. That makes sense. So conceptually we are going to have to only change this original URL and the custom slide. But for now, let's just keep it as the original URL.
I think that should do it. So, let's go ahead here and remove this user entirely. And also the custom slag. I don't really think we need a custom slack for now. So, we're going to keep it just like this. We're going to get the original URL from the user. That's all we interested in. Uh, you should probably should probably not exist here.
And then the response, we are going to return the short URL, the original URL, the integer for the click count, and the expire. I think this is better. Uh, let's go ahead and just copy this. We go back to the link response, and uh, yeah, this is this is better. We're just going to go ahead and copy this. Paste this here. And we should be good to go. Um, I think this is fine now. So we are returning the short URL, the original URL and the click count. Wait, what do we have here? Do we have click count within the yes uh within the link we have click count we are returning click count that makes sense expires at all right let's now have a look at this your service reasoning check DB if if short URL exists very important you already identified collusion handling now sharpen it further so the better engineering instead of generate random characters we think generate candidate validate the uniqueness and persist atomic atomically uh exist by short code unique is equals to true in the der so two requests can happen simultaneously this is concurrency thinking oh my god so let's see user types uh the URL front end sends API slash uh links Right.
And then within the body, we return this with the custom slug.
And then the back end validates the URL, generates a short code if no custom slug, and sales. And then we return the short URL. I I feel like um what what's the purpose of using the the custom slug? I don't know what's the purpose.
Important validation. Don't trust uh user input. validate proper URL format allowed protocols length and malicious URLs eventually at minimum must start with HTTP/ this this or HTTPS. So your biggest strength right now is you're thinking and this and that. Okay, that is fine. I don't want to go like all the way here.
So let's go ahead and just try to generate that. Now what are we getting actually when we get this when we when we say slash get I think this should give us all the links right so let's say u instead of a list we could return a pagenated list of links should that be the case no what if we first have a post endpoint where the users can upload their links to so let's have a post endpoint to slash links and then that is going to take the response entity response entity. I don't know if we um we are we taking something. Yes, we are most definitely going to take um link response DTO link response DTO and then we are going to say create link create link and we are going to say create request could be create link request detail maybe um what what you building ask custom slot to charge is important.
Okay.
Um what's your name? Game music melting pot.
What kind of name is that? Oh my god.
Guys on YouTube are funny as hell.
Create link request video. All right, bro. Why is your name just unnecessarily long like that?
Game. Hold on. Game music bullet for the day.
Game music melting pot.
It's funny. Yeah.
But for now, I think we don't really need anything else. We have this. How about the implementation though? How do we create the implementation for the DTO? That is something we need to actually not just ask Charity. You could Google that out, but let's ask Chad, not Chad GPT. I feel like I have a better teacher than Chad GPT. I'll leave Chad Gupty for architecture, but we can use Claude instead to like explain to us that concept of uh how to use I have a DTO a DTO and and a model check. an instance this. So let's give it uh for example the link model and uh and uh this response as well as what are we wait why are we actually just returning the original URL here oh we actually taking in the original URL from the request that makes sense okay let's pick that and uh let's get the link response detail and also let's pass this So I need to create an implementation implementation interface interface just um to have better code separation and code quality quality. How do I how do I implement it implement it implement it without without using mapstract right I don't want to use mstruct so let's see um here's a clean mapper implementation without map so this is what we are going to need we are going to need to create an interface called link mapper and it's going to take in link and we are we are converting the link to entity and from there we are returning the create I mean we're going to use create link request DTO as DTO and user as user and then we are going to also use the string short code.
We also going to need the integer click count and we could use local date time expires at um and then we are going to go ahead and say link response DTO we are returning to response DTO and we are using the link as link and base URL.
Why do we have a string base URL? I don't understand. Was busy or there just added his own stuff. Okay, I changed my name. Let me see your name. Walk work.
Yeah, walk work walk makes sense.
I didn't Come on, bro. You didn't have to do that. You didn't have to change your name. Like, I'm sorry. I'm sorry.
That was funny. Gamer. Hold on. Gamer.
Game music melting pot.
That was that was the best though. I love it. Okay, from there we're going to need to create an implementation.
Uh we're going to need a class that that is called link link mapper implementation implement or imple that implements link mapper. And what's going to happen is we are going to override everything. We're going to create public link to entity to entity and then create request detail.
Hello. What's going on here? Create request detail.
uh taking in the user like everything that we need and then we are going to say link is equals a new link and then link this to user set this to that and then we just return the link and then we override the one for the response that is going to be link response detail to response detail we taking the link at the base URL I don't know why we need to create a base URL it's going to be return new link response DTO burl plus link getsh shortcut link get original URL get clicker get expires I don't know why we need that and then the service will look something like this uh okay we are supposed to actually get the base URL right which is which is like the original URL um okay and then the link service is just going to take in the link response DTO create link link response DTS DTO user is a user string short code is equals generate short code local time expires because now plus days 30 days I really don't think we need this though expires that is fine link will expire in like 30 days is also okay now let's see now link link link mo to entity we pass in the dto the user the short code zero and expire why is there a zero here what was zero representing I don't link we have saved is equals to link repository save link and then return mapper response entity. Now this is super unnecessary because these are business logic constants. Now I want to ask I want to ask uh how does how does map mo simplify this and also why do we need a base URL?
Why do we need the base URL when we just going to ask the user or the original URL?
Uh, no. I think base URL is supposed to be the base URL. That is the shorten URL. Shorten link if you're building a link shortener. Yeah. Yeah, it is the one. But how do we get it all? Isn't it the original URL?
what base URL is like? Let's say um for example, I think I have an example somewhere here in the link service. Let me show you.
You see in the link service this like the original URL. So the base URL is probably something like this like from here. So the base URL will be https db bucket or store whatever whatever but we are actually getting the URL from the users assuming it's other people's other people that want to shorten their URL they have to give us the actual original URL that they want shortened and then we just generate the random characters and from the random characters we pick six to eight characters within which we are going to uh append those random characters, the six random characters that we've generated to the original URL, I think, right? And then create a short URL out of it. I don't know. But that's what I'm thinking. Why do you need the best URL? We're just going to ask the user for the original URL.
And also, why uh okay, let's just stick with this question first.
H yo man walk work walk work walk work walk work walk work walk work walk work walk work walk work walk work walk my brother game music M melting pot you didn't have to change that name that name is nice but anyways thank you so much for your contribution my G is like making it's making me have interest to keep going thank you thank you so right uh the base URL is only needed when returning the short URL to the user in the response is the is the domain prefix you pre you prepare to the short code to make a usable link for example user Since original URL is equals to HTTPS Google then we you generate the short code ab whatever this and then you return short URL is equals to this and this uh this is base URL plus slash short code. Oh, so without it, your link response DTO would return just this instead of the full clickable URL which isn't useful to the client. That's it. If you'd rather return the short code directly and let the front end build a full URL, you can simply No, we actually need to build a link ourselves. We need to build everything back end front end should only see uh the returned short URL plus the original URL.
Now since they are interested interested in shortening and shortening the link.
So it means our job is well done.
All right, let's keep going. Let's keep going. Um, what's going on exactly? Um, that's the clean approval. So, the base URL stays and the front end gets back exactly what it needs. Nothing more. The response should really should um what really only contain uh the short URL?
Yes. And the original URL that is correct. So, the short URL is something like this. The original URL is this. But my question is how have we shortened this if we've only let's say they've given us google.com and we've returned this. So what how have we shortened it?
Let me just try to record something.
Um allow while visiting allow this time.
What's going on, bro?
Okay. Okay. If if the original URL is is this and we return and we return this.
How is it short now?
Seems is longer is I'm confused.
Let's see.
Great observation. The short in URL shortener doesn't mean short in character count.
It means Google is already a short URL naturally. But imagine the real use case could be yes. For example, Amazon this.
Yeah. That becomes Yes. Yes. Yes. That that means that that's where the value is. Nobody wants to share or type that Amazon link. The short code I see the real use case is long ugly par uh parameter heavy URLs uh that you that you want to share cleanly in social media posts. Okay, so that's just it. That's just it. I feel like that will make sense. Now we are going to have to build this link and base URL.
So we're going to have base URL plus this and uh okay. So now if the base URL is stored as okay so how do we get the base URL base URL since assuming we shall um have random users upload their own original long URLs that need to be shortened shorten. Let's see. It's always good to discuss with AI, bro. I feel like AI is like the best like the best URL is your own domain. It never changes per user.
it always. Oh, so everything is actually um we are using our own domain as the base URL for everything. I think that makes sense now.
Okay, it's always regardless of who submits a URL. So you just configure it once in your application.
So we're going to call it filter link.
So base URL we're going to have https filter links store this then injected in your service. Okay. Then we inject it with add value. Okay. Okay. Now I get it. Now I get it. And then we're just going to get uh generate the short code.
How we going to generate the short code?
Now let's ask how do we generate the short code?
Short code since I haven't seen that that method.
All right. Let's see.
Good catch. Here's the most common approach. String short code is equals to UUID.random to string substring 0 to8. Uh, and we are going to get something like this. B 62 most popular approach for the for URL shorten private static final string B 62.
Um, we create this B 62. What is B 62? I don't know.
Private S final in short code. is it uh short code length is equals to six and then we're going to have private string generate short code random random is equals to new secure random and then string builder oh now we are doing some we're doing some lit code cuz I remember working with something like this in the strings while doing lit code this is like data structures and algorithms I'm now learning something so we are going to have a private static final string called B 62 that is going to start from A up to Z small letters and from A up to Z capital letters and from zero up to nine figures right or integers whatever but all of them are going to be a long string like this and we're going to have private static final in short code length is equals to six and we are going to now say a method called generate short code which is going to take random uh which is actually random random of type random is equals to new secure random we're going to have a string builder substring is equals to new string builder I mean not substring but string builder and then we are going to take our short code length of six and we are going to now iterate through yes sir stop playing we could just iterate through this and then cut it into six right I mean shorten it to like six or eight characters, but it's fine. We're going to say of starting from zero, like from the first index, go up to like the length. We could say the length of the string and then increment every time, but it's fine. We have the short code length. So, we're going to say for int i is equals to zero. I is less than the short code length and increment i every time. Now, append that to the string to the string builder. We're going to have the string builder.append append B 62 dot characters at random.ext int B62.length and that is going to create for us the stuff. I think I did something similar to this on lead code. I did something similar for real and uh we're going to return the the string builder to string and that's it. But there's a problem.
What if the same code is randomly generated twice? You need uniqueness checks. So we're going to have string short code do while the short code is equals to generate short code. Um I mean do something while the short code is the same as the generate short code. Uh hello hold hello hold hello hold hello hold hello hold hello hold hello hold hello hold hello hold hello hold hello hold hello hold this is like the wrong way to read this do this like a dowh loop right it is do while loop. Now something will happen while the short code is equals to generate short code and we're going to say while the link repository already exists by short code we're going to pass in the short code keep regenerating unique short code every time and then return the short code or else it just return the short code and then this is fine then we can add this to to our repository we're going to have the interface link repository extends JP repository link and long we're going to have boolean which exists by short We pass in the string short code and then in our service we're going to have string short code is to generate unique short code. Where is it? Um this is another helper method as well that is going to check for the uniqueness. All right, that makes sense. So we're going to say short code is equals to generate short code use this instead. Now local day time expires at local day time dot now dot plus days. We're going to add the 30 days. So it expires with within 30 days. We could make it 10 days and it's fine. Now we have the link.
We have the link. Link is equals to new uh link mapper to entity. We pass in the detail. We pass in the user the short code and zero. Why do we have zero here?
I don't know. Expires that. And that is it. Then we pass in link saved is equals to link repository save. We pass in the link. Then we return the map to response detail. We pass in the saved link and we pass in the base URL which is what we already have isn't it? B 62 is the recommended approach because six characters gives you 62 to the^ six which is 56 billion possible codes. Use only URL safe characters. No special characters that breaks URLs. Looks clean. Something like this. All right.
So I think we've done like most of the most I mean most of the complex part. So now is fun part. Let's go and code. Oh my goodness, I'm super happy. Let's go and code. Now instead of writing this random stuff, we're not really going to need this anymore. I'm just going to take this off and we're not going to need that. So let's have a look at what we're going to need first. Uh we need to create this mappers first. That's the first thing we need to do. we have created this um this is actually going to we're going to get the um original URL plus the base URL if I'm not mistaken right I mean let's have a look here okay this is actually going to oh this is within the response DTO this is what we're going to have as our response DTO and uh we are going to override let's see what's going on mapper simplifies no base URL needed H wait, am I getting confused somewhere?
Wait, let me not let me not confuse myself. Right. Do we need to create the implementations within the entities? I don't know. I'm just going to create a package called imple. I'm going to create um package called imple. And within this, we are going to have the interface for the create link response.
Right? And that's what we are going to have here. Let's have a look at what we going to need.
So, where are the interfaces? Where are the interfaces?
Okay, where are the interfaces? So, this where we're going to first create uh an interface called link mapper and then from there we're going to create the link mapper implementation and that's all right. So we're going to call this link mapper implementation or imple whatever the way it is and we are going to have that implementation which implements the link mapper but we also need uh I think we already have mappers here. So let's first close this out. I'm going to just put these mappers within entities. So everything about entities is within here. Okay. Now let's go ahead and create that. Oh my goodness. So we're going to have link mapper. I think this is also going to be an interface if I'm not mistaken. Oh, that's actually yes an interface link mapper. Correct.
But uh the implementation is a class. So let's not confuse it. The implementation here is actually a class not uh this is actually a class. A class which implements something. Okay. A class implements the link mapper.
Right. Right, I think that's the correct way to read it. Uh, this implements the link mapper interface, right? And then that's correct. All right, I think we have the ideas in place. So now let's go ahead and say within the link mapper, we are going to take the type link and we're going to say to link I mean to entity and then link response DTO, we are going to say to response DTO. So we are converting from entity to DTO and DTO to entity. So let's go to the link and uh within the mapper here we're going to have to say link link and we're going to say to link I mean this is to entity and then from entity to DTO we are we're going to get something and then we are going to say response DTO let's see I think it's link response DTO link response detail and then we are going to call this to response detail and it's going to take something. Now we have some issues here. We haven't added this. We need to implement those methods and these are the methods that we need to implement. Uh we need to override these ones. So okay, let's go back here.
Where is it? To the implementation mapper.
Okay. To the to the actual implementation here. We're going to say create response create link request DTO.
We are going to take it as video as well as user. We are going to take it as user. I don't think we need that though.
Do we really need that?
Do we need to know user?
Do we really need it?
Okay, I think we we might need it. User user and uh what else? I think according to to our models, right? We are going to work according to the models. So let's open the link model somewhere here.
Okay, let's open the link model somewhere. Let me put it as its own stuff.
Let me close this. Let me close this.
Let me close this. All right. And then we leave this open. So now we have uh let me close this one. All right. So now we have the user user in place. create link response detail user and now we need to return the original URL. No. Is that the correct way to do it? Why are we returning user though?
H wait I think for the reason why we are doing this is probably because we want to take everything associated with the user. But why are we not returning the original URL too? That's the most confusing part.
I'm getting confused now. I'm not going to lie. But let's just follow this.
Let's just follow this. So, what's the next thing we're going to need? We're going to need the short code and the click count local time expire. Okay. Oh, wait. This is the entity. So entity from entity to DTO and DTO to entity.
No, we're converting from entity to DTO.
No, this is entity, right? This is actually DTO to entity and entity to DTO. H no, this is from we are converting to entity, right? We're converting a DTO to entity. That that's the reason why we are taking the DTO here. And then here we are going to convert from dt to entity. All right, that makes sense. That makes sense. So let's go ahead and now pick out uh string short code and we're going to say uh this is actually integer.
Integer is going to be click count.
And within the click count as well, we are now going to say local day time.
local date time expires at not expiration date but expires expires and I think that is it after expire there is nothing else we need and then from to response detail we're just going to return the link link and then string base URL that's what we are going to be returning all right and then this is going to be link as link and then uh string base URL raise your I think that is that and then we need to just go back here and implement this this other methods implement the methods implement the methods okay now for some reason this is like copied over I'm just going to go ahead and return remove this okay so now we've implemented this but we are returning null in the implementation which is not good so here we need to not return null we need to override this and that's what we have override that and instead of return null we are going to return the link and uh for this one we are returning new response detail. So we are going to have to create a new link here.
So instead of this we are going to say return link instead of new link actually we are going to go ahead and first build the actual link link link is equals to new link right and then we can now create link dot yeah set right we set the short code I think we we need to set uh user to user and then link dot set short code to short code and then click on to click on expires that to that and then we just return link and that is fine I think that should do it uh we go and do the same thing here but here we're just returning the link response response detail return new link response detail and this is going to take some stuff which is the same as this. So we are going to create the base URL plus this and the base URL we're going to go ahead and pick it from uh I think we we can add it to our resources application.
Now what's this?
I needed to create this though. So, let me let me go to my other application.
So, I can just grab I can just grab this go all the way down here. So, I can just grab this application YAML and uh there are a few things I need to grab actually. Uh I need to grab starting from what I'm actually going to copy everything here and then I'll remove the things I don't need. So, filter the link the name is filter link. So, I'll just remove the things I don't need. Like, for example, here, what was the name before? Filthy link.
Okay. Filthy link capital.
All right. So, we're going to call this fily.
Filter link.
All right, that's fine. Framework. Um, I'm just going to remove this. The port is fine. The way the port is is okay. 80 is fine. I'm going to leave it like that. Uh data source URL.
Since we're going to be working offline, I don't I don't think it's okay to just use like a spring data source. Let's just keep it like that for now. We need to validate all of the tables. So, we're going to remove just these ones. We don't need Rabbit MQ. And for now, we don't even need Google or for now. So, I'm just going to get rid of this. And JWT secret. I'm not going to need any at the moment. I'm going to remove that as well. I think I'll just remove everything from all the way here.
And uh even AWS, I'm going to remove it.
And yeah, for JPI, we can leave a spring spring data JPA there. So, I think this is all that we're going to need.
Now, how do we build this? Spring data spring data source URL and Spring Data Source username and password.
how we're going to build the data source URL. Let's have a look at our compos.
This is our compos. So, we have our password. This is our Postgress DB and uh yeah, I think J uh JDBC. So, we don't even need these ones. Like, we don't want to store these ones in our env. So, we're just going to keep it like this for now. Now the URL is going to be JDBC something something foxgress and then we're going to have localhost.
I think it's going to be a Z A Z if I'm not mistaken. A Z A Z something.
Um and then we're going to need the database name, right?
I think I think that that is that. Now the username is the same as what we have here. This is going to be our user name and this is going to be our password.
So this is the uh database name. We're going to have this. I think this is like the actual way to create this URL if I'm not mistaken though.
Yeah, this is like correct. It looks correct to me. If if if it fails then we shall come back and correct it. So it's fine. All right. For now I think we are okay with like the database configs. If there's anything that we shall need, we shall come back and correct it. Okay. So now that we have that in place, what else do we need to come to? We need to come to the base URL. Now I need to go back to application YAML again. And this is where we're going to like create the base URL. So within the application here, I could just call I could say maybe bas or somewhere here I could create like app. Hold on. Yeah, here. Oh my god, why do I keep typing this? Okay, I'm going to have something like app.
And then within the app, I can have base URL.
Maybe B URL. And then base URL we can have um https uh not local host again we're going to have my actual domain which is uh d bucket but this is like for our link website right so we are going to let me just call this db bucket for now db bucket uh store this is the actual URL we could call it like that or maybe filter link. Either way can work.
I'm just going to use base URL like this.
And uh why is this failing? What if I just copy this? I remove that from the app and just added as part of this. Is it going to work? Nope. It's not going to work. H how we going to do it?
How we going to do it? Oh lord, this is starting to annoy me now. Um, is there a way where we can fix that?
Is there a way we can fix that, bro?
Okay, we're going to have app.b URL is equals to https.
Whatever.
I think this is going to work like this.
All right. Base URL. Base URL.
Yeah, I think this is going to work. But this is like maybe uh property configuration issue that we need to fix.
And what's happening with this?
This is going to be below.
Press this. All right. Uh, what if I do this?
What if I do this?
Yeah, that won't work. So, I think I need to go and build the config and then um the application here. I can just add.
Okay. What's happening? What did I even open? Bro, what's happening with me? Am I getting confused? Yo, brother filthy, I have a question and I need some advice. Okay, go on. What's the question? What's the query?
base URL.
I'm I'm starting to get confused now.
Let me say uh what's going on? Why is why is it uh saying my configs this URL doesn't exist?
What's the question? What's the question? This is using B but that one's using app dot wait prop application pro is using app dot base URL base URL.
Okay, so base URL it's still not going to work though. I'm not going to lie, this is still not going to work.
This URL is still not going to work. And also you have a typo in the data source double colon. Oh, it's actually supposed to be like this. J uh JDBC posgress Q posgress QL not posgress and the local host not 8000 not 8080 it's actually 5432 fil DB all right I almost got it though 5432 filthy DB and it should be one single column okay and this is not working yes bro yes yes we have some issues also um I made these changes but still showing me this press here let's say we are still getting cannot resolve this let's say show quick fix invalid What's the question? What's the question? A cash just an IDE warning, not an actual error. Your app will still run fine.
Intelligent doesn't know your custom properties unless you tell it to fix the warning. Add a metadata file so Intellig recognize it. create this file at the source. This this this Oh yeah, that's that's unnecessary, bro.
Yeah, I don't I want to get rid of this this stupid intellig.
So, I'm just going to say disable inspection. And that is fine.
That is just going to stop all the BS.
Okay. Um, what else do we need to do?
Let's have a look. I think everything should be fine now. Except uh except while we are building this, let me close this off and go back to finishing this. So, command one, command one to close it. And uh we need to close this as well. So okay now here what are we going to build within the response DTO what are we actually returning within the response DTO uh let's have a look within the response DTO we have setting the user setting the original URL to the wait a minute why is it not in here okay link set original URL to DTO oh that's the reason why we are getting this cuz we want to pick the original URL from the user. So we're going to say link dot set original URL.
Yes, original URL to DTO dot original URL. And that is going to work for us.
Good. Now what else expires that is fine. Um we now need to create a base URL plus this. And uh we are going to pick the base URL from the going to say private string um base URL maybe not private but we are picking it from the from from the value actually. So let's see we have brow and we are going to have add value and then we are going to have something like this and the value is going to give us app hold on dollar sign and then app dot base URL and that's our base URL. Then now we can just go ahead and add this here. So here we're going to say base URL plus we need to add base URL plus what?
link get original URL. Yeah, we are actually supposed to use comma link get original URL link dot not set again. We are supposed to get not save get original URL link dot uh get original URL and link get count get click count link get expire and that is it. So finally we have our entire implementation.
All right. And uh now we can go and go ahead and use it in our service. Wow.
This is actually nice, bro. I'm not going to lie. But we don't have a user yet, though. So, we are going to assume we don't have a user. Let me clean my nose real quick with my our nose.
Okay. So, I think here we are going to act. We're going to pretend what's going on here. This is the basel H. Why aren't we having that B URL?
Oh, we are actually going to use the B URL somewhere here. Let's see where are we going to use the B URL private this and that. We have base URL short code generate short code link this and that and then oh yeah when we are returning actually to the user we need to return base URL as that so we are going to remove this from here and let's remove this from here we keep the implementation clean yo what's up bro Java oh my boy Java lover what's good guys that Hi Java man. How are you doing? All right. Now let's go back to it.
Response entity. This is fine. Instead of short URL or okay, instead of short URL, we are just returning the short code. So we have short code original URL. Click count expire. All right.
Let's go back to our response detail.
Let's go to details. Response detail.
instead of short you're wrong. We're going to return short code and that is it.
Um do we have where's the model link model? Yes, we have short code instead of short URL. All right, that makes sense. Uh now what's going on here within the link response detail? We have that already.
So we don't have to do anything.
How to activate intellig idea ultimate crack or you buy the license? Mine is is the official license. I don't use crack.
What are you talking about? I'm using the official license, bro. It's registered under my name.
Boy, talking about crack, bro. You want to get arrested?
You want to get arrested, bro? You so evil for that.
You're so evil, bro. You You He don't sue you, brother. Don't crack the software. Go and buy the software, brother. You have money. You have money to buy unnecessary stuff. You don't have money to like uh invest in your future. Come on, dog.
All right, let's see. Uh public link response d response deting the base URL.
And so your public accounts this return base plus this get the short code and the link URL. That is that that's what we actually have.
All right, I'm going to go ahead and remove this.
Remove this. Now, this is now short code instead of short URL. That makes sense.
Now, we already have the implementation, but uh we are picking only the original URL from the user original URL. Okay, going to remove that. Now, we have the implementation.
So, let's go back first. I think we have some yeah the service this is where we are now going to now grind we need to get the link mopper and link mopper let's go ahead and create a link service now so um we need to create another service I think within the repositories we need to create links and then links we need to create uh I have student park at jet brace yeah then that is good you can activate You can activate it for real. You have? Yes, I do. I I do. I do have uh link repository.
I do have um extend JPA repository link long and that is it. Now here we're just going to create a boolean exist by short code. exit by shortcut and we pass in the short code and we are going to use that within the service. So let's go back to the service and we start grinding. I'm going to go ahead and remove this extra words. We don't need that. Just going to create this add service annotated to the service and we're going to have requirement constructor and shall have private link repository. We need that private link mapper. We need the link mapper.
And what's going on here?
No bins of link mapper I found.
Why is it telling us that? What's the problem? Oh, private final. Actually, private final link mapper. Wait, we have that.
And why is it telling us no being found?
Oh, we need to um Okay, we need to convert the link mapper implementation class to become a component so that it can self um yeah so now we can have it appear within the link service. All right. As a bean, I upgraded internet before.
I upgraded internet before. 4 MBs. Right now 40. Oh, my boy. Let's go.
Let's go. Bro, you are you are doing crazy. Let me check my internet speed first.
The speed test. I think the speed test.
Let me see my internet speed. It will be low cuz there's so many devices using the bandwidth. So let's see.
Yeah, it will be low cuz there's so many devices using the bandwidth. So, and I'm also streaming and stuff. So, it will be low most definitely. But it's uh I think my internet speed is like 60 m Mbps.
60 or maybe like 80. I think it's 60 or something like that. Yeah, 60 plus actually. But because I'm streaming and stuff, so it's it's really going to take it's going to take a big toll on my internet. So, it's fine. It's fine. I'm I'm perfectly fine with it.
Okay. Uh we have link and also the base URL. That is what we have within our implementation classes. Let's look at the implementation class. We have that.
So, we have the create user detail. Now, I I want to get rid of the user cuz I don't I don't want anything um stopping my progress right now. So, I'm going to go ahead and get rid of the user from here. I don't really need the user here.
So, I'm going to get rid of the user.
Later, we can add the user to it and it will be perfectly fine. So, let's see what's going on here. Abstract method.
Should we remove the user? I think we have to like um within the link I'm going to have to get rid of this user instead of just getting rid of it. I'm just going to comment it out. Um that is going to like correct the errors.
What's going on here?
Must either be declared as abstract or implement abstract method to entity.
Why is it not link mapper. Okay, I need to get rid of this one too cuz I already have it that side.
Right. So now um I've gotten rid of it.
It should get rid of it here as well.
Okay. So now here's a question. We have the link mapper here. Um and this link this class link mapper implementation implements the link mapper right which is what we have and then this is what we have. So we have this and it's being implemented by this and uh that's it everything is already in place. So if we look at this we have to response DTO we we are taking in the link as link and base URL and uh from this we are going to take in the DTO short code integer count and the rest so that is fine um now we need to go back to our service we have the repository in place I'm going to close this off go back to this this and that should do it for us so I think from here we just need to paste this um value in for the base URL and then we can have public link repository link response video and we are going to say create link link instead of create link link what is going to happen here is uh we need to now create this response create link response DTO as DTO and then we pass in the user we don't need the user for now so we are just going to just work with what we have at the moment okay so We are now going to create the helper methods to generate the short code and uh we we have the short code method somewhere here.
Now let's have a look at how we are generating the short codes.
Uh I think with the short code method is not really very hard but where are we generating it at? That's the question.
Where are we generating it at?
Yeah, we are actually generating it. Um, where should they be? Should they be like um I think it should be within the service, right? So, within the link service, we just create um we are going to go ahead and just grab this create link response DTO as DTO and then that is that we are not going to pick the user as well. So, we're going to leave that and we're going to come and create a helper method called private um string generate short code.
Generate shortcut and another helper method as well that is going to be generate uh unique short code. It's going to be generate uh I think is unique short code, right? Generate unique short code.
Okay.
uh unique shortcut. All right. Now with this with the first one here, we are going to have private static final string B 62.
Now let's go ahead and create that. Can keep it somewhere here. Private private static final. Should it be private static? Yeah, private static final. Yes, it's private static final string base 62.
Yeah, I think is it's correct. Yeah, B 62 is equal to and then we start A B C D E F G H I J K L M N O P Q R S T U V W X Y Z. And the same applies to the upper case as well. A B C D E F G H I J K L M N O P Q R S T U V W X Y Z or Z. And we have 0 1 2 3 4 5 6 7 8 8 9 and that's it. So we have B 64 as our static and then we have another private static final and this time we are going to call this int. It's going to be integer short code length. So int short code length and we are grabbing it as six. All right, I think that is fine.
Those are the only static stuff that we're going to need. And then within this, we are now going to just take in what are we taking in? We are not taking anything within this. So, uh this method we're going to have random.
Um we can call this random as well or new random. Yeah, we're just calling it random as a new random. Instead of just random, we're going to say give us a random.
And uh this is from what? Lei constructs a secure random number generator implementing the default random number algorithm. This constructor traverses the list of registered security providers starting with the most preferred provider. A new secure random object encapsulating the secure random SPI implementation from the first provider that supports a a secure random RNG algorithm is returned. If none of the providers support an RNG algorithm, then an implementation specific default is returned. Okay, that is fine. We're not really going to do too much there.
That is okay. And uh from there, we're now going to need the string builder.
Oh my goodness. What? Let's go back and now build the string. So, we are going to say string builder.
String builder. Where is it at? string builder. SB is equals to new string builder.
Uh new string builder. Then we pass in uh what are we passing in the string builder? We are passing in the short code, right?
Uh what's short code length? I think short code length. Okay. Now, what is this short code length? Let's see.
This short code length is the length of the short code we want to generate. And then we are going to iterate. We're going to say for int i is equals to zero and i is less than the short code length.
I is less than the short code length that means incremented every time. And then we are going to now say sb string builder.append Append the B 62 dot characters at the random dot next int.
Um passing the base 62.length.
Okay.
And there you go. So I think that is all that we have to build. Let's see.
And then we just return the string builder dot to string. And that's all.
Okay. Outside outside of this loop. It should be outside the loop, right? Yes.
Outside of the loop. So we're just going to return string builder string. And that is that.
Now um outside this string builder, we are going to also have the unique um unique short code. And the unique short code we're going to have it as while.
We're going to have a dowhile loop which is going to just be like this short code string short code. We're going to say do as long as the short code is equals to generate short code while link repository.exist by short code. That means we need to also check for the short code and then we just return the short code. Keep generating if they are the same. Okay. um string short code should it be short code just like this and then we're going to say do something while something is true right so do something while something is true now we're going to do if the short code is equals to generate short code we are going to first check um link repository exist by short code and then we pass in that short code.
What or else we just return uh instead of having this we are now going to just say return short code.
And what's going on here?
Uh return short code. That is that.
Okay, return short code. And I think that is it. Right. So now we need to know, we've already used the generate short code. We need to now use the generate unique short code instead. And that means here we're going to say string short code is equals to generate unique short code and then local data time expires at this. And then we just continue with our with our program. So here we are going to say short code string short code is equals to generate unique short code and uh what's the next thing we need local date time expires at bro how's your interview by the way it was it was fine man but I I didn't pass I didn't pass the interview I passed all the questions But somehow they said oh uh whatever like they were picking uh that they had already picked actually the the the candidates. I I I interviewed late and they had already selected the candidates. So I passed all the questions by the way. They gave three questions and I pass all of them but they decided to go with the people that presented first. So it is what it is. We are still going to have so many opportunities going forward. What's up?
>> I'm not going to get this.
>> She called. She told is ready.
>> No, she didn't call. But look at the time.
>> What's the time?
>> 6.
>> Yeah, but also how about the the rain that >> Okay, you be careful then. Why don't you go with my jumper?
>> Me, too.
>> The blue one.
It's there.
>> No problem.
Yeah. Yeah.
Local date time expires. Local date time. No. Um we need to add the 30 days delay. Okay. That's fine. So local time expires at is equals to local date time dot now um do plus we need to just put that this okay what the hell is going on here plus days. Okay, this should be plus days. What am I doing? All right.
Um, what else? What else do we need?
Really? I think that is all we need.
>> Yeah.
>> You're going now. You have the money, right?
I gave you the money.
>> Yeah.
Like everything else is there and I already paid for the things.
>> Oh, so you need the money for Oh, you have that one.
>> But I I think there was some Hold on.
Let me let me give you this. This is fine, right?
Okay.
So, what uh what next? What next is that I'm building another project. I just want to keep working on projects and like um increasing my knowledge at the same time. For me, I'm thinking about just like focusing focusing on SAS projects and if we get a job that will be like part of the the plan. But for now, it's just like all right, we're still going to keep grinding. But at the moment, I'm just going to focus on SAS projects. And yeah, if we get a job, that's also well and good. I'll be interviewing as well and also just like polishing my resume. But we're not giving up. That's the that's the entire goal. Like we're not giving up. Just um All right, let me let me finish. Let me finish. We shall play. Don't worry. Uh link link is equals to linkm um entity.
Uh we need to say link link is equals to linkmapper entity or okay dot to entity. We need to convert this to entity. That means we're storing them in the database. So we need to pass the DTO and then we not going to need the user. We need to pass the short code and zero expires as well. This expires that we built and then save that's the saved um save short code. Uh repository save we pass in that link the same link here.
And then we return the link mapper to response detail. to pass in that save link and the base URL and uh I think that is that and the rest will just be um the controller and that will will mark the work for the day. So that is it. Link link is equals to link repository link not actually link repository link mapper dot do entity we pass in the DTO and uh what else after the DTO what else are we adding? I think we need to pass in the short code as well and uh zero. I don't know why we have zero. The click count starts with zero. But how we going to increment the click count though?
That's the problem. Let's just pass in the expire. It's fine. And uh here we're going to say link.
We don't need to set it again. So we are now going to say link again. But this time we're going to say save link is equals to link repository dot save the entity. And then we save the link. And finally we just return uh link mapper dot to response d. Here we are returning the saved link and the base URL and uh that is that I think we are done with the entire service link service and we are good to go now boys. So what else do we need to do? I think we just now need to build um we need to build the the controller for it and that will do it. So I think that is that.
So let me ask um with this I think we are done with this. I guess we are done.
And how do we we are done. How how do we test it the postman?
I guess we need a controller first. Yeah, that's true. But I just like to always ask uh to just confirm.
But I know we need a controller, right?
I notice you remove user from the entity. We need to handle all.
Yeah, I removed it. I removed it. Um so when the controller is just easy, we have the that already in place. We just need to call the link service and then we call the post slash uh shorten and we are going to have link response entity.
We pass in the link response DTO create link and then our request body. We already have that though as request. So we why why do we need request body again? I don't know why do we need to annotate this as request body. I don't know. Create request DTO DTO link response DTO. Yo filthy man. Yo what's good my G. How you doing man? Return response DTO status status are created body response. So then in postmon we say URL http this shorten um headers content type application JSON and then body row then we pass in the original URL like this and then the shorten URL is going to be something like this and from there we just going to uh have these two one thing to flag though your link entity has user as nullable false which will cause a database error since I think I removed it from here, right?
Uh, user nullable false, but I commented it out. So, so I'm going to say I commented I commented the user out because we we don't need the user for now. Yo, what's that guy? Uh, what? Gop go. Bro, your name is hot, bro.
your name is hard. So, let's go back to the controller and just build a controller. That's the last thing we're going to need.
So, post entity to um it's going to go to slashshorten and that is going to do it. Request detail.
That is fine. Link response is also fine.
Oh, perfect. That works for now. Your mapper, this should also reflect that.
Okay, it's it's fine. It's reflected.
So, we now need to just finish here. We have shorten. We're going to say link response DTO response request to link service create link. Okay. Now, we need to also inject the link service. So, link service private private final link service. And here we're just going to say link response detail as response.
Response is equals to link service dot create link. And then we just pass in the detail.
And from there we just return uh return response entity dot status http status creator body and that is that vibe coding. No, I'm not vibe coding, bro. Call me G. G, man. The name G. But don't think that the other way, bro.
I'll be violated.
Yeah, I'm not vibe coding. I'm I'm actually learning stuff with AI. It's different. It's different from vibe coding. Um, I think that is done. Uh, we've really built this entire stuff and, uh, we need to just test it. So, we can just go ahead and test everything and see if it works. Um now for today it means we I'm not coding in C# this is actually a Java this is spring boot spring are you high as a bird my boy okay that's fine what else what could go wrong this is not used anyways so cannot resolve the table uses I'm just going to get rid of this actually I I don't need this I'm just going to get rid of it of Uh later we can always add something. Uh I'm just going to remove this actually. Uh I don't need that.
Let's go ahead and just link is fine. Cannot resolve this. Once we run silently come into MVC instead of ASP or blazer MVC damn still the demon Java, bro.
What's wrong with you?
Why do people like love to head on Java?
It's crazy. You shouldn't hate Don't hate Java. Java is a great language. All right, so I think we need to just run this once and then see what's going to happen.
Yeah, I know. I know we're going to have issues.
Okay, let's just go ahead and remove this. It's just annoying.
Run this.
This is going to fail uh because docker composer is not there or it's going to work. Yeah, docker it's going to work.
Actually, it's not because you have unable to this session whatever. I'm going to go ahead and just delete whatever that we have. I'm going to say docker compose um down v so you can remove everything. Delete every single volume. I don't really care. Let's just go ahead and build it from scratch again.
Yeah. So, what are this again, bro?
Like, I hate when I have these unnecessary issues that I need to fix.
So, let's go ahead and just drop this here. I know it's something to do with the tables and stuff, but like, oh my goodness, I don't have time. Uh, validate, which means hibernate checks that the database tables already exist, but won't create them. Since your database is fresh, the links table doesn't exist yet. Um, change it temporarily to update a new application.
This this is auto create. Oh, I think I need to I need to use flyway. I need to use flyway. Yeah, flyway is the only way to go. So, I'm going to go to my application yl. Not application yl, my pom.xml and add flyway. That is the only way we shall get this working. Flyway migration and uh add this and we just create migration. Do you remember the questions asked in the interview? Yes, I remember.
But is it like ethical to do that? I remember the first question. I think I have a screenshot. I have a screenshot of it. I have a screenshot. Uh but I don't know if it's ethical though to to like um present that. I don't know. Is it ethical? I don't want to have problems with the company or something.
But yeah, I I I I took a screenshot of like most of the problems, you know.
They couldn't allow me to copy anything.
So this there's no way to cheat, bro.
They they they watching every single stuff. But I remember they asked me they asked me a question uh they asked me a question on strings. Uh the question yes the question was about um the the vow letters that you can I mean what you can form in a vow letters let's see hold on you have v vow letters how many vowel letters in in the alphabet uh alphabetical order like alphabet something they give you like 26 and then there like 26 characters in the alpha in in the alphabet And within the alphabet you have five vowel letters and yes how many combinations can you form something like that and the question was like super very confusing but you know I walk through like everything with my uh interviewer and everything was just nice everything was smooth I feel like yeah something like that if you look up that question you can find it but that was the first question and they also as they also asked a question of containers.
Yes. Uh tropic rain water. We did that question and we I passed it. Which other one again?
Oh, they the the last one was somehow hard. The last one was somehow hard, but I passed it as well. It it was something to do with two pointers. I kind of forgot the actual question, but all of them was like strings strings and two pointers. Strings and a race.
They just ask strings and a race.
Yeah, something like that. Something like that. I kind of forgot though. But yeah, the entire thing was just crazy. Like I was at first I was sweating, right? And then I was like, okay, let me just let me first relax, you know, because when I when I did it when I was under pressure, you know, I was just like, bro, am I really going to pass this?
Then again, I focus. I'm like, all right, bro. What's the worst that can happen? You know, it's just I lose the job. I mean I don't get the job right and that I just you know did it but I passed I passed the actual interview but those people are like they had already selected the candidates so it's fine it is what it is um and it um and it this is the initial commit so initial migration I'm just going to say link link in it let's just say that add this And I'm going to go ahead and run this application. Validate it.
Hopefully, it's going to work.
Bro, even with Flyway, like I I tried.
Let's see. Even with flyway, my aggression is still failed.
I want it to be DDL auto, but what the hell? Oh, okay. Okay, okay, okay. Not why do I always run to AI even with simple stuff like this? Like I can just come here and uh actually put this to like DB. I need to call this DB.
need to call this DB and then within DB I need to create migration directory uh migration and then within this I just take this entire thing paste it here refactor and that should do it if we run this work.
All right, boys. Oh god, it has failed.
So I don't know what else I'm supposed to do now. This one I'm going to say I have this I created this with flyway.
this with Py web added it to my DB migration and still giving me errors.
I think I need to say DB down uh down V.
Let me just say first docker compos down v and then take it back up again. See if it's going to work.
All right. It just failed. Why $5,000?
Um why not $1,000?
Well, $5,000 because that's the price.
That's the amount that can satisfy my my cravings. It's like that's what I can use to buy anything I ever wanted.
Does not support posgress 18 yet. So it's still new. You need to add the posgress dependency.
Uh no version in the spring boot manager. This is uh that is it. So what's going on here? Your flyway version 11 doesn't support posgress is too new. You need to add a flyway posess dependency.
Okay. Also make sure your migration um name correctly version description flyway is strict about this is must follow the pattern.
Okay, I did that. So I just need to add this flyway migration. I actually did add it. So I just I think I only need to fix um I have this flyway if I'm not mistaken.
I I have this flyway stuff. So why is it tripping? I think I just need to let's say posgress instead of latest. Can we just use posgress 17? Let's go to compose.
Instead of latest, I'm just going to use post 17. And that is going to do it.
Bro, my uh my college will start getting companies from next month, but I have repeated a year. So my degree becomes five years instead of four. And the score is also 6 out of 10, which is really low. Should I prepare for the interview or something else?
Uh, I think for me, I'd say just prepare for the interview, bro. Like, what's the worst that can happen? Always think like this, right? What's the worst that can happen? The worst that can happen is you get there and they they tell you, "Hey, we we don't allow this, right? That's fair enough, but what's the point of you not trying?" You get it? So, I'd say just prepare for the interview, bro. Um, see how it goes. It's always good to learn from experience. Uh no matter if your degree is like 20 years, whatever.
It doesn't work like that. As long as you're in that college is fine, bro. For real. Just do your best, man. And that's all you got to do. For sure. For sure.
Yeah. Don't don't let don't have like limiting beliefs and do not believe what your brain is telling you. Nine times out of 10 is not correct.
I swear to God. So just just keep going, my dude.
Let's see. What are you building? I'm building a URL shortener. It's two things I need to fix it. Compos 17, but the error said pos 18 meaning an old container from the first still running.
You need to delete the old volume. So docker pulls a fresh image post 17 docker down fly with this right now your existing flyway dependency added right now before your existing dependency. So what's going on here? We have this uh the application. So I think I need to add this as separate. Bro, why? Why do I need that? That is annoying. Okay, let's say docker compose.
Docker compose remove that. And after that, uh, let me just build it back up again. If it fails, then yeah.
Okay, it has failed. Most definitely. We have to go and add this flyway posgress dependency.
All right. Uh refresh this and then we just go back and say docker compos down. Clear everything. Then let's run this again.
N boy, how is day three going? Day three is going good man. Day three is going good except except you are coming to the stream late bro. Like I I think I need to I need to discipline like like bro like bro like what's up with you bro?
Like you you want to you want to fight?
Huh?
Oh boy. What's good? What's good man?
How you doing broki n my brother? How are you doing man?
All right, let's see what else we got to do. I think I think it's up and running now. So, let's test it with Pulsemon one more time. Let's send this health check.
So, our server is running. Now, we need to create um the link, right? Let's create this endpoint. create a new request and uh we're going to use the same health check thing. Copy this.
Sorry, uncle's doing what? Some college stuff.
Okay, I see you my brother. Ling ling bro. Instead of post request, this is going to be slash main one/links and it's going to go to slashshorten shorten and uh within the body we are going to go to JSON I think row and JSON and then we shall just pass in the original URL. So we are going to pass in original I think this should be um original URL something like this and then let's pass in the original URL let's say for example we want to shorten um let's say we want to shorten uh data bracket store that is one of my I mean my SAS application.
Yeah. Why is it taking forever, bro?
WW doesn't work. I don't know why. Like whenever I say WW, it doesn't work. But if I say data bucket does this, it works. So let's go to um let's go to Vel first and let's go and see why why that happens. I'm going to go ahead and see why does that not work.
So, we have this domain. Uh www.daddybucket.store.
It should work, right? Two domains should work.
Some reason the other one doesn't work.
H. Okay.
Um but that's fine though. We have this.
Now let's assume we want to shorten this URL. Um we I mean if we go to slash bits I think then let's say we have slash bits and we want to shorten it to something else but instead of data bucket.
Can't we just add something else?
So let's say want to shorten https instead of d bucket. I'm just going to say filthy link.store store slash beats slash 1 2 3 4 5 6 7 8 9 10 slash something something something something slash something something something something something something and let's send this to our stuff um we have some issue here internal server error um API v1 links shorten okay what's the issue And what's the issue?
Non null in the column original URL or relation links violates non null constraints.
Um okay we have something that is non null that we are violating. And what the hell is that? Nullable false short code nullable false. Why? Let's copy this and let's go back to our our good friend.
Paste this there. And uh let's copy this. This is like from Postman, right?
So let's say this is from Postman.
Copy paste this. Okay. And copy paste this. That is that. And then here we are going to just copy the error message and let's say good boy help us.
What's really going on here?
Because the error is not null. So what do we have here? A JSON property fix it by adding wait the original is arriving is arriving as null which means Jackson cannot decelerize. Diller what?
The serialized deceleriz serialize. What's that word, bro? D serialize. D serialize. D serialize.
Okay. Your JSON filled into the record.
The issue is your f name origin is a hint to map case correctly with the records.
Okay. Wait, wait a minute. What do I have here? Original URL isn't it lower case what string original URL what's going on here within the response DTO original URL original URL What?
Oh my god.
Why do we need this? Like um what's the issue with come?
What's the issue, bro? This is what we have there. There shouldn't be an issue there, right? Hello. Um I I ran. Is that your name? Iron or Iran? I don't know.
How are you doing, brother? How are you doing? Okay, this what we have. It shouldn't give us an issue, right?
Um that shouldn't really give us an issue. I don't know what the hell is going on, but let's see.
That shouldn't be an issue.
Whatever is easy for you to say.
Okay, I'll say I I say what Ryan Iron the Java records generate access without the get prefix. So um original URL becomes original URL not get original URL. By default Jackson looks for get original URL style get when it doesn't find them it can't serialize or deserize the field correctly. So it arrives as n fix it add this the application y pic is unnecessary or simple oneliner that most commonly used. We have string uh spring. We have Jackson dalization fail one unknown properties and yeah actually the cleanest fix for records is to add this Jackson model to your stuff and I'm just going to add this and in application yl you just say this true but honestly the cleanest guarantee fix is to just add add JSON property on the record so I'm just going to add is and like this is so annoying, right? If you if you ask me, this is so annoying and it's so unnecessary. The most explicit and predictable approach works immediately. Use it in your response DTO. So now we're going to say link response DTO. We need to add this.
Oh, this is so annoying. Like why the hell do we have to do all of this?
Wait, wait.
Isn't all of this unnecessary?
Um, I think it should be unnecessary, dog.
Iran. So, your name is like the literal Iran country. It's crazy.
Yes. Completely unnecessary. Spring boot auto configures Jackson to handle camera perfectly. The real issue was simply your postman content type header. Go to Postman and make sure headers contals application JSON and that should do it.
Yeah, I think it should not really give us this hard time, bro. So, let's see.
Um, where is it? Where's the content type? We have JSON like literally. So, we need to go to headers. Uh, content type application. Where is it? Content type. Yes, it's already there. It's already there.
And did this already? Jeez, little does you still?
>> Yeah. Yeah, I'm I'm I'm almost finishing. Actually, I'm I'm I'm done, but I have some small errors that I need to fix. That's it. No jokes on this needed.
Then JSON from the drop down. And that's what I did, right? Do what I did.
Just continue. What happened?
>> Send this again.
But this shouldn't give us errors, bro.
What the hell?
>> Null constraint. What if we just say this uh nullable um no we should not say nullable false because I mean nullable true that's going to be an issue.
So, um I'm just going to go ahead and go to the link create link response detail here and just add that stuff like this is just super unnecessary but JSON uh I mean is it JSON what should we add uh JSON property JSON property and I'm just going to go ahead and say docker compos v let me first stop this application and just say docker compose. Now, let's just start it up again.
This time, hopefully it will work.
Okay, now let's send this again.
Um, we're still getting that issue. Um, that is not good. That's not good.
It's going to say uh I think they're saying that u of relation links violates non constraints.
Wait, it's asking us for relation. So could it be see?
Um although we changed this stuff, it's still giving us that error. I'm just going to pick this first this. And I'm going to say why is it still giving us an error despite changing this? Right.
So is it relation issue?
I don't know why, bro. Stuff is not giving me headache. Yeah, this is definitely a Jackson decentralization.
This is not a database issue. Um the original URL is arriving as null before it even gets to the database. You're using spring boot which uses Jackson.
This notice class Jackson 3 change how it handles records and um requires explicit constructor property detection.
So I'm just going to go ahead and add this add this compile argument to your pom.xml.
So I am going to have to add this.
All right, let's get rid of it.
And uh let's go back to our pom.xml.
Then we just add this dependency.
Let's add this dependency. And let's just dependency.
Okay. After that, we need to now add this. Let's see. We have the entire build. Let's just copy this. Go to build and copy this build down.
Uh that should work for us.
So I think that is now that I'm just going to go ahead and take this down. D compos down V.
Then let's go ahead and just restart it again.
This time it should work like Okay. Now um let's go to our this and let's send even after doing this bro like after doing that it's still giving us this issue. Oh my goodness.
Yo I did add all of them.
still got this.
So, what could be the issue, boys? Do you guys Can you guys notice the issue?
Oh, you're leaving me to suffer alone.
That's great.
Um, let's see. Let's see. Let's see.
Let's see. Let's see.
Okay.
Uh, can I just get the entire pom.xml?
XML.
Sometimes AI can like hallucinate. I swear to God. And it will keep giving you like the same exact things without thinking of like the difference or whatever. So let's see how it goes.
Notice in your class is pulling this.
That is Jackson module. But your main Jackson like this is you that gave me this. What the hell? And and look we are about to again get using the JSON property like oh my god let's see what's going to happen okay I need to say do this maven clean install clean install and that should work for us okay it is actually having issues this.
I don't know why. I'm just going to copy this and see.
Oh god, bro. Do you guys suffer with AI like this? This is like something that's supposed to replace us, right? But this is same stuff that's hallucinating every single minute. Unless you buy the $200 package, crazy multiple issues related.
Fix them all. Lombok scope is wrong.
Change this. Wait, I got this dependency as well for Lombok. I didn't know. Uh that's why a data is not generating get us.
Do I even have a data? Hold on.
Do I have a data? Let's go to this. Oh yeah, I have a data. Okay. Okay. Okay.
Kind of forgot. Longbox copies. Change annotation processor to be to provided.
Okay. From annotation provide processor to provided. Are you okay?
I don't think that will work though.
Let's first go and change it.
Lumbok annotation processor to provide it. Let's see provided. Um let's go back again and let's look at what's that has no required cuz that should show your controller where it looks like this missing annotation. Are you sure? Let's look at our controller.
Hey, we have it. We have the required argument constructor. So what?
Let's start this again.
Um, clear this dot Maven plane installed.
Okay, we still have an issue. I don't know why. God damn, bro. I'm I'm getting annoyed now because like I'm getting the same error. If I get another error again, I'm going to call it quits for today. It's now annoying me. Uh, let's go to pom.xml.
Copy this entire stupid pom.xml. Paste it in here. See what's going on.
Do you guys suffer with like code like this too?
Lombok is still not being picked up as an annotation processor. You need to declare it. So let's copy this entire build and uh let's go to the build package here and just add this Lombok annotation process.
Yeah, I think that was the only problem and it will definitely work now. So I'm going to go ahead here and just say clean install NVM or Maven.
clean install and voila, everything works perfectly fine except we have another issue again. Um, what's that?
Okay, the only test in trying to start the full context. I want to I want to skip test. Oh my god. I want to skip tests. I don't have no tests there. So, let's skip all the tests.
That is going to work. Yes, we have the entire builds. Thank god. Now, let's go ahead and run this.
See if it's going to work.
Okay, everything works as expected. Now, listen.
Oh yeah, now we are back to having our issues and I think this is going to uh I'm going to call it quits for today, bro.
Yeah, I'm done for today, boys. Like we we can see you from there tomorrow, right?
I'm done. I'm done. I'm done.
This is frustrating as hell. Still not this definitely this realization issue.
So the only way we can get it is to first print it out to see if that's the issue. So we need to print this out.
Receive this. Um if that's true. So if we did receive it then yeah it is already. Uh since you're in Jackson this is handles records. Definitely the definitely the guaranteed fix is to just stop using a record for the request DTO and use a plain class instead.
Okay let's first try to use a plane class. Um let's try to use a plane class for real. Let me stop this and go to create. But yeah, records shouldn't be a problem. All my applications I use records. I don't know why it should be a problem now, but it is what it is, you know.
Okay. Uh I'm going to go ahead and say docker compos v remove everything and then start it back up again and try it.
Okay. Um now this is just going to instead of this we are going to say get dot get uh get original URL and it should work. So let's run this one more time.
Okay.
So I think the Java record was the problem. Let's send this. Okay. Now we still getting the error. So even after changing to the Java record, we still getting the error. Um, one thing I'm going to do is to just go ahead and print this out.
Uh, let's go to the service.
Let's go. Where is this service at? Link service.
Okay, I'm going to go here and print out this. Instead of dtrl this, we're going to say dtrl.get URL.
And let's stop this.
And let's run this one more time. I think let's just stop it and delete everything. docker compost down. Delete all the volumes. Run it back up again.
Okay. Well, I think I think that's fine now. So, let's try to send something and then let's go and check the So, here do we have anything?
We have an error which is still implying that we are receiving this as null.
So, let's see what's going on here. Uh, I'm going to copy this.
Original URL is still appearing as this.
So, And even after having added the salt print and also changing to plus from records still getting errors.
Uh after this if he gives us any again we're going to say bye-bye for today just go and play chess one game chess call it a day we closed our today's stream. Okay this is the last try that we're going to do last um that let me just remove this.
Why is it reasoning too much? Calm down, bro.
It's not that deep. Um, the debug lo confirms receive unknown. Jackson is definitely not here. You need to switch the class a little more, but still not know. So, headers I have this set like bro, I have that set. Alternatively, bypass this. Now, let's test u what's actually gone works and post doesn't. The problem is not that.
Okay, let's see. Gross. Let's try out the call and hopefully it should work.
If it doesn't m problem really call works but still this I check your console. Should you receive Oh my god.
This is my console, boy.
Let's see.
Claude is your new friend. Where is Grog? Oh, Chris, what's up, man? Long time. I remember I used to use Gro a lot, right, bro? Grog like they have some issues. I stopped using them. I use clo now. uh null even with uh call confirms the problem is 100% the JSON not this detail the class shows that this and that and that is completely different package not so now how we going to do it move to tools package and what uh what's going on this okay I'm just going going to copy this, bro. Whatever the hell that is going to give us, I'm just going to copy it and see if it will at least change something.
I'm going to see if it will change something. And what's going on here?
Uh, use Lombok ser.
Okay, let's stop this and uh docker compose down.
I know I said that was the last time, but this is the last time.
Ah, I'm so persistent in trying to fix this problem that is now annoying me.
All right, let's go here and send this.
Yeah, boys. Um, let's call it a day. I swear to God, I'm going to stop right now. Whatever the code status is, I'm going to just say get add everything.
I'm going to add this branch.
I'm going to say get status. I'm going to add this branch to my git. Okay. And we're going to say get commit. What is the feature that we added? I think we added uh we added what? Um added link service.
Link service on uh link controller.
Yeah. And what else? What else did we add? I think we added the implementation uh link mapper in ball and the morer class. I think that is all that we added. I'm just going to say get push origin and I'll say link service.
All right. Uh we've pushed that to G.
I'm going to stop everything. Did I say Docker down? Oh, we shall just do it tomorrow's one cuz hopefully Docker is still not running right. Let's see. Let's go back here. Yes, everything is down. Nice.
Um shall continue from there tomorrow.
I'm going to stop everything right now.
Let's go back here. Say GitHub.
Um, okay. Let's just have to for today's um whatever we need a green thing today.
So, I'm just going to go ahead and say um filthy back end filter link back end.
We're going to have a pull request.
I'm just going to accept this pull request. These are the changes we made.
Um we're creating an input request.
Let's just merge the pull request for now. We have an issue that we need to open that I need to close tomorrow. So, as soon as we fix it, we are going to close the issue. But for now, I just open a new issue. This is going to be uh Jackson.
Uh no, hold on. Improper improper serialization. Serial. Wait.
Serialization.
Is this the spelling? Serial.
Serialization. Hold on.
Serial number, right? I think that's it.
Serialization. Serialization.
I think that's a serialization.
Serialization. Yeah, serialization with uh Z SA I think serialization something like that or we use Z I think we should use Z right yeah um improper serialization what's the word bro why is it tripping okay I okay think it's serialization whatever improper serialization uh of JSON record of maybe Java America.
Oh, they're original.
Oh, they wait, boys. Here's the thing, though. I think the problem is with me.
The problem is actually with me within the controller. I just thought about it now. Uh, hold on, hold on, hold on, hold on. Before we try to create an issue, the issue is here. I think I I now see it. I'm going to go ahead and just return this to the state where it was.
I think it was a Java record before. I'm going to remove this everything here. I now see I now see why. I now see why.
Hold on. If this doesn't work, I'm going to call it a date. Let's change this to record and let's remove this entire stuff.
And let's go back here and say string um original URL. Yeah. So, I think the issue is here. Let me show you guys first and foremost. Let's go back here to pom.xml.
Uh this is like there are a lot of unnecessary stuff here that we added but it's fine. Let's leave it for now. The issue is most definitely within the controller actually. Here we are not using request body. That's the problem.
Add request body as the annotation. Yeah, that's the problem. I think that's the problem. I just thought about it. So, let's go ahead and just try it again. Say docker compost down and let's just go ahead and run it and try it for the last time. For the last time. So, here we are going to say this is original URL. Um, let's run this again. See what's happening. We're also going to say this is original URL and that should work for us. So, we have that.
Um, yes. Now, let's go back to Postman and let's send this request one more time. Instead of new request here, we're just going to say uh create link. That is the name of this request. It's a post request called create request. Let's see. Bam. Yes. Oh my god, it has worked.
You see, I told you guys.
I told you guys I was going to fix it.
So now it's fixed. We have our short URL here. That is now tomorrow we just going to work on the redirect, right? Um the redirect logic um that when we click this, you know, this custom URL should take us to this. It should redirect us to this. We can we are not going to use 301 which is a permanent redirect. We're going to use 302 which is temporary redirect and we can store analytics and all of this extra stuff. But at least for today we have the URL shortener working. We have this original URL has been shortened to this URL. So that was the problem. That was the problem. We didn't have to like do all of that like all of that too much stuff that we did.
Like that's crazy. That's why sometimes you have to use your brain, bro. My bad, though. Uh, I'm going to go ahead and say this. I don't want to open the issue again anymore. So, I'm just going to say get add this. And I'll just say get push not origin. I'm just going to say g commit the same uh name. And then I'll just say g commit um get push origin link service.
And that's there you go. Now, let's go ahead and create another pull request.
Uh, for this, I'm just going to cancel this. Uh, discard the issue. Go back here. We have another pull request.
I think we should be having a pull request if I'm not mistaken. Oh, I think we don't have It's already marked. Am I mistaken?
Wait, let's say G status. See what's going on.
uh on branch link say your your branch is up to date with this. Nothing need to commit. Okay, that's fine. Now let's say get um G check out we need to check out to the main branch.
Get check out to the main branch. And here we need to say get um pull so we can have like the latest changes.
All right. So we have the latest changes here. And if we now I think yeah that's it. That's the work for today really.
Let's go ahead and refresh this and see.
Yes, we have the good boy contribution for today. So, I think we are moving. We are moving well my boys. I'm going to close this off and uh close Ghostly offer.
Close this off. And what else? What else do we need to close off? I think that's all. So, um Akash, where you at, boy?
Come, come, come. Let's play. Let's play chess. You know, we usually conclude this stream with like some chess game.
Let's play some chess. Uh what's going on here? Let's play some chess and then continue tomorrow.
After this stream, we start tomorrow stream. Tomorrow's stream will be for um how do you call it? Custom redirect. I mean, not custom redirect, but redirecting from the original from the shortened URL to the original URL.
Where you at, man? Come, come, come through. Send, send, send, send send, bro. Send challenge. Let me see. Are you even active? Let me look at you, Akash.
Oh, Akash, you're in a game. Okay, that's nice. Let me just play one game here and we call it a day. So, let's go.
Uh, okay. Let's go scotch game. Actually, Scotch Gambit. If it takes this, we go Scotch Gambit. We're playing with someone from Israel.
Someone from Israel.
Little fast.
>> Oh, they they don't want to take the pawn. So, they don't want to play Scotch Gambit. It's crazy. I'm just going to take here and let's see what it's going to do.
Oh, he actually just took with the queen instead. H interesting.
Why would you play that with the queen?
Okay, he's just going to If he takes here, then I'll take back. The queen will just go away from there, right?
This guy should not fumble his queen though.
Ah, if this guy fumbles, his quit is gone.
>> Thank you.
Why do you need to think for this, bro?
You just need to get your queen out of the way. That's all.
Just get your queen out of the way. Yes.
You don't got to think, brother.
I'm thinking, what if I take this extra pawn again?
But no, that is just too much because this pawn will just try to take my pawn.
So instead of that happening, let me just pin this pawn so it doesn't take my pawn and then I'll take this pawn instead. Or he might he might play here and ah there's some crazy complications, right? I Okay, you know what I'm going to do instead of that? I am going to let's say I'm going to take this, right?
And he's going to pin himself.
Take take and pin yourself, boy. God, this is going to be crazy.
I don't know. Okay, so now he's pinned just like that. But if I take here, he would take me back. So instead of that, I'm going to apply pressure to this pin piece.
Oh god, this is crazy.
But damn, I cannot I cannot like I I cannot um what's the name?
What's the name? I can I cannot castle queen side.
Ah, that's that's that's that's bad.
That's actually bad cuz now if I do anything here, I'm going to be in trouble. So, you know what? I'm just going to take back this so that I can castle queen side. I don't want any trouble. I don't want any smoke.
I I don't want any smoke, bro.
Yeah. Okay, fine. Let's just um But wait, if I castle now, he's just going to take my my knight instead. And that's not what I want, right? So, I'm just going to take his bishop, but just going to take the bishop. It's fine. Take take it back.
Take it, boy. Yes. And now, let me get the chance to castle. And I'll open a discover check. Oh, no. No, not actually a discover check. I thought Yeah, discovered check. And the queen is dead.
But it's okay. It's fine.
H I think there are chances to have a discover check here. Yes, there's actually a discover check. He has to remove the queen and put the queen somewhere safe. Otherwise, the queen is dead. I mean, not the queen, but the knight. If I take this knight, he can just take back mine here, right? That's crazy.
All right, that's a discover check on the what? On the queen. I should have put it here, dude. Didn't even Oh, what?
Why? Come on, bro.
What? What are you trying to play? I I don't understand.
Let me just protect my bishop. You take my bishop, I take back your queen. And it's a loss for you, my brother. But I'm just going to check here. Check. Boom.
It's going to get cooked right now, bro.
You try to defend here. I just take it both.
Oh, wait. So, he's saying if I take his queen, he takes my queen.
No, boy. That's not what I want. I'm just going to check you here first and then I take your knight for free. God damn.
Oh my god. Not for free cuz he can take my knight back though. That's crazy.
What if he defends with a bishop though?
Yeah. I'm going to be in trouble, right?
Yeah. The kn defense of the bishop.
That's a problem again.
Ah, I didn't want to sign up for this problems. Well, let me just take this free pawn. Is it a free pawn? Oh, I fumbled something.
Did I fumble something?
Hey, somebody should tell me if I fumble something. I don't know.
I usually fumble a lot though. But let's see if I fumble something.
Oh my goodness.
So, here's the thing.
Um what's happening? This dude is threatening checkmate, right? Which is crazy.
Dude is threatening checkmate. But um that checkmate won't go through cuz I'm just going to play here and put pressure on your queen. Now you have to get the queen out of there.
And I'm going to cook this night.
I think he's going to try to like um I don't know something like attack me here. I don't know.
Bro, what what's this dude doing? Uh, this dude wants to take this, right?
But I'm going to defend it like this and threaten checkmate. So, yeah, this is Oh god.
Is it all cooked?
This gu is cooked. Am I This guy's cooked though.
This guy's cooked.
This guy's fried. I think he's going to resign.
He He's going to resign. Facts.
He's going to resign.
He's going to resign, dog. I know. I know for a fact this guy's going to resign.
He's thinking, though. Let's see.
I think he didn't notice that I I had taken I had protected my bishop, right?
So, he go here to this and his queen is GG.
Yeah.
So, what's the point of uh trying to attack me?
Okay. If I take and then he's just gonna take me with the rook, right? But brother, brother, you can take this.
That's not my point. My point is I want to checkmate you. For all I care, like literally for all I care, you can you can have this. I don't care.
I I don't really give a [ __ ] I do not care, bro. I just want to checkmate you.
Hey, goodness. Somebody's going to get cooked, fried, toasted. I think you saw it, right? But does it change anything though when I can just play like this? Okay, actually it changes a lot.
Um, let's see.
If I eliminate this, he he would take it with the knight, isn't it?
and it won't help his position out. So, I'm good.
Um, what what are you trying to do, brother? You want to take this and I can just take you back? That is stupid, actually.
Let's see.
So, that was it.
Like that that was that that was your best attack.
See, dude is trying to attack me, bro.
Like, come on. Poor dude.
All right. I think he actually has a point. Uh, I'm not going to lie.
He has a point.
Let's see. If I play here, I'm going to be in trouble still. So, let me just see what he's cooking. Um, he's actually just threatening this, right? So, what I'm going to do, let me just go here and save my princess.
So, he's going to take this and I'll take him back. And yeah, I don't know, bro.
All right. I think I don't even need to take that.
Let me just take it. It's fine, bro.
He's going to take this pawn. Oh my goodness. I'm I'm I'm almost going to be in trouble, though. Like, I have some back rank issues. I'm not going to lie.
I have some back rank issues. If I'm not serious, this guy's going to be a uh he's going to checkmate me. So, let's get the hell out of there. Let's open some loft. I think makes sense or there makes sense. I don't know.
If I put this, if I make a mistake to put here, I'm cooked. So, let me just create a way for my queen, my king to run away.
Let's go. Yes. No background issues.
Remaining the time to cook you now.
Oh, mate. You're cooked. Check. And you're tossed.
You're toast.
I'm toasting this guy.
Toast.
Okay, that doesn't matter, brother. Cuz guess what? I have another check, I think, if I'm not mistaken. Check. Let's see what is going to play next.
Okay.
Uh what else?
This is on here, right? So, if I check here, check I take this.
This This is in trouble. Big trouble.
If he goes here, it's cooked.
If he comes here better, right?
Oh god, this guy is toast.
Toast. Should I really finish him, bro?
No. I'm I just want to clear this rook and that's it. Call it GG's. Let him resign.
I want this guy to resign. So, let me go here.
GG's.
Yeah.
Go down, boy.
to.
All right. This guy is is trying to prove to be a hard Yeah. What next? Now, bro, this is starting to annoy me now.
Let me just push him to the wall.
Go to the wall, my boy. Hey, what?
Checkmate.
Wait, it's not checkmate. How is that possible?
Checkmate, bro. What? How's that not checkmate yet?
All right. Now, this is checkmate, bro.
This gu is running way too much. Calm down. God damn.
All right. Um, bro, hold on.
I think How should I checkmate this guy? He can't go like this, though. So I just have to come here and say hold on the only thing is where can he run? Yeah, this is stopping me from doing what I want. So let me just stop that. See what's going to play again.
Yeah, now this GG. God damn.
He can't go up here.
and uh BBS.
Okay, >> DJs.
This guy is running like a headless chicken.
Oh my god. Check.
Check.
Yeah. Right. What in English?
Oh, this is annoying me. I swear. But I think this is checkmate.
Yeah. Come on, bro. This is not checkmate yet.
Ah, how do I checkmate this guy?
How do I checkmate this guy? He keeps running, bro.
Oh, I need to p him down.
Come on, bro.
Yes, I knew it, bro. You have nowhere to go now.
Finally.
This guy is so annoying, bro. Why are you so annoying, bro?
All right, boys. Uh, that's going to do it. But I I think I'm out of here. Uh let's call it a day. We catch up tomorrow, bro.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 views•2026-05-28
How agent o11y differs from traditional o11y — Phil Hetzel, Braintrust
aiDotEngineer
450 views•2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanation💯✅
LearnwithSahera
1K views•2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 views•2026-05-29
Search Algorithms Explained in 60 Seconds! 🤖💨
samarthtuliofficial
218 views•2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 views•2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 views•2026-05-29
🚀 BCS613C Compiler Design | Module 1 to 5 Schema Evaluation 🔥 | VTU 6th Sem 💯 #VTU #bcs613c #exam
Pranavaa-y4y
104 views•2026-06-02











