<?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: Mikael Lavi</title>
    <description>The latest articles on DEV Community by Mikael Lavi (@kjue).</description>
    <link>https://dev.to/kjue</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F184379%2Fc6ee93b6-181b-4661-afbb-0bd520b7b90f.jpeg</url>
      <title>DEV Community: Mikael Lavi</title>
      <link>https://dev.to/kjue</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kjue"/>
    <language>en</language>
    <item>
      <title>Node CLI for any server</title>
      <dc:creator>Mikael Lavi</dc:creator>
      <pubDate>Tue, 14 Oct 2025 07:35:05 +0000</pubDate>
      <link>https://dev.to/kjue/node-cli-for-any-server-2cb5</link>
      <guid>https://dev.to/kjue/node-cli-for-any-server-2cb5</guid>
      <description>&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; I wanted CLI for my Node servers and used &lt;a href="https://gist.github.com/Kjue/7488e9508c782dfae73dd5cfeaaec1a3" rel="noopener noreferrer"&gt;unix socket to build it&lt;/a&gt;. I also made a &lt;a href="https://gist.github.com/Kjue/45f7e86d0a547cab3a4e4a740da62aa2" rel="noopener noreferrer"&gt;non-blocking version&lt;/a&gt;. Come to think of it you can apply this easily with other languages too like &lt;a href="https://gist.github.com/Kjue/fed81f79e84c0cfd28219bc46bb8a133" rel="noopener noreferrer"&gt;Go&lt;/a&gt; and &lt;a href="https://gist.github.com/Kjue/7e644a37254fb8d431580eb0e2daebb7" rel="noopener noreferrer"&gt;Python&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I was playing around with the idea about having CLI commands for the server running on Linux. We've had this for some time with &lt;a href="https://pm2.keymetrics.io/docs/usage/process-actions/" rel="noopener noreferrer"&gt;pm2&lt;/a&gt; (process manager 2) essentially and moving away from it has left us missing commands like create organization or checking the server status from command line. The possibilities for such commands is endless.&lt;/p&gt;

&lt;p&gt;It started out as an investigation of other libraries that might provide the scaffold on which to build the capability, but nothing really came out of it. Prompting Gemini yielded same old results that &lt;em&gt;"use REST API and just curl it"&lt;/em&gt;. Which makes sense of course. It is a bit of an mindset that I do not want to expose certain parts of the program even by design to the internet, so I wanted an alternative.&lt;/p&gt;

&lt;p&gt;I asked the AI to focus on reviewing how the pm2 daemon works with RPC commands. It got around to it and still gave the same recommendation. Still not satisfying. It was the question about alternatives to pm2 daemon that brought up the Node cluster along with systemd library.&lt;/p&gt;

&lt;p&gt;It is the interprocess communication I find valuable in the example rather than the worker to ensure non-blocking to the main process. The IPC Unix socket, or a file socket, makes it so that it can be called only from the local system. I got distracted that the cluster was the key but its not.&lt;/p&gt;

&lt;p&gt;Now the server could certainly be made so that it checks for the existence of the listener already or it starts it. When it is running though, you can issue commands like status and stop to it and it responds back. It should not matter that the server is running inside a process manager even, since it would still establish the exact same control. This sounds like exactly what I was after.&lt;/p&gt;

&lt;p&gt;It is important to get the right prompt for the AI to generate the right samples, so here's the one I used.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"Let's assume I would use the cluster module. I'd like you to present an example version where the main server startup just creates the master node, and any subsequent instances would check its presence and offer CLI help on commands like "status" to call on the master."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The final solution took a bit more doing, but it works! Here's it running:&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="nv"&gt;$ &lt;/span&gt;node host.js
ℹ️ No active server found. Starting a new one...
🚀 Server process with PID: 515 is starting.
   ✅ Application logic is running &lt;span class="k"&gt;in &lt;/span&gt;this process.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And in the next terminal I could call up the same call and after that call with a command.&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="nv"&gt;$ &lt;/span&gt;node host.js
ℹ️ Server is already running.

Usage: node app.js &amp;lt;&lt;span class="nb"&gt;command&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;arguments]

Available commands:
  status
  create:org &amp;lt;name&amp;gt;
  stop

