We can't find the internet
Attempting to reconnect
Something went wrong!
Attempting to reconnect
Loco Casts · 6.9K views · 270 likes
Analysis Summary
Ask yourself: “What would I have to already believe for this argument to make sense?”
Worth Noting
Positive elements
- This video provides a clear, step-by-step technical walkthrough of the Loco framework's CLI tools and its deployment pipeline with Shuttle.
Be Aware
Cautionary elements
- The presentation glosses over the 'hidden' complexity of Rust by using generators, which may lead beginners to create insecure or unoptimized applications by relying solely on the 'magic' defaults.
Influence Dimensions
How are these scored?About this analysis
Knowing about these techniques makes them visible, not powerless. The ones that work best on you are the ones that match beliefs you already hold.
This analysis is a tool for your own thinking — what you do with it is up to you.
Related content covering similar topics.
Transcript
today we're going to introduce the Local web framework which is very much like Ruby and rails but for rust we're going to see that are we web yet is an absolute definite yes with loco not only that you'll see how hyper productive you can be with it you don't need any cloud provider no need to learn anything about the cloud you can build stuff right there on your PC fully immersed in building and then finally deploy with multiple options first feel free to open the docs as you follow this video and if you're trying out things install local and the dependencies that are required we're going to go from zero to production in this video so hang tight first start by running local new and create a new app call it pre-launch exess app sqi async and server render views async will perform background jobs in process and will use server render views to be able to use HDMX which is a hybrid JavaScript and server render technology that can help you avoid building client side app and just focus on the server all right let's go into our app cargo local start to see it first time building will take a minute we expect to see a friendly hello screen from Loco Local Host 5150 and there it is great now let's create something local generate scaffold contacts with the email unique string and HDMX HDMX is almost magic it sends fragments of HTML down wire to create a client side like experience without using any react or anything like that now start the app let's check it out contacts new add a new contact great it works now view it let's add another great we can also view the list this is a full Crow app now let's design our Louch page and replace the create page this is simple HTML with some HDMX annotations to give us that magic experience so no special skills needed I'll drop in the design I have using Tailwind super simple tweak it the bit great now let's start the app again looking nice let's add another contact and let's Design This success HTML fragment this is the show page we just need a thank you message so no data objects needed the design is complete now let's try adding an existing contact see what happens well it doesn't work the email field is unique and fails a database constraint this is great it protects us like it should let's check if the contact exist before adding it this should be done using transactions but just for this case checking and adding should be good enough no SQL is needed here we're using high level constructs provided by Loco and CRM check the count and true if greater than zero back to our controller we ask our model if it exists and notice that business logic lives in the model let's just Trace if it exists for logs and if it doesn't add it let's clean up the show view which expects the data object and restart to take our changes by the way you can use cargo watch to automate restarting add existing contact again great it shows in our logs now let's create a tool to get all our contacts this is done in Loco using a task cargo local generate task Dum contacts we create a task and code we need and now just name the task and get all contacts using the CRM query functions print all contacts this is standard rust iteration and rust objects now cargo local task shows all tasks let's run dump contact great it works let's create the terms of service and about Pages these are simple Pages we can generate a dedicated controller called Pages for this cargo local generate controller pages with about and terms use hmx as always local generates and wires the right code in the right place for you this is the new pages controller and these are the HTML Pages let's add links to the pages agree to terms and a footer start the app and this is it fantastic now let's deploy to production we'll use Shadow RS which gives us free compute and free database instances you can use it too it's free for everyone Loco generates and configures your app for shuttle automatically by using the deployment generator local generate deployment pick shuttle let's fix this underscore shuttle needs hyphens by the way you do need to create your own app in Shadow res we assume you already played with it a little before running the deployment now to deploy production we need to populate the production config so let's copy from development and deploy done is that simple let's visit the app add a contct this is also using postgress instead of esite we develop with esite and change nothing got a production app in no time how about we dump contexts from production we'll use the production postris connection just stick it as an environment variable and run the task locally by the way all the secrets you see here are dead by the time this video is published so don't worry about it that's it we had a real app zero to real production in full rust with locco to learn more you can go into the quick start guide hopefully you'll find local productive and fun and build your next up with it goodbye
Video description
Loco is a Web framework for Rust, just like Ruby on Rails, but for Rust. Learn how productive you can be and build Web apps in Rust from code to production.