Join Jeremy Chone for an interactive, unscripted live-coding session focused on practical software development and programming exploration. In this ad-hoc livestream, we follow a real-time development experience, exploring coding concepts, technical problem-solving, implementation approaches, and software engineering practices as they emerge during the session. Unlike structured tutorials, this format offers a more spontaneous look into the developer's workflow, providing an opportunity to observe how programming challenges are approached, ideas are explored, and solutions are developed through hands-on coding. Whether you are a Rust enthusiast, software engineer, or developer passionate about continuous learning, this session offers an opportunity to experience practical programming beyond conventional tutorials. What you'll explore:
Real-time software development and live coding.
Practical programming techniques.
Software engineering problem-solving approaches.
Exploring development ideas and implementation strategies.
Learning through spontaneous coding sessions.
Audio and video play straight from the show's own hosting. PodSubs stores and serves no media.
Transcript
From the show. Tap a time to play from there.
Speaker 1Okay, I should be live. So I'm going to do a little bit more live here and this one should be public. I've just realized that I still need to learn how to do lives. I'm used to do this edited kind of things and I have all my workflow and on the live, I kind of get confused a little bit. So I'm going to put this live public, such as people can show up and I can actually understand how it works. And then I will archive it for the live stream members only. So this way the
Speaker 1live stream will get this value back. And then I will also do some scheduling of videos and those will be only for the live stream members. But my plan right now is to do this when I want to do something. And today I'm going to code my Rust web app and I'm going to change sha-512. for the hashing of the token to Blake three. That is going to be my goal. And so I'm going to do that.
Speaker 1And my goal is to do this kind of live coding. And I'm going to put that for the live stream members. And for now it's going to be public. So anybody can jump in and I can learn the tools here. Okay, so I'm going to share my Rust web app. So that is a Rust web app. And that is, if you go there, Rust 10x. This is what we have
Speaker 1over there. So if you go to Rust 10x, it's also on the Rust web app. You go there, and that is a Rust 10x Rust web app. So that is what we have as a repository for production Rust web application. So that is what I'm using for that. So now that we have this, we are going to go back to the code. We don't need the web browser anymore. And the way it's organized here is by libs.
Speaker 1So that is kind of the architecture here where we have our auth, our core, the RPC core, and then the utilities and the web. And the goal here is to have my services, and right now there's only one, which is my web server. So that is the things. And today I'm using argon2 for the password encoding. So if I go below my libauth, I have two things here. I have the pw and the token. So that is basically the crit, the libraries that I'm using in my
Speaker 1web server, in my RPC to do the authentication. And so that is using pw, the argon2. We're going to keep it this way and the token is going to is using today SHA-512 for the hashing, and we're going to use Black3. So if we go back to a little bit, let's show the architecture. This one is going to be a good one. So I have this, I'm
Speaker 1using Sketch app, and This is, sorry, Tucson. So that is basically the architecture that we have, more or less. It might change a little bit, but no, I think this is more or less that. There's a little bit, one more lib web, but this is what we have. So we have this architecture, and then we have the auth, which is used by lib server, web server, where we're going to change. And today here, the way it works is,
Speaker 1I don't know if you have seen the video of three hours here, but it's a long one, is this one. And that is the one here, which is the authentication. So we are assigning the username on API login. And that will do the login and then it will create
Speaker 1a token. The token will have this format, which is similar to JWT, but it's not JWT because JWT might be good across systems when you don't own the system. But once you are back to your system, we don't need JWT. And in fact, there's argument to say that JWT has some inconvenience from a security standpoint. But it does work, but there's a lot of noise in JWT. But one of the good thing of JWT is this
Speaker 1kind of things where it's a base64 URL with a dot separator. So that is pretty neat because it makes this token very portable. You can put it in cookie, you can even put it as a parameters in the URL and everything. So you can even use this pattern to sign URL if you want. So right now we're using that for the signature. And the signature here, this guy, when we have a token sold, so we have, a salt or a key, which is global, plus a user salt. So that makes the password and the token super secure. Yeah,
Speaker 1probably more than most banks or whatever. So the thing is, we are hashing these two guys. So that is the identifier, which could be the UUID or could be anything else. So I think in our case, it's a user ID, but could be UUID of the user. It doesn't really matter. And then you do dot, and then you have the expiration date, which is the only thing that matters. And then you have the signature. And that right now, we're using SHA-512. My goal is to use BLEC3, because BLEC3
Speaker 1is awesome. And I'm going to explain a little bit why, but it's very fast and it's as secure as SHA-512, and then we can use it also for other stuff. So it's a cool stuff to do. And also I'm going to show it how we're going to do it without... without, it's not going to be intrusive in the way we're going to do it. So that is the benefit of this approach here. I'm like moving my chat here to
Speaker 1make sure if people are chatting. So feel free to ask questions. So I'm still learning the live stream here. I think that I've learned yesterday when I did the video is that I shouldn't ask question and wait for the answer because it makes the whole thing very frustrating to watch because there's a delay. So then I wait for like 20 seconds, it's just silly. But question is always more than welcome. So feel free to ask anything.
Speaker 1So that is what we're going to do. So now where does this guy here is in the code? So if I go back to the code, so we have this architecture here where we have the libcores, the librpccore, which is a core thing that does the RPC, libutils, libweb. So this is that, and inside that there's a source, and there's a password, and there's a token. The password is using argon2, so if we go, you know, this guy over there, we're going to see an argon2. Oh,
Speaker 1we have the scheme, yeah? So we have a multi-scheme, I will explain why that later. It's part of the video of three hours, but one thing I'm going to do in 2025 is first I'm going to spend quite a bit of time in the Rust web app to update it, make it more, I'm going to make it multi-tonnant, multi-org, and I'm going to add quite a bit of things because actually I have clients now that are following this pattern, so I'm working with them, so I want to share that with everybody. And so we can see here that
Speaker 1on the scheme two, we have this argon two. So that is a multi-scheme kind of thing. In the token stuff, we do not have a multi-scheme. We don't really need. Eventually, we can implement it, but we don't have it. And the multi-scheme, I'm going back and forth, sorry, but there's a lot of information. But the multi-scheme is these kind of things here where in clear, so that is fully hashed in the password, obviously. But the goal of the multi-scheme is that... Okay. But the goal of the multi-scheme
Speaker 1is that it allows us to have a version one and a version two of the scheme. So version one was with big crypto. I don't know if it was big crypto, it was 512 or whatever. And then version two is with Argon. And so that allows us in the database to make sure that we're still allowing people to log in with the version one. And then as soon as they log in, we automatically update to version two. So we have this progressive kind of way to upgrade
Speaker 1the user without bugging them. And obviously we can shut down the scheme one and then they will have to do the stuff. Any advice on mastering Rust? Learn well, don't learn fast. Yeah, that is the thing. Take your time to learn it. And if something doesn't click one day, keep it for later. It's fine. I mean, for me, sometimes I get confused. There's one thing which was very
Speaker 1embarrassing for me. It's just me. It's little details. It's like four weeks ago whatever, I had in my Gen AI things, I was using an option of vect because I thought that I read somewhere in some code and I remember the comment and to say, you know, one word or two words is better than three because I thought that a vect was larger than an option. So I was like, oh, if I really need a vector, then I'm going to wrap it into an option because it's going to be more performant. And that is a myth.
Speaker 1I was completely wrong. So I missed it. I mean, at some time, I should have read it somewhere, but I missed it and it's no big deal. And so the point is, don't get too upset if you don't get things, understand what the language is. And my advice is at the beginning, when you do your functions, try to take reference. When it doesn't work because you have multithreaded or async, then put stuff in arc, yeah, to
Speaker 1not get too crazy about having your struct with reference. In all my code, and I'm starting to have a lot of code, I have very few struct or enum or whatever with references. So usually you get around pretty well and the arc, it's a very, very efficient way of wrapping things. So when it's inside arc, it's becoming immutable, but that is good for most of the case. Yeah. And yes, I think, well, so I have a video
Speaker 1on how to learn Rust, which is pretty good. You can go to my YouTube or you can go to Rust 10x. I have it there sometimes. It's faster to type. I have, sorry, I'm getting slow here. Five Steps to Learn. So I have five steps to learn. You can find it on YouTube as well. So you have these five steps to learn. And those are, I should have a top video, the one that I recommend. And this one I recommend quite a bit is the way that I learn.
Speaker 1And we're going to see that in the live stream. I have this whole thing with the XP and all this kind of thing, XP programming and stuff. So we'll look into some of these practices, but that is quite a bit there. And then the other, if there's only a few videos you watch, this one is the five ways to learn and the nine best practices. So there's a version one, version two, and version three over there, and then the error best practices. So those will be the four videos out of my 96, if you don't
Speaker 1have time to watch, I would recommend. But thanks. And now I've lost the chat. No, the chat is here. Okay. And yeah, and so in this video, the five step to learn, I'm saying that for me, even me, I didn't read the whole book till the end. So I read up to six and then I read kind of as needed. This is a great book, which I haven't read completely. And, you know, it's from Maria, I think.
Speaker 1Maya Bose, I'm sorry if I misspelled the name. It's a great book about concurrency and stuff. And this is one of these Bible books where every time I say, you know, I need to spend more time reading it because it really explains it. But those are very advanced stuff. The thing to understand with Rust is you don't have to master the whole beast to be very productive. You have to embrace it in a way and not fight it. So don't try to mimic inheritance, you know, with trait and object trait and all of that. But once you
Speaker 1embrace it, and you embrace the trait model and everything, so all of those are good, and you embrace the type system, it's actually getting very productive after a while. OK. Yeah, OK, yeah, yeah. Thank you a lot, yeah. The error-based practice. And it took me a while, yes, because I have a video which I don't know if I, well, I shouldn't say. Well, I'm going to say it. I say everything I think anyway. I have this video here, which I love the thumbnail.
Speaker 1It's a very cool thumbnail and stuff. And it does very well. And it's a good practice, yeah? But it's not the modern one. So I need to do one of these video for 2025 because there's stuff here that I changed, a prelude is the exception now, it's not the rule. So there's a few changes here that I need to do a 2025 version of the quick start. but until now the four videos that i mentioned is a little bit you have everything that i would have put in this new quick start okay so um now
Speaker 1let's go and okay now we're back to business so what we want is to be able to do our black 64. And so I'm going to cut it with you here as I would cut it for myself because I didn't pre-cut it. So sometime, obviously in my videos, I pre-cut things such as it's very smooth and very efficient. In this live, I'm deciding to go a little bit more kind of live and share more. Yeah, that is, I think is a point of the life. And so
Speaker 1what I'm going to do is go back to my code, sorry. And when I go back to the code, I lose... I have this chat box here that I'm losing sometimes. It's weird. Let me do this. I'm sorry. I'm still learning my little workflow with live and stuff. Where to
Speaker 1put the chat and everything. There's so many options between OBS and putting the browser and stuff. But now I think it's good. Okay, so now, this is where we have the password, this is where we have the token. In this crate, I decided to have an error pair submodule for all these guys and error for that. Usually I have an error probably for libcore, no, actually no, libcore,
Speaker 1I decided to have an error here for model and an error for context. And they don't even cascade back up because the libcore is a utils that I'm going to use somewhere else. So I don't need to have a libcore like all errors because I will use either context or model. So that is a thing. I haven't articulated here this rule yet, but at the high level is usually I try to not have too many errors down the stack. stack or the tree because otherwise it's
Speaker 1a pain to go back up but at the same time i don't need to go back up all the time to the crate or to the lib because then it doesn't add value so there's a judgment call here to say which level and you know it's always a judgment yeah nothing is perfect so in the token here we have our error here which is basically if something goes wrong here so here i see that we have the hash mac guy so we're going to have to probably add errors Related to Blake, I guess. And then
Speaker 1I have the mode here. So I like my code region business. So I do a close M1. I have the modules. I have the token type. And then. Okay. And then wait a second here, I'm going to try,
Speaker 1I need to say something. Okay, okay, I'm back. I'm
Speaker 1sorry about that. There were big noise coming here. So, so I managed and managed it. So anyway, so now, yeah, I'm still here and everything. Okay, good. So now, what I have is the modules, that is where I import all the modules and so on. And then I have my token types. So sometimes I organize my code like this. So let's see like that I have my token. And then the from string from the parser and everything. And
Speaker 1so the token that I have is the indent, which is the identifier. So username or anything. I have it string here because what I want is to have the maximum flexibility. Again here, the goal here is to have this guy here. This is this guy. In clear, yes, obviously. This is why it's in clear. And base64 is clear text. It's not encrypted or hash or even obfuscated. Base64 is always clear text. It's just that it's a portable one
Speaker 1in a way. And then expiration. So that is the expiration in RFC 3399. I might change that one of the days and to put it in Unix time, UTC, millisecond. Because the number is large enough and it's easier to have a number. But right now it's RFC stuff, which is perfectly fine. So again, those are very implementation details.
Speaker 1It doesn't really matter. And then after we have the signature in base64. So in signature is always in B64U, so that is my base64U error, because there's no value whatsoever to have it in clear. You want to have base64 and then the algorithm that does the signature gives a base64U and then you just compare those, it's a black box. So now that we have this, if we go to our code here, we have our token here
Speaker 1where we generate the web token and then we validate the web token and the validate web token here is going to use i'm sure inside this size a long time i didn't try that but i'm sure that if i go there i'm going to have this guy yes this token into sign which is probably the same one that i have somewhere this one yeah in this file back in those days what i did is i did
Speaker 1this underscore for private i'm not happy with this stuff yeah so i had it there it looks weird in russ because usually when it's underscore is something that is not used they are obviously used so i'm going to leave it for now it's just that uh yeah they are just private and i don't think i need to have the disease sanction So I'm going to make the commit just for black 64, black three, sorry. And then probably I would change the name here because that was a step. What I do often in my code. And
Speaker 1so like everybody, you know, have their own techniques, but I have some best practices and then sometime I have best practices that I experiment with because you don't want to be hard-coded in the nineties. I mean, I've been coding for a while. So the trick is that we want to have a way of saying Well, you know, here I'm going to expand them in this pattern here. I'm just going to narrow it down to this little kind of sub modules or whatever. And then eventually if it gets better, then I can broaden and adopt it later.
Speaker 1So that is where I do this mini experiment. And that was one of them and that I need to clean up because I'm not happy with it. I hope that makes sense. Yes, this code is public. It's actually, I'm going to try to say, I'm going to try to show off here and say Rust web app. Not that good. Nope. So now we do a Rust 10x
Speaker 1web app. Okay, now. Okay, Rust 10x. Okay, that's good enough. So Rust 10x web apps, you go to this repo here. That is there. That is a commit. And I started to redo some cleanup there, and that will be a commit that we're going to put there. So hopefully. Thanks. The goal of this architecture is much bigger. It's eventually, this is a web app, which is going to be
Speaker 1in that. So my company is Brysno, which is spelled. I don't want to do a plug, but yeah, I'm going to do a plug. But there is where we don't have to have shame anymore. And so we are Brysno here and then we do big app and stuff. So we did a big app in the model stuff. That is just like a video to explain some stuff. But we had some big clients and we had a full stack and everything. And so we have been doing that for a while now. We do big app architecture services.
Speaker 1And so what I've done is we have a blueprint. And back in the days, we had Java on the back end or Node.js TypeScript on the back end, and then TypeScript and CSS on the front end. And we have these whole things which allows us to do big application with small teams, basically. And so the architecture here fits here. So you have one of these web server, that stuff. And the goal is to have pair system, not a crossword system, but pair system. So that is a system. And pair system, you have a monorepo. So
Speaker 1this is why we have libos, libwhatever, and things such as we can reuse the libraries in different services. So that is architecture that we have in our code. This is why it's split like that. We have only one, but we have the libs here and we have the web server here. So that is a web server one in a web server A. And then eventually we might have an IT server or something for the DevOps. That doesn't stop. Hopefully that has been a little bit. So now,
Speaker 1now I'm not implementing as fast. I will do it normally, but it's fine. But continue to ask questions. I really like it. This is why I actually starting to like the live business quite a bit. And... So now the thing I'm saying is token sign into thing. So that is what we want to change. And so if I click here, I should see some SHA-512. Okay. So we see some SHA-512 and that works. So typically the way
Speaker 1that I'm going to change that is for the unit test or integration test. I don't want to get too deep into that, but I'm trying to I'm not trying to have 100% code coverage because that is management numbers. What we want is to avoid management numbers or metrics. We can educate management. I mean, often me in the company, I'm advising and part of the management team, but there's an education of management. It's not because a higher number
Speaker 1is not always a better number. It's better to have 20% of, test coverage of testing what can break over times and what matters than 80% of one plus one equal to. So the thing I'm saying is to say there's a balance here of that. And usually for me, I always, I feel always guilty that I should add more tests. But the goal is always make sure that I do the right test. And yeah. Okay, this is
Speaker 1a good question here, but I'm going to come back to you here. So what is the difference between your web servers and your services architectural model? The service basically internally available web servers and more like libraries. I'm going to answer that. So before I'm going to change that, I could have written this function here and it works and because it works and I tested with the other test the things, I would have been happy and perhaps
Speaker 1I didn't have a test for that. But now that I'm going to change that, what I really want is to test this guy here or test the function above. I don't need to be too granular and saying I need to test every function at once. If you test the one above, I'm fine. So I'm going to see here in my code if I have some tests. Luckily, I have some. And this is where ROS is amazing because you can have tests like that that are private and everything and become super nice. And then we have the test token display. So let's see if I can
Speaker 1do that. Test token from STR so that we, I don't know if we really care, but then we're going to do this guy here, the test validate. Okay, so we have two tests, one that tests the okay and then one that tests the error. So that is our, the two tests that I have. And that's my pattern. Usually I'm trying to have this name more or less kind of unique, at least per crate. And then I
Speaker 1have the noun, the big alien kind of things. So I have cargo watch or I have bacon, okay? I did a video on bacon, which is bacon is awesome for run. For cargo watch, there's a catch that I realized a little bit after the video, which was that with bacon, I mean, there's a catch for watching test. Sorry about that. And the reason is because even when you say no capture, because you want to see the print,
Speaker 1then bacon is doing very smart stuff for people that are not doing no capture, but me, I like to do the no capture such as I don't have to, I can print it in, this is my way. And so sometime now I still use cargo watch. So I have this kind of things here where you do cargo watch test. And if you have seen my video, this is, I have a things here. So that is going to do a cargo watch test. dash quiet i think dash
Speaker 1clear dash x test you know something like that and then depending of what i give it will it will do the no capture and stuff so i do a cargo watch test that is an alias and then i'm going to do a test validate and i'm going to hope it works because otherwise we're in deep trouble that is going to compile everything okay so now it test everything,
Speaker 1which is not super cool. So what I want is, I might want to do a manual one. So this is live coding here. So I'm showing you really much what I do. So my cargo watch test is not designed yet to test per lib. So now I need to know what do I need to do to do a cargo pair for a given lib. And I think,
Speaker 1I might have it there. Okay, cool. Hey, not too bad. Okay, so this is the thing. So that is the one exposing. So my cargo watch thinks it's a shell, a zip shell, and then it doesn't have the cargo watch. So I'm going to do this guy, and then I want the no-capture. No-capture.
Speaker 1And then that is a libauth. It's not this guy. And then after, is this guy. So there's one thing that I spend quite a bit of time when I develop. I develop in a way that iteration is always king. Yeah,
Speaker 1so even if I spend like few minutes and stuff to make sure that I can iterate very fast on that, I spend a few minutes, the 15 minutes, 30 minutes or whatever. It doesn't really matter. Because my point is that I want to make sure that I can iterate very fast on that. And usually I capture that and I put in my notes on the real message as I can reuse it later. So that is my goal. So I'm going to press stuff and then what I want, hopefully,
Speaker 1is that, yeah? So that is exactly what I want. It does the stuff. And then if I press save, it should replay it, which is exactly what I want. So now I'm happy I have this. And then the next step that I will do here, so I'm there, and I'm using my Rust 10x extension. So if you go to Rust 10x, and I think I have... something
Speaker 1here link but it's on vs code yes so you put rustnx so it's this extension here the rustnx extension and there's a set of snippets that i'm using and one of it is 1p for the bug print okay so this is what i like to do i put that i make sure that that is there and i want to see that and the reason why i do the print like that is because then after i can do a search here and then i make sure that i remove that before any commit That's my way, I'm like a print developer. Some people have very strong opinion.
Speaker 1One way or the other, I don't have. I'm just, I like to develop with print. So now I do this one here to go back that. And now what we want is that we have that. I'm going to go back to the, So I'm going to do a search for token signature and that is the one I
Speaker 1think when we use a SHA-12 and I'm going to do something like that. Result. So I have this, and so this way. So I have two tests. For one reason, I probably have a for loop. That doesn't matter. And that is basically the base64 URL of whatever the bytes change.
Speaker 1I'm going to answer the question here. What's the difference between your web server and your services? I'm going to answer very quickly. And again, there's going to be a lot of lives and videos on that. But a web server for me in this architecture, that is a cloud architecture. A web server take input services, RPC services. And yes, REST for me is RPC. I'm a big fan of JSON RPC, which is just HTTP POST with JSON and
Speaker 1the normalized way of doing the POST for everything. You can use REST, doesn't really matter. You can use gRPC, the same thing. So you have the front facing kind of services that take calls from others. And then you have the backend services here on the backend. The difference between the two is those guys take RPC calls on REST. And then those guys, they typically, you don't want them to take RPC calls. The way that they all communicate between each other is via the bus. Send an event
Speaker 1to the bus. This guy reads the stuff, reads his job, does his job, put back events, and then kind of get back. He can update the database as well. He can update S3. So everybody has their own little responsibility. And they know how to update these kind of things. Guess what? Because they do have the call. So in these services, this is why, I'm sorry, this is why we have this architecture here to move it there. But those services, which will be, for example, video scaler, if you want to scale a video and stuff, they will
Speaker 1know how to talk to the database because they will have the core and stuff. So rather to have a whole ping pong and spider web of services that talk to each other and JSON RPC and having meetings about all this event, about all this message and stuff, You have an event-based, and then every service says, you know, when there's a new video, my job is to make a 480p video. And then I send an event to say, hey, 480p video already there. And if someone takes it to do something else, it's their problem. It's not the problem
Speaker 1of a workflow map somewhere or whatever. So every service can feed themselves. That is a little bit the architecture that we found by experience that scales very well. And that removes a lot of problems that we don't have to have after. So now we go back, I'm not sure what I'm going to do, and I want to use the Blake kind of thing. So the first thing here, we're going to do to the crates.io, and we're going
Speaker 1to do Blake3. This is a guy we want. Yeah, it's a very cool library here and everything. So this is all the beauty here that everybody likes. Usually, you know, it's good for performance and stuff, but it's also a good library. The beautiful thing about Blake 3, and I've used it as well, is that now when you are trying to, you can, what's the name? You can use
Speaker 1it as an MD5. So now people are using SHA-512 or whatever they're using it, yeah? But if you have a big file and you want to pipe it through Black 3 to have a unique hash for it, Black 3 is amazing for that. Super fast. And so that is kind of a big game changer, at least for me, because even in AI and everything, you want to see, even if a block of text is the same or whatever, or they have changed, and Black 3 can be amazing
Speaker 1for that. So this is why I'm a big fan of it. First thing here, we do this usually, usually I like to do that and go to my cargo. So the black three here will not be something, at least for now, that will be shared across everything. It's just a lib os kind of thing. So I'm going to put it there. So here, not now, but sometime I have some stuff that are workspace, you know, when they make sense. Otherwise I put it there. So I don't put everything in the workspace. I just put thing
Speaker 1so we're going to put the black three over there and then we're going to see how it works and it works like that so we have the hasher we do the update update and i think that that is so that we're going to use this guy because again we have the hash yeah we have the global hash and the token hash so that is what we are
Speaker 1going to use that and then I think that is pretty good so I'm going to use that and often in libraries you know if they don't have I mean this one is very well done now I think this is good so I'm going to go back on my mode And then... so that is a way sometimes I
Speaker 1do it so we're not changing that yeah so the decision here is we take the one dot the second one and then we we hash it And so we're not going to change that. Here we have created, you know, just a hash max. So that will be the equivalent of this guy. I think. And then we are adding the content and the sort. So actually right now we
Speaker 1just have the sort. We don't have a global sort of this guy. We don't have a global sort. No. So sometime what I have as well for token and stuff, I have a global sort. So this is a global sort in the EKS stuff plus a pair user sort. A pair user sort is plenty enough for a token. So now I do not want the full bar bias business.
Speaker 1I'm going to just do this. And I think that I'm going to press save. Compile is great. And then I'm going to take this guy here. That. So I'm not changing the structure of the code. Sometimes if it's badly done, I do it. OK, so here is something
Speaker 1here that is not into bytes. So that is a hash. I think I remember that. As byte, so far so good. And then that's it. I think everything works very well.
Speaker 1So we change the step. I have a command u by the way to toggle the inlays. Because I like inlays, but I don't like them most of the time. I just like when I ask. It's a little bit like the autocomplete with Copilot. I do have Copilot, but I'm telling him when to start. He's not telling me. He's not the boss of me yet. so we have that and i think that's it and so we have the token it's good to me and uh obviously it's hard
Speaker 1to say yeah but it does look basically for url and stuff and the the test didn't fail so now the only thing i need to do is clean up some clippy so i have clippy by default sometime Aha. Interesting.
Speaker 1So now the reason here why I'm confused is why didn't have this warning before? So I might have forgotten something. So one thing I like to do, I but a very cool thing which is fork and i know that vs code has the source code here this one might be hard to see there's only a problem here this one is you cannot but i like this guy here where i can go and see what i had before
Speaker 1I think there's a better way with VS Code to do that, so I'm sorry, guys. We'll learn it later. So the thing I don't understand here, I'm going to show you here and stuff. So first of all, I love Clippy. So this is one of the reasons here why Clippy is amazing, because it gives us these little warnings here. And many times these warnings, sometimes it's just code cleanup, and I like to have clean code as much as I can. Um, but also, um, I like
Speaker 1it because in this case, for example, is why we didn't use a key. It doesn't make sense. Yeah. It's not that we run the business of using keys. So there's something here where. I'm not sure why I'm why before he didn't complain. Yeah. I don't remember that before he complained. So I'm going to check this function here. And unfortunately. No, before we didn't use a key. I'm sorry,
Speaker 1it's a little bit small. I'm not sure why before I didn't complain about the key business. So this is where we're going to add a key. Yeah. And the
Speaker 1key doesn't have, I think there might be a way to seed it and everything, but the key is almost like a salt. Here we're not hashing a password, so it's completely fine to do like this when you update multiple content. And then the goal here is to add content such as it's getting hard for people to do the stuff. And now if we go back there, everything should compile nicely. Okay. Now we have some imports here that... are not needed that makes sense we don't need those
Speaker 1guys and then if i go back to my token validation i don't need that current breakthrough hasher ah it's from key here and does it have a from key guy okay oh look at that okay so perhaps before
Speaker 1here this is what i missed before my little fork here okay well i'm not going but i think that before we had that so is we're going to do this this is why it's important to have comments so we do that and it's not might be okay it's
Speaker 1not it's not going to work we're going to keep that there not from key because FlexWiki is fixed length, I think. I might be mistaking, but I think it is. What do you think is better for a beginner to
Speaker 1write his own authentication authorization system or use a third party? Yeah, so depends of how beginner you are. For us, we always write our own. It's a whole, so there's a trick here. One thing we don't want to be in the business of, I do not want to be in the business of because I don't have the brain for it, is to write the Blake three algorithms, the SHA stuff. I'm not a math guy. I don't know if you need to be a math guy to do this stuff, but that is not where my brain is at. So
Speaker 1I'm not trusting myself to write a Blake three, SHA 12, Argon two, and things. I don't have the expertise needed to write those guys and to see which one is stronger than the other one. I just don't. So I'm trying to make a judgment with what other people say, which is always very dangerous, and then that's it. Now, what we're doing here is not like security stuff, yeah? It's like the GGBT people say, well, you shouldn't, it's a little bit silly, yeah? What we're doing is to say, hey, we have a hashing thing, yeah? Some very smart people
Speaker 1give us Bcrypt or Argon2. We know how to hash a password. And then we know how to hash a token. It's basically take a string, whatever you want, and then you hash it. And then you make sure that if people, you validate that that match the hash of that. And it's always the same thing. So for me, it's very important, I think, to understand what is, a session or a token and everything and write it yourself. Because when you
Speaker 1try to rely on those kinds of things, I mean, I'm migrating right now, clients out of super base, crazy stuff. Because they become black box and they say, hey, we make it easy. For me, easy is evil. Simple is a goal, but simple is hard. Now, we don't want to give ourselves too much of a hard kind of thing, so it's fine to use tools. Like for your own web server, create your own token scheme. I mean, I have the code here and then you can see it.
Speaker 1It's nothing. That's it. So you create the things, you create your unit tests, you know how stuff, you put that in the cookie. And then one of the trick is, for example, the cookie is HTTP only. So now it's not accessible in the document.cookies anymore. That is an additional security kind of thing because it's a black box. It's not the client business to know who the client is. It's kind of counterintuitive, but the client is, he said to the user, give the user a password. And then
Speaker 1there's this kind of cookie, if we are doing with cookie, we could do it with header, but cookie works well. A header would be trickier because when they would close the browser, come back, there's no mechanism to get it back. So cookie give us that, but then it's a black box. It doesn't, the JavaScript doesn't have to care about this token and shouldn't see it and shouldn't access it. So my advice is, you know, learn that, create your toolkit, send it back. And then if in your enterprise and
Speaker 1company you use Firebase and stuff, try to understand how they do it and stuff. But this is not, I don't think it's a good digression point. So now what we have is this, and then that's it. So I think we have done that. We're going to keep the... We're going to keep... Why does it do that? This
Speaker 1is tough. I can get stuck for hours on this. I don't understand why. Okay, it doesn't make any sense, but there's a bug somewhere here. I don't know why it has this overlay. So we're going to keep the SHA-2, I think. So what I do is I comment stuff out, press save, and actually it doesn't, it does complain because we're using it, oh yeah, yeah, yeah. We are using it in Scheme 1. Let's see if I'm good, yes.
Speaker 1We're using it in Scheme 1, yes. So in the Scheme 1, we use SHA-512, and then in Scheme 2, we use Argon 2. Much better for password encryption. Not encryption, by the way, hashing. So there were good comments somewhere where the difference, even if we could use encryption in both cases, but encryption implies that you can go back. Hashing is clear that you cannot go back. You go one way. And going back will be hacking, but the goal is to go only one way and make it
Speaker 1super hard to go the other way. So all of those techniques are hashing. argon tool for my understanding and again i'm not an expert but it's very proper for password because it's happened not often and you want something that is text times and you want the time on your side um on the token side you just want to think it thinks about collision or whatever to make something really uh cryptographically um sound or i don't know what the terminology is but um For what I've read,
Speaker 1Black 3 is as good, even if it's much faster than SHA-512, it's as secure as 512. So that is what I read, but if you have expertise, it's fine to have other perspective. So the SHA-2 here, we're using it on the Scheme. We could have done, that could have been a good use case. We could have done here in our scheme. And that is a beauty of
Speaker 1owning your own, back to your question, you know, should you own it and stuff? When you own it, you own it. And so if you, so for example, in some of our cases here, client cases, we have this case where we have long live token, meaning that, an application or something will be on the server side somewhere. And sorry, a token will be given like an API key. And we want this API key on this token to
Speaker 1have a length, an expression such as it can be checked offline. So without pinging back the server, we can check if stuff. So this scheme is very good. But now we can say, well, actually what I want is to make sure that I can improve the scheme and the algorithm of the hash. So here we could have the same thing here that we have for the password, where we will include into our little format of the token,
Speaker 1something like that. Usually you will just, I mean, either way works, but... And so the nice things about owning your token format is that now you can do this kind of things here when it's needed and stuff. And again, this token format that I put in the Rust web app can be used for URL signature as well. It's very similar to what AWS and everybody is using for URL signature. So you have an identifier, which is the identifier of the video, could be even the URL or whatever,
Speaker 1an expiration date, that can be checked on the server side and stuff, and then the signature. And then that can be Blake. And then when someone gets that, it's like, okay, I'm making sure that the expression is okay and that you didn't cheat it by putting something else. So that is something possible. So now that I have that, usually what I like to do is write my cargo examples. So somewhere. And again, feel free to ask questions. I
Speaker 1think I'm getting better about not, waiting for people to answer my question. So there's a delay. So I've learned that I cannot ask a question and wait for the answer because otherwise it makes it not very productive for anybody. So anyway, so now we have that. We have the thing. So I'm going to do a search. Usually what I do is a search like that to make sure I don't have my thing. I will typically do a cargo test, but it's a long... I'm a little bit afraid. It's
Speaker 1a long time I haven't done it, this stuff so it should work but we've seen that the token works but i i think i need to make sure that i have my docker so i'm going to start my docker uh no docker i think it's down oh no i hide it and then i go back to my readme and i'm going to inside my readme i have stuff to explain So we can run the Docker. So
Speaker 1that will run the database. So I'm running it into a terminal on the side. So that is the way I do it usually. This is a little tip and tricks here if you wanted to do a P-SQL stuff and things, it's pretty cool. You can create another Docker exec with, to the same guy, to PG. with a PCQL, such as you can have PCQL if you want. And that is a trick here where once you are there,
Speaker 1you can run that, and that you will get all of the logs of all your select statements. So don't do that in production, obviously, but in development it could be cool because then you see that in your little terminal over there. Now what we have, we're going to do two things here, terminal one. So this is why I have these two guys here. We have the terminal one. So let's see if I can do that like this. So we have the terminal one, we're going to do that.
Speaker 1So that will start the server. So that will create, that will watch only the server. So that is again, this is just the way I've done it. Just watch the server only with, and the crate leaves as well, and the cargo because there's some environment variables there. And then I do a run web server. So that is going to run the web server. Typically, that should be pretty good. Okay. And so that's good. And then on
Speaker 1the second one here, that up there, I'm going to run this guy. So that does the same thing. Watch only the examples. You want to make sure, because otherwise they restart and it's getting very tricky. And then you just run the web server. So the examples here that I have, I just happen to put them in the web server. It would be an argument that they should be somewhere else, but they are examples of web servers,
Speaker 1so it's fine. And then I put them. And usually I don't go too deep into it, but it should be log of true, so that's good. And then if I see data here, it doesn't complain. So that means if you look at the examples that we have, it's pretty cool, yeah? Because... And again, this stuff, I don't have it here, but eventually, perhaps on the web server, I will have a test to be able to test
Speaker 1the whole services. So right now, it's... It's no low man. I don't know, it's not low man. I've lost the American expression. It's a poor man's job of testing. This is a poor man's job of testing because obviously this is not testing, but it gives me a sense that that is kind of working. At some point, I'm going to have some testing, integration test, meaning that it's not
Speaker 1going to be within my lib. It's going to be here, web server, and not within the source, but we'll have test. and then we will probably assume that the server will be started before. There's many strategies about testing that will be a whole lot of videos. For me, I like to try to avoid the mock as much as possible and to test the real thing. In Axiom, you can test the APIs without going through the whole thing, which
Speaker 1is cool as well. And I haven't made a decision which one is better and stuff. There might be some very good case of using some internal test over there, using the Axiom way of not going through HTTP, but mocking the HTTP with the Axiom. I think there's a way of doing that. And you can always call the function, but it's not the same way. And then this way here, I will also do a normal HTTP access. Sometimes there's some variance here, and it's nice to be able to
Speaker 1do that. So here we see that we have the login. So the way that the example work here is a quick dev. So I have the new client, the HTTP test here. That is a little library that I did a while back. And then, yeah, I see your question here is Rocket Framework. I'm going to answer it. And please, anybody, I think we are close to one hour now. I don't know. We're close to quite a bit of time.
Speaker 1So I think I'm going to archive this video for the live stream members. And I don't want to make it too long. So it's probably coming at the end here. But if you have any questions, please ping them right now in the chat. And then I will answer them one by one. So it's a good time here to ask all the questions, even if it's not about Roads web app. And I will come to answer them. So now the point here is that we have the new HTTP, we create a new client. What this crate is doing
Speaker 1here is create a client with a cookie business. So this way it keeps the cookie like a browser, kind of, but close enough. And then I do a post here, login with my username and password, demo1welcome. And then I do the print. So that is another kind of convenient of the HTTP test. And then I do things where I create an agent and then, you know, I check that there's an ID and everything. So I did this whole little flow here of things where I create objects
Speaker 1and I come back. So the whole authentication works and the token works and everything, and we change it with Blake. So if I remove all the blabbing around, hey, step, I don't know who is step, is it Stefan or whatever, but French people always welcome, anybody welcome. So the thing I'm saying is, yeah, it's a whole little workflow kind of works and stuff. So if I remove my blabbing around, you see that doing the code for updating to Blake
Speaker 1was kind of super fast. So what I will do typically, go back to this guy, So I have this guy side by side. And then I do a git log to know where I am. So that is the things. I check that I changed the right thing. Sometimes I do... I don't remember how to do the keyboard here to do the GitHub stuff. But I check the GitHub to make sure that I changed the right thing. And then
Speaker 1I will do a git c. I have aliases of everything. And it will say... I put auth. I'm not, so I have these things, dot is minor, this things is upgrade, plus is a new things, and everything. So update token to black three. My goal of the commit is to do a commit pair functionality, pair upgrade, or pair things. Not to be too dogmatic or being too stressed about
Speaker 1putting the title because otherwise you add friction for nothing. But I like to have something that at least for me or for the team and everything, when we look at it, we can see, you know, relatively what it's about. So I usually take the name of what it's about and then what we did. What it's about, what we did. Okay. Try to put a dash sometimes. Sometimes I don't. It doesn't have to be too dogmatic. Just have to be informative. Okay, now that we have done that, I'm going to push it.
Speaker 1And you guessed it, I have a git push origin here, which is my alias. I have an always alias. And that is there. And if we go back into our Rust web app, you have it there. That is pretty cool. And that is our first live stream commit, which is pretty cool. Okay, now questions. I'm going to try to go to my Zoom stuff. This is a good... So,
Speaker 1what do you think about... No, sorry, sorry. Oh, is Rocket a framework? I'm a big fan of Axiom. I think they nail it down. I think the developer nailed it down. I work with a lot of frameworks in Java, in Node.js. in Rust. I did some video early on with Warp. I think the problem of the rocket and stuff, I mean, I haven't played too much with rockets and stuff, but usually frameworks that I don't like is frameworks that try to do too much. So for example, I like
Speaker 1frameworks like Axiom where even the cookies is not even Axiom doing it. So they have the middle tier and they have these things and then you have the cookie middle tier or whatever that you can So Axiom has these things, which is extremely well done for web server, which is the concept of middleware a la Rust. So it's not new. We had Java server servlets and filters, and then we had Node.js with Express with middleware. So it's all the same concept, but it's very well done
Speaker 1with the concept of extractors, such as it looks like, it doesn't look like dependency injection, but it has the same feeling of, The same characteristic of injection where you have a function and as long as you have the extractors, the data will be extracted and put back as an argument. So doing a endpoint, it's extremely convenient. And then they have also, yeah, so they have the middleware and the extractor model and then even the extractor for the body.
Speaker 1So I think they nail it down and they have the response wrapper and everything and the error system. They have a pretty good design with what is possible with Rust to be able to kind of catch it at the end and so on. They have the request context where you can add things to the request object and to the request response. So there's a lot of very well-made stuff where we can build our own things and our own workflow like this one, for example. Yeah, so
Speaker 1that is extremely, and you're not dependent on how a framework wanted to interpret the way to do sessions or to do whatever. Yeah, it's up to us. And so with some good patterns, you do it. So that is what I like in frameworks. I use Deezer to implement my model, but having a hard time. Yeah. So, user form, user, So I don't know what is a user request, user form,
Speaker 1user response. This is not my stuff. I don't think it is. So I use DSL to implement my module, but having a hard time when I have to rewrite different versions like user requests, user forms, user response. Yeah, for me, I do not like ORMs. I think they are a little tricky to use because And it's always the same thing. I had a video about this, about
Speaker 1the complexities. What do we own and what we don't own? And the problem with ORM is we are delegating way too much to the framework. And it's not the fault of the framework. People that are coding them are very passionate about them. They add a lot of functionalities and things. The problem is, even if we zoom out and we don't care about who does what, is... The responsibility is almost put at the wrong place. And then you end up with many ORM system being too hard-coded into your
Speaker 1data model and what the representation representation in the table should be and and so while it's good and i'm me i have um so i'm i'm using more sql builders yeah this one that i'm using right now which is c which is ironically the query builder that is used by CORM. So again, I'm not a fan of ORM. It doesn't fit my request flow, but I like SQL builder and C query is pretty good. It's actually very impressive.
Speaker 1It's cross drivers and everything. The problem of C query is that sometimes when you write complex query, it's become very hard to read compared to the equivalent in SQL. So then after the value to say, well, yeah, yeah, yeah, but it's tight. And then the other one is just string and string is bad and type is good. Yes, but if your type is unreadable, it's starting to get a little bit, you know, counterproductive. Yeah. So there's a balance right now. SQL is pretty good. I'm using SQL.
Speaker 1I had some code that I need to put open source with SQLite and stuff. And sometimes I just want to SQL. But I wrap them under the... the model, yeah, the model layer. So it's always the model controllers that give it. So from all of my application code, all of these decisions of ORM, SQL builder, you know, SQL, VS, SQL, it's the concern of the model layer. And so this is what we have in our code here. If we
Speaker 1go to the code here, which is our libcore, we have our model. And inside our model, we have this concept of model controllers and everything. So if we go there, we have the types. And then we have, so that is all the types, you know, confilter and stuff. And then we have the conf backend model controller. And then we have the macro to generate the CRUD, the basic CRUD.
Speaker 1And then we have also custom Function that we have and that is what can be bound to our PC. Yeah, so that is a thing And so these guys here in a way they are using, you know sequence. So if I go here Over there. I'm using some function and this is basically If I got this I don't have the I go this this is C query, I
Speaker 1don't have the model there, but this is C query, yeah. My organize my Rust API into controllers, model, serializer, services, query, and views is a trust way of doing it. I
Speaker 1wouldn't put views. I wouldn't put queries. The way that the Rust NX web app architecture kind of work, yeah, is that... Let me see if I get it somewhere. Yeah, okay, this one. I don't know why I didn't have it. Yeah, okay,
Speaker 1this one, I'm sorry, I'm making people seasick here. But the way that I have it is it's the model. So I have the model here, and that is where we have the model type, the model controllers, and we have the context, which is what the web is creating the CTX. And then the model is doing the one, is talking to the store. So nobody's talking to the store. Just the model layer. And so in the model layer, you have two things, the model controllers. And when I say controllers, I don't know if it's the same controllers
Speaker 1as iOS app or whatever. When I say controller, it's a guy which is in between your application code and your data that knows how to get data in and how to get data out. So that is what controllers in the Java world will use to call that DAO in a way. But DAO doesn't make sense in the context of Rust because they don't need to be object, live object. So in my case, they are typed, but there are no instances. So, but there's different way to
Speaker 1skin the cat, yeah. But they don't have to be object per se. So that's, you have the controller, but I'm not sure you have the queries and stuff. The queries is, it's the business of the model controllers, yeah. Yeah, so one thing is MyOrganizerOS MPI to serializer services and stuff. Yes, the Ruby on Rails. And so that is a trick, yeah? We all come with our experience and stuff. Me, I came from Java and JavaScript and things. And always one
Speaker 1thing I did every time I moved to another language. So did a lot of Java on the back end. Actually, we did Node.js after Java, which is weird, but It's actually scaled pretty well. Anyway, there's a whole production coding reason for it, but with TypeScript and so on. And even if you could do JavaScript slash TypeScript the Java way, with dependency injection and stuff, you don't. So that is a trick. You can, people does it, but it's a
Speaker 1lost opportunity because you don't need it. It's not the same thing in Java because JavaScript... I know that now it changes a little bit, but JavaScript is a single-stranded languages. So by default, you don't have the problem that you have in other language of creating singleton and stuff. So there's a lot of things here where, sure, you can code JavaScript the way you code Java, or you can code ROS the way you code Java or vice versa, but it's a mismatch. It's a lost opportunity. You are paying twice the taxes. Because one, you are paying a
Speaker 1taxes that JavaScript is not a multi-threaded language, and moreover, you are not taking advantage that is a single-threaded environment. And a single-threaded, again, is concurrent, yeah? So the language, they have the event loop, and they have the whole async await, which is awesome, which is concurrent, which is why we're using it on the server. But still, except if you do workers and everything on corner cases, for your main code, even if it's concurrent, you can assume your JavaScript Two-thread doesn't access the data. So that is
Speaker 1the thing. Did you ever create an app which ran well locally but doesn't... Yes, that often happens. So did you ever create an app which ran well locally but doesn't work on other machines? And if that happened, what is your advice? Where is tricky? Yeah. One of the
Speaker 1app that I'm creating, that I've created is awesome app. And at the beginning, it didn't work on Windows. And so on the desktop apps, Windows and stuff can get very tricky because, well, first, there's a whole past business. Rust solved a little bit, but there's still things that need to be handled. And then even in my development, when I was doing the awesome app stuff, the way you kill processes and child processes on Windows is completely different than the way you kill them on a Unix system,
Speaker 1Unix C system or whatever. And so on Windows, you have to like have this loop and stuff. So I had to spend quite a bit of time in one of my lib to do crazy work to make sure that I was killing the stuff below. Right now, I'm working a lot. There's a cool project I'm working on, which is open source. You can use this. It's Dev AI. I use it daily, all the time, for everything I do. But I'm sure it doesn't really work very well on Windows. Okay, so that is a Windows Unix kind of thing. And
Speaker 1probably the Unix Windows stuff. Otherwise, in production, what I'm trying to do is we have... what I will call a Kubernetes... I'm sorry. People are still seeking to stop this. We have a Kubernetes-driven kind of development. And so the goal is when you do cloud application, you want to reduce or maximize or reduce the proximity between your production and your development environment. And Kubernetes is heaven for that.
Speaker 1So you use Kubernetes with Docker for Mac or... or Podman or whatever. You can run Kubernetes locally. Usually when you have a machine, it's actually quite an expensive cloud setup, your local machine. So you can run a lot in your local machine. And so usually we try to minimize the difference between the cloud and the local and have everything look alike. And then we deploy it. So in our production development environment, I spend a lot of time on that topic to make these two very close. And
Speaker 1typically we didn't have this issue, yeah but it can always happen use your machine to host the app at the colo i don't know what that means i'm sorry is it axum i'm not sure race controller so i think that is another discussion Ben Wells, happy to catch a stream. I've stepped away from this project a few months,
Speaker 1but I was always curious. Okay, that's cool. Yeah, no problem. I really love to answer questions, and usually it's also helped me either make new videos, and often there's also stuff that I need to make sure that I answer. Okay, so I think it's... Am I still streaming or not? Yeah, I think I'm still. So I think we're going to
Speaker 1do the stuff. I don't even know. How do I know how long it was? I'm still learning this whole thing. So I'm like this newbie here where I'm like always confused. Okay, I have it. I started at 3 or whatever. And it's 4.20, so 1.20. Okay, 80 minutes. Okay, yeah, you know. So this is why I did this live is because I need to learn more. And so one thing I
Speaker 1want to do is put this live in the archive for the live stream members. And my current plan, and this can change over the time, yeah, but I will do scheduled live stream members live with polling for the live stream members on what they want to hear. Yeah, so like this sort of stuff, but I will also do a ad hoc, yeah, a live stream like that for everybody. And then just to, you know, make sure that the live stream members, they're awesome. So we want
Speaker 1to make sure that they're happy. I will put the archive of this video for the live stream members. So like this, everybody finds their doc, but this way it allows me to practice more, to share more. And it's actually a nice thing for, I think for both, for everybody. And as well as for the live stream members. So like this, everybody find their stuff. Okay. So I think that will end the stream. I really enjoy it. Thank you a lot. We were about like 20, I see we were about 20 to 25 and stuff. So that's
Speaker 1pretty cool. And I'm just starting this kind of live streaming. I started Twitch. I mean, I tested Twitch just earlier, but I have nobody there. And so I'm not sure I would go there. So I prefer to work on the YouTube things. Okay, until next one, happy coding.
Building production-ready web applications requires efficient database interaction, flexible query construction, and well-structured data access layers. We examine how these technologies work together to simplify...
In this episode, we continue our exploration of nine essential Rust programming best practices, focusing on utilities, practical examples, and software testing. Building reliable Rust applications requires more than...
In this comprehensive tutorial, we explore how to build database-driven applications using Rust and SQLite, covering essential database concepts and practical implementation techniques. We take a hands-on approach to...
Join Jeremy Chone for a live-stream session dedicated to Rust programming, software development, and practical engineering discussions. This session provides an opportunity to explore Rust development through a live...