&lt;span class="nv"&gt;$ &lt;/span&gt;node host.js status
&lt;span class="o"&gt;{&lt;/span&gt;
  &lt;span class="s2"&gt;"workerPid"&lt;/span&gt;: 515,
  &lt;span class="s2"&gt;"uptime"&lt;/span&gt;: &lt;span class="s2"&gt;"14s"&lt;/span&gt;,
  &lt;span class="s2"&gt;"memoryUsage"&lt;/span&gt;: &lt;span class="s2"&gt;"49MB"&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;I had fun creating this code! Please find the codes I made on my Github gists below. Feel free to use and mimic how you like them. They are after all a custom rolled logic for messaging. Hope you enjoyed!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I wanted CLI for my Node servers and used &lt;a href="https://gist.github.com/Kjue/7488e9508c782dfae73dd5cfeaaec1a3" rel="noopener noreferrer"&gt;unix socket to build it&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;I also made a &lt;a href="https://gist.github.com/Kjue/45f7e86d0a547cab3a4e4a740da62aa2" rel="noopener noreferrer"&gt;non-blocking version&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Come to think of it you can apply this easily with other languages too like &lt;a href="https://gist.github.com/Kjue/fed81f79e84c0cfd28219bc46bb8a133" rel="noopener noreferrer"&gt;Go&lt;/a&gt; and &lt;a href="https://gist.github.com/Kjue/7e644a37254fb8d431580eb0e2daebb7" rel="noopener noreferrer"&gt;Python&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>cli</category>
      <category>linux</category>
    </item>
    <item>
      <title>Vergilian - The speech coach</title>
      <dc:creator>Mikael Lavi</dc:creator>
      <pubDate>Sun, 14 Sep 2025 10:21:46 +0000</pubDate>
      <link>https://dev.to/kjue/vergilian-the-speech-coach-3g1a</link>
      <guid>https://dev.to/kjue/vergilian-the-speech-coach-3g1a</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/google-ai-studio-2025-09-03"&gt;Google AI Studio Multimodal Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;I'm thrilled to introduce &lt;strong&gt;Vergilian&lt;/strong&gt;, a revolutionary grading game designed to transform the way you learn and master new languages. This isn't just another flashcard app. Vergilian dives deep, providing an unprecedented level of real-time analysis on your spoken language. Bring your own text, read a comic book out to it, and check that you understand the story. Learn the story and retry your pronunciation so you get it. You'll get an instant score from 0-100 reflecting the quality of your pronunciation, along with an English translation for clarity. You'll immediately hear a perfectly pronounced audio sample of what the sentence should be like, giving you an immediate goal to strive for. No vague advice, just clear, direct feedback.&lt;/p&gt;

&lt;p&gt;We named this app in honor of Publius Vergilius Maro, the legendary Roman poet known for his beautiful and masterful use of language. Virgil understood that true command of a language wasn't just about knowing the words—it was about speaking them with grace and power. Vergilian is built to continue his legacy, making expert pronunciation accessible to everyone.&lt;/p&gt;

&lt;p&gt;You can replay any of your previous attempts, switch difficulty levels on the fly, and even listen back to your own voice to track your progress. It's about empowering you to take control of your language journey with a powerful, intuitive tool!&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;Ready to hear the difference? Dive in and try Vergilian for yourself!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://vergilian-the-speech-coach-557162999715.us-west1.run.app/" rel="noopener noreferrer"&gt;Vergilian - The speech coach&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Hope you enjoy it! Tell your friends too!&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Use It:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Choose Your Language&lt;/strong&gt;: Select the language you're eager to practice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Speak Your Phrase&lt;/strong&gt;: Say a word or phrase into the microphone. Don't worry about perfection on your first try – that's what the app is for!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get Instant Feedback&lt;/strong&gt;: Receive your score, the English translation, and hear a perfectly pronounced version of your input.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Practice &amp;amp; Improve&lt;/strong&gt;: Re-record your attempt, adjust the difficulty, and listen to your progress!&lt;/li&gt;
&lt;/ol&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%2F9lxf0v73dlhaqrzix9jo.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%2F9lxf0v73dlhaqrzix9jo.jpg" alt="Main application UI"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How I Used Google AI Studio
&lt;/h2&gt;

&lt;p&gt;Building an app with such sophisticated real-time language analysis capabilities might sound like a monumental task, but thanks to the incredible power of &lt;strong&gt;Google AI Studio and Gemini 2.5 Pro&lt;/strong&gt;, it was an exhilarating journey! My primary approach involved leveraging Gemini 2.5 Pro as the core intelligence behind Vergilian. I prompted Gemini 2.5 Pro to generate the foundational code and logic for the application, specifically focusing on its multimodal understanding and generation capabilities. This allowed me to concentrate on the user experience while relying on Gemini to handle the heavy lifting of language processing. I engaged in an iterative prompting process, making several adjustments and refinements, which Gemini handled seamlessly, adapting to my evolving requirements for the grading system, translation, and audio generation.&lt;/p&gt;

&lt;h1&gt;
  
  
  Multimodal Features
&lt;/h1&gt;

&lt;p&gt;The "multimodal" aspect of Vergilian is what truly sets it apart, and it's where Google AI Studio's capabilities shone brightest.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Speech-to-Text &amp;amp; Language Understanding&lt;/strong&gt;: The app listens to your spoken input (audio), processes it, and understands the language. This multimodal input (audio) is crucial for evaluating pronunciation and translating the phrase.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Text Generation (Translation &amp;amp; Scoring)&lt;/strong&gt;: Based on your input, the app generates text output in two forms: a precise English translation and a numerical score (0-100). This provides immediate visual feedback.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Text-to-Speech (Pronunciation Model)&lt;/strong&gt;: This is perhaps the most impactful multimodal feature. The app takes the &lt;em&gt;correctly pronounced text&lt;/em&gt; (generated internally based on your input's meaning) and converts it back into high-quality spoken audio. This allows users to immediately compare their pronunciation with an ideal version, fostering rapid improvement.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Image generation&lt;/strong&gt;: The cover image for this post is generated with Gemini app. It is created in the theme that the applications' name implies.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These features combine to create an incredibly rich and immersive learning experience. By seamlessly integrating audio input, text analysis, and audio output, Vergilian provides a comprehensive feedback loop that is far more engaging and effective than traditional methods. It’s not just about reading or writing; it’s about truly hearing, understanding, and speaking the language with confidence!&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>googleaichallenge</category>
      <category>ai</category>
      <category>gemini</category>
    </item>
  </channel>
</rss>
