<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Digkill</title>
    <description>The latest articles on DEV Community by Digkill (@digkill).</description>
    <link>https://dev.to/digkill</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1531104%2Fc1eec7e5-6b21-4ccc-bc6b-f2f58eb4966f.jpg</url>
      <title>DEV Community: Digkill</title>
      <link>https://dev.to/digkill</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/digkill"/>
    <language>en</language>
    <item>
      <title>My Mac had 14 GB free. Here's what was actually eating 250 GB</title>
      <dc:creator>Digkill</dc:creator>
      <pubDate>Mon, 20 Jul 2026 22:42:42 +0000</pubDate>
      <link>https://dev.to/digkill/my-mac-had-14-gb-free-heres-what-was-actually-eating-250-gb-1lpj</link>
      <guid>https://dev.to/digkill/my-mac-had-14-gb-free-heres-what-was-actually-eating-250-gb-1lpj</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fekvlgtltd096ddsbhkz0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fekvlgtltd096ddsbhkz0.png" alt="Dashboard application - Again Cleaner" width="800" height="576"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Last week my MacBook greeted me with the classic: &lt;strong&gt;"Your disk is almost full."&lt;/strong&gt; 460 GB drive, 14 GB free. I hadn't downloaded a single movie. I don't keep my photo library on this machine. So where did almost half a terabyte go?&lt;/p&gt;

&lt;p&gt;I decided to actually find out instead of just deleting my Downloads folder and hoping. What I found was equal parts fascinating and embarrassing, and I think every developer's Mac looks roughly the same. Here's the full breakdown — and the commands so you can audit yours.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Measure before you delete
&lt;/h2&gt;

&lt;p&gt;The golden rule of disk cleanup: &lt;strong&gt;never delete anything you haven't measured first.&lt;/strong&gt; Start with the top-level damage report:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;df&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt;
&lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; 1 ~ 2&amp;gt;/dev/null | &lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-hr&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-20&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On my machine this immediately produced suspects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;257G    /Users/me
 87G    /Users/me/Library
 78G    /Users/me/Projects
 10G    /Users/me/.espressif
8.1G    /Users/me/.gemini
3.4G    /Users/me/go
2.2G    /Users/me/.rustup
2.0G    /Users/me/.gradle
1.9G    /Users/me/.cursor
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;87 GB in &lt;code&gt;~/Library&lt;/code&gt;. Let's zoom in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; 1 ~/Library 2&amp;gt;/dev/null | &lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-hr&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-10&lt;/span&gt;
&lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; 1 ~/Library/Caches 2&amp;gt;/dev/null | &lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-hr&lt;/span&gt; | &lt;span class="nb"&gt;head&lt;/span&gt; &lt;span class="nt"&gt;-15&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; 29G    ~/Library/Application Support
 24G    ~/Library/Caches
 14G    ~/Library/Arduino15
 10G    ~/Library/Developer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;24 GB of caches.&lt;/strong&gt; Yarn alone was sitting on 5.1 GB. Google's cache folder had 4.3 GB. A disk imaging tool I used &lt;em&gt;once&lt;/em&gt; had kept 4.1 GB of downloaded OS images as a souvenir.&lt;/p&gt;

&lt;h2&gt;
  
  
  The usual suspects (a checklist)
&lt;/h2&gt;

&lt;p&gt;After going through my whole disk, here's what actually eats space on a developer's Mac, roughly in order of guilt:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. &lt;code&gt;~/Library/Caches&lt;/code&gt; — the obvious one
&lt;/h3&gt;

&lt;p&gt;Safe to clear almost entirely. Apps rebuild caches on next launch. The catch: it's not one folder, it's &lt;em&gt;hundreds&lt;/em&gt; — one per app, including apps you deleted two years ago.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Package manager caches — the silent hoarders
&lt;/h3&gt;

