{"id":23407693,"url":"https://github.com/bestia-dev/refactoring_database_web_ui_server_side_rendering","last_synced_at":"2025-04-09T00:49:17.165Z","repository":{"id":105011994,"uuid":"542969459","full_name":"bestia-dev/refactoring_database_web_ui_server_side_rendering","owner":"bestia-dev","description":"08. Tutorial to refactor the database_web_ui_on_server (2022-10)","archived":false,"fork":false,"pushed_at":"2025-03-29T15:58:15.000Z","size":731,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T16:30:21.629Z","etag":null,"topics":["maintained","ready-for-use","tutorial","youtube"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bestia-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-29T07:01:50.000Z","updated_at":"2025-03-29T15:58:18.000Z","dependencies_parsed_at":"2025-03-29T16:36:29.279Z","dependency_job_id":null,"html_url":"https://github.com/bestia-dev/refactoring_database_web_ui_server_side_rendering","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestia-dev%2Frefactoring_database_web_ui_server_side_rendering","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestia-dev%2Frefactoring_database_web_ui_server_side_rendering/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestia-dev%2Frefactoring_database_web_ui_server_side_rendering/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bestia-dev%2Frefactoring_database_web_ui_server_side_rendering/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bestia-dev","download_url":"https://codeload.github.com/bestia-dev/refactoring_database_web_ui_server_side_rendering/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247953090,"owners_count":21023945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["maintained","ready-for-use","tutorial","youtube"],"created_at":"2024-12-22T14:29:33.491Z","updated_at":"2025-04-09T00:49:17.139Z","avatar_url":"https://github.com/bestia-dev.png","language":"Rust","readme":"\u003c!-- markdownlint-disable MD041 --\u003e\n[//]: # (auto_md_to_doc_comments segment start A)\n\n# refactoring_database_web_ui_server_side_rendering\n\n[//]: # (auto_cargo_toml_to_md start)\n\n**08. Tutorial to refactor the database_web_ui_on_server (2022-10)**  \n***version: 0.1.01 date: 2022-10-10 author: [bestia.dev](https://bestia.dev) repository: [Github](https://github.com/bestia-dev/refactoring_database_web_ui_server_side_rendering)***  \n\n[//]: # (auto_cargo_toml_to_md end)\n\n ![maintained](https://img.shields.io/badge/maintained-green)\n ![ready_for_use](https://img.shields.io/badge/ready_for_use-green)\n ![tutorial](https://img.shields.io/badge/tutorial-yellow)\n ![youtube](https://img.shields.io/badge/youtube-yellow)\n\n[//]: # (auto_lines_of_code start)\n\n[![Lines in Rust code](https://img.shields.io/badge/Lines_in_Rust-230-green.svg)](https://github.com/bestia-dev/refactoring_database_web_ui_server_side_rendering/)\n[![Lines in Doc comments](https://img.shields.io/badge/Lines_in_Doc_comments-9-blue.svg)](https://github.com/bestia-dev/refactoring_database_web_ui_server_side_rendering/)\n[![Lines in Comments](https://img.shields.io/badge/Lines_in_comments-28-purple.svg)](https://github.com/bestia-dev/refactoring_database_web_ui_server_side_rendering/)\n[![Lines in examples](https://img.shields.io/badge/Lines_in_examples-0-yellow.svg)](https://github.com/bestia-dev/refactoring_database_web_ui_server_side_rendering/)\n[![Lines in tests](https://img.shields.io/badge/Lines_in_tests-0-orange.svg)](https://github.com/bestia-dev/refactoring_database_web_ui_server_side_rendering/)\n\n[//]: # (auto_lines_of_code end)\n\n [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/bestia-dev/refactoring_database_web_ui_server_side_rendering/blob/main/LICENSE)\n [![Rust](https://github.com/bestia-dev/refactoring_database_web_ui_server_side_rendering/workflows/rust_fmt_auto_build_test/badge.svg)](https://github.com/bestia-dev/refactoring_database_web_ui_server_side_rendering/)\n ![refactoring_database_web_ui_server_side_rendering](https://bestia.dev/webpage_hit_counter/get_svg_image/627386887.svg)\n\nHashtags: #rust #rustlang #tutorial  \nMy projects on Github are more like a tutorial than a finished product: [bestia-dev tutorials](https://github.com/bestia-dev/tutorials_rust_wasm).\n\n## Intro\n\nIn the [last tutorial](https://github.com/bestia-dev/database_web_ui_on_server) we created a working prototype for a web application that can create, read, update and delete (CRUD) data in a postgres database. The user interface is server side rendered as html5 and css3. The code is pretty basic and repetitive, because the main focus was on concepts, tools, libraries and data flow.\nWe will continue to develop this project in the 8th part of the [Rust tutorial series](https://www.youtube.com/channel/UCitt3zFHK2jDetDh6ezI05A). We will refactor this web app to deduplicate code and make it more idiomatic Rust.  \n\nThis project has also a youtube video tutorial. Watch it:\n\u003c!-- markdownlint-disable MD033 --\u003e\n[\u003cimg src=\"https://bestia.dev/youtube/refactoring_database_web_ui_server_side_rendering.jpg?_\" width=\"400px\"\u003e](https://bestia.dev/youtube/refactoring_database_web_ui_server_side_rendering.html)\n\u003c!-- markdownlint-enable MD033 --\u003e\n\n## Motivation\n\nThe first function of software is to solve a problem. In this project, the user can read and write data in a database simply using a browser.  \nThe second main function of software is maintainability. Software will always with no exception need to be updated or upgraded for any reason. When we write our source code, we want to make it easier and less error-prone to make changes later.  \nRust is the champion of fearless refactoring. The strict type system warns the developer immediately if he forgets something. And I assure you, that happens a lot.  \n\n## Separate code\n\nEvery programming language have a way to separate code into logical modules. If that does not exist, we can still use names by prefixing them with a namespace. That will also work. This distinction is just for the human brain to reason about one problem at a time. The computer itself does not need to know about this separation.  \nOur project is 3-tier and it is not a single coherent project, not even the same programming language. If we want to understand easily how the data flows from one project to the other, it is smart to give items the same name everywhere. We can then use the simple \"Find text\" tool of VSCode to find everything about an item.  \n\n## Web app name\n\nThe project name is long and descriptive because this is a tutorial. But the executable binary can have a more meaningful name like \"webpage_hits_admin\".  \nIt is enough to rename the folder in \"src/bin/\" to change the name of the binary. I will also rename the web_server_folder and css file accordingly.  \nBecause of this change, I will change the name inside the automation_task_rs to reflect the new binary name.  \n\n## Open-source and free as a beer\n\nMy open-source projects are free as a beer (MIT license).  \nI just love programming.  \nBut I need also to drink. If you find my projects and tutorials helpful, please buy me a beer by donating to my [PayPal](https://paypal.me/LucianoBestia).  \nYou know the price of a beer in your local bar ;-)  \nSo I can drink a free beer for your health :-)  \n[Na zdravje!](https://translate.google.com/?hl=en\u0026sl=sl\u0026tl=en\u0026text=Na%20zdravje\u0026op=translate) [Alla salute!](https://dictionary.cambridge.org/dictionary/italian-english/alla-salute) [Prost!](https://dictionary.cambridge.org/dictionary/german-english/prost) [Nazdravlje!](https://matadornetwork.com/nights/how-to-say-cheers-in-50-languages/) 🍻\n\n[//bestia.dev](https://bestia.dev)  \n[//github.com/bestia-dev](https://github.com/bestia-dev)  \n[//bestiadev.substack.com](https://bestiadev.substack.com)  \n[//youtube.com/@bestia-dev-tutorials](https://youtube.com/@bestia-dev-tutorials)  \n\n[//]: # (auto_md_to_doc_comments segment end A)\n","funding_links":["https://paypal.me/LucianoBestia"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbestia-dev%2Frefactoring_database_web_ui_server_side_rendering","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbestia-dev%2Frefactoring_database_web_ui_server_side_rendering","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbestia-dev%2Frefactoring_database_web_ui_server_side_rendering/lists"}