&lt;p&gt;Every ecosystem keeps its own stash, and none of them ever clean up after themselves:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-sh&lt;/span&gt; ~/Library/Caches/Yarn ~/.npm/_cacache ~/Library/Caches/pip &lt;span class="se"&gt;\&lt;/span&gt;
       ~/Library/Caches/Homebrew ~/.gradle/caches ~/go/pkg/mod &lt;span class="se"&gt;\&lt;/span&gt;
       ~/Library/Caches/CocoaPods ~/.nuget/packages 2&amp;gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My Go module cache was &lt;strong&gt;3.2 GB&lt;/strong&gt; of packages for projects I'd finished months ago. All of this re-downloads on demand — it's pure cache.&lt;/p&gt;

&lt;p&gt;Fun gotcha: the Go module cache ships with read-only permissions, so a naive &lt;code&gt;rm -rf&lt;/code&gt; fails halfway through. You need &lt;code&gt;chmod -R u+w&lt;/code&gt; first. Ask me how I know.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Xcode — a category of its own
&lt;/h3&gt;

&lt;p&gt;If you do any iOS/macOS development:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;du&lt;/span&gt; &lt;span class="nt"&gt;-h&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; 1 ~/Library/Developer 2&amp;gt;/dev/null | &lt;span class="nb"&gt;sort&lt;/span&gt; &lt;span class="nt"&gt;-hr&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DerivedData&lt;/strong&gt; — build intermediates, safe to nuke, rebuilds on next build&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;iOS DeviceSupport&lt;/strong&gt; — debug symbols for every iOS version of every device you've ever plugged in, 2–5 GB &lt;em&gt;each&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CoreSimulator&lt;/strong&gt; — old simulators easily hold 20–40 GB across Xcode versions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Archives&lt;/strong&gt; — every app you've ever shipped, forever&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;xcrun simctl delete unavailable&lt;/code&gt; alone freed several GB of orphaned simulators for me.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Build artifacts scattered across your projects
&lt;/h3&gt;

&lt;p&gt;This was my biggest shock: &lt;strong&gt;45 GB of build folders and 8 GB of &lt;code&gt;node_modules&lt;/code&gt;&lt;/strong&gt; spread across &lt;code&gt;~/Projects&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Finding them is trickier than it sounds, because the folder names are ambiguous. &lt;code&gt;node_modules&lt;/code&gt; and &lt;code&gt;__pycache__&lt;/code&gt; are unmistakable, but &lt;code&gt;build&lt;/code&gt;, &lt;code&gt;dist&lt;/code&gt;, &lt;code&gt;target&lt;/code&gt;, &lt;code&gt;vendor&lt;/code&gt;? Those could be anything — you can't just delete every folder named &lt;code&gt;build&lt;/code&gt; on your disk.&lt;/p&gt;

&lt;p&gt;The trick I landed on: &lt;strong&gt;validate by marker files.&lt;/strong&gt; A folder named &lt;code&gt;target&lt;/code&gt; is only a Rust build if &lt;code&gt;Cargo.toml&lt;/code&gt; sits next to it. &lt;code&gt;build&lt;/code&gt; is only sacrificeable if the parent has &lt;code&gt;build.gradle&lt;/code&gt;, &lt;code&gt;CMakeLists.txt&lt;/code&gt;, &lt;code&gt;package.json&lt;/code&gt;, or &lt;code&gt;pubspec.yaml&lt;/code&gt;. &lt;code&gt;vendor&lt;/code&gt; counts only next to &lt;code&gt;composer.json&lt;/code&gt; or &lt;code&gt;go.mod&lt;/code&gt;. &lt;code&gt;bin&lt;/code&gt;/&lt;code&gt;obj&lt;/code&gt; only next to a &lt;code&gt;*.csproj&lt;/code&gt;. Python's &lt;code&gt;venv&lt;/code&gt; proves itself by containing &lt;code&gt;pyvenv.cfg&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;With that heuristic you can sweep your whole home directory safely:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# unambiguous ones are easy:&lt;/span&gt;
find ~ &lt;span class="nt"&gt;-type&lt;/span&gt; d &lt;span class="se"&gt;\(&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt; node_modules &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt; __pycache__ &lt;span class="nt"&gt;-o&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt; .venv &lt;span class="se"&gt;\)&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-not&lt;/span&gt; &lt;span class="nt"&gt;-path&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$HOME&lt;/span&gt;&lt;span class="s2"&gt;/Library/*"&lt;/span&gt; &lt;span class="nt"&gt;-prune&lt;/span&gt; &lt;span class="nt"&gt;-print&lt;/span&gt; 2&amp;gt;/dev/null
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything restores with &lt;code&gt;npm install&lt;/code&gt; / &lt;code&gt;cargo build&lt;/code&gt; / &lt;code&gt;pip install&lt;/code&gt; when you actually return to that project. Spoiler: you won't return to most of them.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. The weird ones nobody talks about
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;iOS device backups&lt;/strong&gt;: &lt;code&gt;~/Library/Application Support/MobileSync/Backup&lt;/code&gt; — old iPhone backups from that one time you used Finder sync. Often 10–50 GB.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Mail Downloads&lt;/strong&gt;: &lt;code&gt;~/Library/Containers/com.apple.mail/Data/Library/Mail Downloads&lt;/code&gt; — attachments you viewed once, kept forever.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Electron app junk&lt;/strong&gt;: every Electron/Chromium app keeps &lt;code&gt;Cache&lt;/code&gt;, &lt;code&gt;Code Cache&lt;/code&gt;, &lt;code&gt;GPUCache&lt;/code&gt;, &lt;code&gt;ShaderCache&lt;/code&gt; and logs inside &lt;code&gt;~/Library/Application Support/&amp;lt;App&amp;gt;/&lt;/code&gt;. Individually small, collectively gigabytes — Discord, Slack, Postman, Obsidian, all of them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Old Downloads&lt;/strong&gt;: &lt;code&gt;find ~/Downloads -maxdepth 1 -mtime +30&lt;/code&gt; — everything untouched for a month. For me that was 25 items including three copies of the same installer.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Safety rules I follow
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Trash, not &lt;code&gt;rm&lt;/code&gt;&lt;/strong&gt; — move things to the Trash first, delete permanently only after a week of nothing breaking.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Never touch&lt;/strong&gt;: &lt;code&gt;~/Library/Keychains&lt;/code&gt;, &lt;code&gt;Mail&lt;/code&gt;, &lt;code&gt;Messages&lt;/code&gt;, &lt;code&gt;Mobile Documents&lt;/code&gt; (that's iCloud!), and on Apple Silicon leave &lt;code&gt;/System/Library/Caches&lt;/code&gt; alone — macOS manages it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Close the heavy apps first&lt;/strong&gt; — clearing a cache out from under a running browser or IDE causes weirdness.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Look before you delete.&lt;/strong&gt; Categories like "old downloads" contain surprises — mine had API keys (&lt;code&gt;AuthKey_*.p8&lt;/code&gt;) I definitely still needed.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The confession part
&lt;/h2&gt;

&lt;p&gt;I did this cleanup manually with &lt;code&gt;du&lt;/code&gt;, &lt;code&gt;find&lt;/code&gt; and &lt;code&gt;rm&lt;/code&gt; exactly once. It took an evening, I freed about 60 GB… and three weeks later the disk was filling up again, because caches do what caches do.&lt;/p&gt;

&lt;p&gt;So — like every developer with a shell history full of &lt;code&gt;du -h -d 1&lt;/code&gt; — I ended up building a small native macOS app that does this loop for me: scans all the locations above (plus auto-discovers caches of any app it finds), tags everything Safe / Caution / Risky, shows the actual file list behind every category with checkboxes, and defaults to moving things to the Trash. The marker-file validation for build folders came straight out of this experiment.&lt;/p&gt;

&lt;p&gt;It's free, no subscriptions, signed and notarized, and I mostly built it for myself — but if your &lt;code&gt;df -h&lt;/code&gt; looks like mine did, it might save you an evening: &lt;strong&gt;&lt;a href="https://againcleaner.com" rel="noopener noreferrer"&gt;Again Cleaner&lt;/a&gt;&lt;/strong&gt;. If you'd rather do it by hand, every command you need is in this post — that's genuinely how the app works under the hood.&lt;/p&gt;

&lt;p&gt;Either way: go run &lt;code&gt;du -h -d 1 ~ | sort -hr | head -20&lt;/code&gt; right now. I'll wait. The number next to &lt;code&gt;~/Library&lt;/code&gt; is going to annoy you.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;What's the biggest space hog you've found on your machine? I'm collecting new categories — the weirdest one I've heard so far is 30 GB of Slack video call recordings nobody knew existed.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>macos</category>
      <category>devtools</category>
      <category>productivity</category>
      <category>swift</category>
    </item>
    <item>
      <title>🛠️ The Rise of the Artisan Coder — a New Breed of Developer</title>
      <dc:creator>Digkill</dc:creator>
      <pubDate>Wed, 12 Nov 2025 19:58:07 +0000</pubDate>
      <link>https://dev.to/digkill/the-rise-of-the-artisan-coder-a-new-breed-of-developer-352f</link>
      <guid>https://dev.to/digkill/the-rise-of-the-artisan-coder-a-new-breed-of-developer-352f</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;💡 &lt;em&gt;Term introduced by CTO Vitaliy Edifanov (MediaRise Studio)&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the modern tech world, a new type of developer is emerging — one that blends the precision of engineering, the creativity of design, and the instinct of entrepreneurship.  &lt;/p&gt;

&lt;p&gt;Meet the &lt;strong&gt;Artisan Coder&lt;/strong&gt; — a &lt;strong&gt;digital craftsman&lt;/strong&gt; who builds products from scratch, combines human creativity with AI automation, and treats software development as both a profession and an art.&lt;/p&gt;




&lt;h2&gt;
  
  
  👨‍💻 Who Is an Artisan Coder?
&lt;/h2&gt;

&lt;p&gt;An &lt;strong&gt;Artisan Coder&lt;/strong&gt; is more than a full-stack developer.&lt;br&gt;&lt;br&gt;
They are a &lt;strong&gt;creator, engineer, and founder&lt;/strong&gt; all at once — capable of building and launching complete products independently.&lt;/p&gt;

&lt;p&gt;They embrace a mindset where programming, design, automation, and business strategy come together in one person.&lt;/p&gt;

&lt;p&gt;An Artisan Coder combines:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Engineering mastery&lt;/strong&gt; — fluent in modern languages, frameworks, and rapid prototyping.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI-driven workflow&lt;/strong&gt; — uses GPTs, Copilot, Code Interpreter, or AutoDev to accelerate creation.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Entrepreneurial thinking&lt;/strong&gt; — understands unit economics, product-market fit, and customer experience.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Aesthetic mindset&lt;/strong&gt; — writes clean, expressive, and meaningful code.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-domain literacy&lt;/strong&gt; — familiar with DevOps, UI/UX, analytics, and marketing.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They are not freelancers or corporate coders — they are &lt;strong&gt;independent creators of digital ecosystems&lt;/strong&gt;, often operating as a one-person studio.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚙️ The Core Principles of the Artisan Coder
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Build fast, but think deep.&lt;/strong&gt;
Speed without clarity is chaos — clarity without speed is stagnation.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automate the routine.&lt;/strong&gt;
AI is your apprentice, not your rival.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code with aesthetic discipline.&lt;/strong&gt;
Clean code is a signature of respect for your craft.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Think like a founder.&lt;/strong&gt;
Every project should have a reason to exist beyond code.
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Share your knowledge.&lt;/strong&gt;
Real mastery is proven through teaching others.
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  🚀 Why This Movement Is Inevitable
&lt;/h2&gt;

&lt;p&gt;We’re entering an era where &lt;strong&gt;one developer with AI tools can outperform entire teams&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
The Artisan Coder doesn’t fear automation — they &lt;em&gt;embrace&lt;/em&gt; it.&lt;br&gt;&lt;br&gt;
They use it to extend their reach, not replace their creativity.&lt;/p&gt;

&lt;p&gt;Just like master craftsmen of the past shaped materials into form, today’s Artisan Coders shape &lt;strong&gt;ideas into software&lt;/strong&gt; — guided by intuition, experience, and AI-powered precision.&lt;/p&gt;

&lt;p&gt;This movement reflects a broader shift in tech:&lt;br&gt;&lt;br&gt;
from &lt;strong&gt;mass production to intelligent creation&lt;/strong&gt;,&lt;br&gt;&lt;br&gt;
from &lt;strong&gt;corporate engineering to individual mastery&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  ✨ The Artisan Philosophy
&lt;/h2&gt;

&lt;p&gt;To be an &lt;strong&gt;Artisan Coder&lt;/strong&gt; means &lt;strong&gt;to create with purpose&lt;/strong&gt;.&lt;br&gt;&lt;br&gt;
To find beauty in logic, clarity in complexity, and independence in creation.  &lt;/p&gt;

&lt;p&gt;It’s not about chasing trends — it’s about building meaningful things with soul, discipline, and curiosity.  &lt;/p&gt;

&lt;p&gt;Artisan Coders are shaping a future where technology feels &lt;strong&gt;more human&lt;/strong&gt;, and creativity is amplified by intelligence.&lt;/p&gt;




&lt;h2&gt;
  
  
  💬 Closing Thought
&lt;/h2&gt;

&lt;p&gt;As CTO &lt;strong&gt;Vitaliy Edifanov&lt;/strong&gt; describes it:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“The Artisan Coder is a modern-day craftsman —&lt;br&gt;&lt;br&gt;
someone who uses AI not to replace creativity,&lt;br&gt;&lt;br&gt;
but to give it new hands.”&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;em&gt;Written by Vitaliy Edifanov, CTO &amp;amp; Founder at MediaRise Studio&lt;/em&gt;&lt;br&gt;&lt;br&gt;
&lt;em&gt;Follow for more insights on AI, creativity, and the future of development.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>startup</category>
      <category>programming</category>
      <category>futureofdev</category>
    </item>
    <item>
      <title>Experience developing in Rust</title>
      <dc:creator>Digkill</dc:creator>
      <pubDate>Sun, 21 Jul 2024 17:56:30 +0000</pubDate>
      <link>https://dev.to/digkill/experience-developing-in-rust-m6j</link>
      <guid>https://dev.to/digkill/experience-developing-in-rust-m6j</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa8ejw13zzmv5r17gsxvt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa8ejw13zzmv5r17gsxvt.png" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am the CEO of my company &lt;a href="https://mediarise.org" rel="noopener noreferrer"&gt;MediaRise&lt;/a&gt; (the company is just starting to develop), with a technical background. I enjoy writing in different languages, or rather trying to work with them. I have heard about a language called Rust for a long time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features of Rust
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Memory Safety:&lt;/strong&gt; Rust guarantees memory safety by using a system of ownership with rules that the compiler checks at compile time. This prevents common bugs such as null pointer dereferencing and buffer overflows.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Concurrency:&lt;/strong&gt; Rust makes it easier to write safe concurrent code. The ownership system ensures that data races are avoided, making concurrent programming safer and more efficient.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Performance:&lt;/strong&gt; Rust is designed for performance. Its zero-cost abstractions mean that you can write high-level code without compromising on performance. Rust code can be as fast as C or C++.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Safe Systems Programming:&lt;/strong&gt; Rust allows low-level programming without the fear of undefined behavior. It offers control over hardware and memory resources while maintaining safety guarantees.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Modern Language Features:&lt;/strong&gt; Rust includes modern language features such as pattern matching, type inference, and a powerful macro system. These features help in writing clean and maintainable code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cargo and Crates:&lt;/strong&gt; Rust's package manager, Cargo, and the crates.io ecosystem make dependency management and building projects straightforward and efficient.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Strong Type System:&lt;/strong&gt; Rust has a strong and static type system that prevents many programming errors at compile time. It includes advanced features such as generics, trait bounds, and lifetimes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Community and Documentation:&lt;/strong&gt; Rust has a vibrant and supportive community, with comprehensive documentation and a wealth of learning resources.&lt;/p&gt;

&lt;p&gt;These features make Rust a compelling choice for developers looking to build reliable and efficient software.&lt;/p&gt;

&lt;p&gt;I was thinking about what to implement in Rust. I wanted to write a Telegram bot that would translate messages in a group chat bidirectionally.&lt;/p&gt;

&lt;p&gt;I understand that there are ready-made solutions, but I wanted to create my own "bicycle" and try out a new language for myself — Rust.&lt;/p&gt;

&lt;p&gt;I have the idea, and I have no problems creating a Telegram bot, but I encountered an issue with the service that would translate from one language to another. I chose LibreTranslate. To use it for free, you need to deploy the application on your server. So I did: I installed the dependencies and deployed it in a Docker container. There were no issues, except that the application needs to be run with the flag: ./run.sh --api-keys to obtain an api_key. You can read more about setting up and obtaining the api-key for LibreTranslate on the official website.&lt;/p&gt;

&lt;p&gt;After deploying the LibreTranslate server and getting the token for the Telegram bot, the next step was to implement the application. After reviewing the official Rust documentation and some GitHub projects, I started creating. I installed Rust and Cargo (the package registry/manager for Rust). After studying the documentation for the teloxide library for creating Telegram bots in Rust, I wrote a handler for message events in the chat.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="nd"&gt;#[tokio::main]&lt;/span&gt;
&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;ResponseResult&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;dotenv&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="nf"&gt;.ok&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="nn"&gt;env_logger&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;token_bot&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"TELEGRAM_BOT_KEY"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"TELEGRAM_BOT_KEY not found"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;bot&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;teloxide&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;Bot&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;token_bot&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.parse_mode&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nn"&gt;ParseMode&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="n"&gt;Html&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Create a handler for our bot, that will process updates from Telegram&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;dptree&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;entry&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nf"&gt;.inspect&lt;/span&gt;&lt;span class="p"&gt;(|&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Update&lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                    &lt;span class="nd"&gt;eprintln!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"{u:#?}"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Print the update to the console with inspect&lt;/span&gt;
        &lt;span class="p"&gt;})&lt;/span&gt;

   &lt;span class="o"&gt;...&lt;/span&gt;

        &lt;span class="nf"&gt;.branch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="nn"&gt;Update&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;filter_message&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="nf"&gt;.branch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="nn"&gt;dptree&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;endpoint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;translate_message&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Create a dispatcher for our bot&lt;/span&gt;
    &lt;span class="nn"&gt;Dispatcher&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;builder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.enable_ctrlc_handler&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="nf"&gt;.build&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="nf"&gt;.dispatch&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nf"&gt;Ok&lt;/span&gt;&lt;span class="p"&gt;(())&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;translate_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Bot&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;ResponseResult&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="nf"&gt;Some&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="nf"&gt;.text&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;

        &lt;span class="k"&gt;match&lt;/span&gt; &lt;span class="nf"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="nf"&gt;Ok&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;translated_word&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="nf"&gt;.send_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="py"&gt;.chat.id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;translated_word&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
            &lt;span class="nf"&gt;Err&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="nf"&gt;.send_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="py"&gt;.chat.id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nd"&gt;format!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Translation error: {}"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;bot&lt;/span&gt;&lt;span class="nf"&gt;.send_message&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;msg&lt;/span&gt;&lt;span class="py"&gt;.chat.id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Send me plain text."&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nf"&gt;Ok&lt;/span&gt;&lt;span class="p"&gt;(())&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next is the function itself for requesting a translation from the LiberTranslate API. The translation application determines what language the message is in and translates it into the required one&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;ResponseResult&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;reqwest&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nn"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;api_translate_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"API_TRANSLATE_URL"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"API_TRANSLATE_URL not found"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;api_translate_key&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"API_TRANSLATE_KEY"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"API_TRANSLATE_KEY not found"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;api_detect_url&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;env&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"API_DETECT_URL"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.expect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"API_DETECT_URL not found"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nd"&gt;eprintln!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"{text:#?}"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;detect_request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;DetectRequest&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;q&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nn"&gt;String&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="n"&gt;api_key&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nn"&gt;String&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;from&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_translate_key&lt;/span&gt;&lt;span class="nf"&gt;.clone&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="nf"&gt;.post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_detect_url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;.header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"application/x-www-form-urlencoded"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;.form&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;detect_request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;.send&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;resp_json&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="py"&gt;.json&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nb"&gt;Vec&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;DetectResponse&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;lang&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;resp_json&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="py"&gt;.language&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="nd"&gt;eprintln!&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"{lang:#?}"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;target_lang&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;lang&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"ru"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s"&gt;"th"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s"&gt;"ru"&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;json_object&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nd"&gt;json!&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
                &lt;span class="s"&gt;"q"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s"&gt;"source"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"auto"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s"&gt;"target"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;target_lang&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s"&gt;"format"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"text"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s"&gt;"alternatives"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="s"&gt;"api_key"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;api_translate_key&lt;/span&gt;
            &lt;span class="p"&gt;});&lt;/span&gt;

    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;json_string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nn"&gt;serde_json&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;to_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;json_object&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="nf"&gt;.unwrap&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;


    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="nf"&gt;.post&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;api_translate_url&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;.body&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;json_string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;.header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Content-Type"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"application/json"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nf"&gt;.send&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;resp_json&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="py"&gt;.json&lt;/span&gt;&lt;span class="p"&gt;::&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;TranslateResult&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="k"&gt;.await&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;let&lt;/span&gt; &lt;span class="n"&gt;translated_word&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;resp_json&lt;/span&gt;&lt;span class="py"&gt;.translatedText&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;Ok&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;translated_word&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result in Telegram chat:&lt;br&gt;
-&amp;gt;Hi! How are you?&lt;br&gt;
&amp;lt;-เฮ้! เป็นไงบ้าง?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn0k0iavalunakv4ro9wa.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fn0k0iavalunakv4ro9wa.jpg" alt="Image description" width="655" height="80"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There were problems with bugs, which were due to the fact that I was using old Rust libraries when I tried to solve the problem using ChatGPT. But the live experience of developers on GitHub helped more, where I watched the implementation of some functionality: API documentation of the bot, working with env (environment files), examples of working with json, sending rest requests, and also the work of the language design.&lt;/p&gt;

&lt;p&gt;I'm very excited about the working application because I haven't written in Rust before and it inspired me to study it further. Experienced developers will probably tell you how to optimize the code, which I will be very happy about.&lt;/p&gt;

&lt;p&gt;All that remains is to build the application and run it in daemon mode on the server&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Build your application using the command:&lt;br&gt;
&lt;code&gt;cargo build --release&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a unit file for systemd. For example, let's create a file&lt;br&gt;
&lt;code&gt;/etc/systemd/system/translate_bot.service&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;Unit]
&lt;span class="nv"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;Translate Bot
&lt;span class="nv"&gt;After&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;network.target

&lt;span class="o"&gt;[&lt;/span&gt;Service]
&lt;span class="nv"&gt;ExecStart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/path/to/your/application
&lt;span class="nv"&gt;Restart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;always
&lt;span class="nv"&gt;User&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;yourusername
&lt;span class="nv"&gt;Group&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;yourgroupname
&lt;span class="nv"&gt;Environment&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/path/to/your/.env
&lt;span class="nv"&gt;WorkingDirectory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/path/to/your/application/directory

&lt;span class="o"&gt;[&lt;/span&gt;Install]
&lt;span class="nv"&gt;WantedBy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;multi-user.target
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Reload your systemd configuration to let it know about the new service:&lt;br&gt;
&lt;code&gt;sudo systemctl daemon-reload&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start the service:&lt;br&gt;
&lt;code&gt;sudo systemctl start translate_bot&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Make sure the service is up and running:&lt;br&gt;
&lt;code&gt;sudo systemctl status translate_bot&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;7.To have your service automatically start when the system starts, run the command:&lt;br&gt;
&lt;code&gt;sudo systemctl enable rust_service&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Your Rust application will run as a system service managed by systemd. You can control it using standard systemd commands such as start, stop, restart, and status.&lt;/p&gt;

&lt;p&gt;P.S. I would also like to solve the problem with env files so that they can be accessed in a function from main.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next in my plans:&lt;/strong&gt; I would like to implement event processing if a new user appears in the chat (and also showers). The user can choose the language in which he would like to receive translations. The users themselves and their settings will be stored in the PostgreSQL database&lt;/p&gt;

&lt;p&gt;Thank you all for your attention! I posted the source code on GitHub.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/digkill/telegram_bot_translate_rust" rel="noopener noreferrer"&gt;Source on GitHub&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
