<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[The Digital Alchemist's Log]]></title><description><![CDATA[The Digital Alchemist's Log]]></description><link>https://blog.alchemists.my.id</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 08:21:06 GMT</lastBuildDate><atom:link href="https://blog.alchemists.my.id/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Create a Simple API with Hono]]></title><description><![CDATA[________________________________________________
What’s API
An API is a set of rules that allows different software applications to communicate. It acts as a bridge that delivers your request to a server and sends the response back to you.
__________...]]></description><link>https://blog.alchemists.my.id/create-a-simple-api-with-hono</link><guid isPermaLink="true">https://blog.alchemists.my.id/create-a-simple-api-with-hono</guid><category><![CDATA[api]]></category><category><![CDATA[hono]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[learning]]></category><category><![CDATA[technology]]></category><category><![CDATA[tech ]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[EchoAPI]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Tue, 13 Jan 2026 13:03:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768309349720/9762d325-0a2f-408f-ae86-b27f561de25e.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>________________________________________________</p>
<h2 id="heading-whats-api">What’s API</h2>
<p>An API is a set of rules that allows different software applications to communicate. It acts as a bridge that delivers your request to a server and sends the response back to you.</p>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-lets-try-with-me">Let’s Try With Me!</h2>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-setup">Setup</h2>
<p>____________________________________________________________________________</p>
<h3 id="heading-technology">Technology</h3>
<ul>
<li><p>Node.js</p>
</li>
<li><p>Hono</p>
</li>
<li><p>Echo API / postman / other application for testing API</p>
</li>
</ul>
<p>____________________________________________________________________________</p>
<h3 id="heading-structure-file">Structure File</h3>
<p>Project</p>
<p>|— index.js</p>
<p>____________________________________________________________________________</p>
<h3 id="heading-init-amp-install-project">Init &amp; Install Project</h3>
<ul>
<li>NPM init</li>
</ul>
<pre><code class="lang-bash">npm init -y
</code></pre>
<ul>
<li>Install Hono</li>
</ul>
<pre><code class="lang-bash">npm install hono @hono/node-server
</code></pre>
<ul>
<li>Install Echo API in extension if you use Visual Studio Code or from website</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768360619052/e7b282ad-d244-4597-9140-0c6f25b453ad.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Add and updaten a little code in package.json</li>
</ul>
<pre><code class="lang-json"><span class="hljs-string">"type"</span>: <span class="hljs-string">"module"</span>,
<span class="hljs-string">"scripts"</span>: {
  <span class="hljs-attr">"start"</span>: <span class="hljs-string">"node index.js"</span>
}
</code></pre>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-code-code">Code Code!</h2>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-main-code">Main Code</h2>
<p>____________________________________________________________________________</p>
<p>Index.js Code</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { Hono } <span class="hljs-keyword">from</span> <span class="hljs-string">"hono"</span>;
<span class="hljs-keyword">import</span> { serve } <span class="hljs-keyword">from</span> <span class="hljs-string">"@hono/node-server"</span>;

<span class="hljs-keyword">const</span> app = <span class="hljs-keyword">new</span> Hono();

app.get(<span class="hljs-string">"/"</span>, <span class="hljs-function">(<span class="hljs-params">c</span>) =&gt;</span> {
    <span class="hljs-keyword">return</span> c.html(<span class="hljs-string">`
        &lt;h1&gt;Hello Hono&lt;/h1&gt;
        &lt;p&gt;Available routes:&lt;/p&gt;
        &lt;ul&gt;
        &lt;li&gt;&lt;a href="/text"&gt;/text&lt;/a&gt; - Show Normal Text&lt;/li&gt;

        &lt;li&gt;&lt;a href="/json"&gt;/json&lt;/a&gt; - Show JSON Output&lt;/li&gt;
        &lt;/ul&gt;`</span>);
});

<span class="hljs-comment">// Rute untuk Text</span>
app.get(<span class="hljs-string">"/text"</span>, <span class="hljs-function">(<span class="hljs-params">c</span>) =&gt;</span> c.text(<span class="hljs-string">"this is a normal text response"</span>));

<span class="hljs-comment">// Rute untuk JSON</span>
app.get(<span class="hljs-string">"/json"</span>, <span class="hljs-function">(<span class="hljs-params">c</span>) =&gt;</span> c.json({<span class="hljs-attr">data</span> : <span class="hljs-string">"Hello Everyone."</span>, <span class="hljs-attr">status</span>: <span class="hljs-string">"ok"</span>}));

serve({<span class="hljs-attr">fetch</span>: app.fetch, <span class="hljs-attr">port</span>:<span class="hljs-number">3100</span>}, <span class="hljs-function">(<span class="hljs-params">info</span>) =&gt;</span> {
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`server run in http://localhost:<span class="hljs-subst">${info.port}</span>`</span>);
});
</code></pre>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-testing">Testing</h2>
<p>____________________________________________________________________________</p>
<h3 id="heading-run-code">Run Code</h3>
<pre><code class="lang-javascript">npm run start
</code></pre>
<p>____________________________________________________________________________</p>
<h3 id="heading-echo-api">Echo API</h3>
<ul>
<li><p>Click <code>HTTP1/2 Request</code> for get new file testing api</p>
</li>
<li><p>fill in the url section with this <code>http://localhost:3100/json</code></p>
</li>
<li><p>Change <code>POST</code> to <code>GET</code></p>
</li>
<li><p>Click Send</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768271136671/4b38a422-4099-47c8-b56a-2c68c0a72845.png" alt class="image--center mx-auto" /></p>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-closing">Closing</h2>
<p>__________________________________________________________________________________________________________</p>
<p>And that’s it—you’ve just created your first API with Hono.<br />Think of this API as a clean, direct gateway that knows exactly how to receive a request and return the right response.<br />This simple setup is the backbone of many real-world backend systems.<br />Now that the gateway is open, what service will you connect next?<br />Keep building and happy coding 🚀</p>
<p>__________________________________________________________________________________________________________</p>
]]></content:encoded></item><item><title><![CDATA[Create a Simple Fetch in JavaScript]]></title><description><![CDATA[________________________________________________
What’s Fetch
Fetch is a built-in JavaScript function used to make network requests. It is the action of going to an API's URL to retrieve information and bringing it back to your code.
________________...]]></description><link>https://blog.alchemists.my.id/create-a-simple-fetch-in-javascript</link><guid isPermaLink="true">https://blog.alchemists.my.id/create-a-simple-fetch-in-javascript</guid><category><![CDATA[fetch]]></category><category><![CDATA[fetch API]]></category><category><![CDATA[example]]></category><category><![CDATA[technology]]></category><category><![CDATA[tech ]]></category><category><![CDATA[js]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[HTML]]></category><category><![CDATA[projects]]></category><category><![CDATA[learning]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Tue, 13 Jan 2026 13:01:18 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768187119990/ebd44fbc-dadf-4c7f-b437-6295b14e27c2.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>________________________________________________</p>
<h2 id="heading-whats-fetch">What’s Fetch</h2>
<p>Fetch is a built-in JavaScript function used to make network requests. It is the <strong>action</strong> of going to an API's URL to retrieve information and bringing it back to your code.</p>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-lets-try-with-me">Let’s Try With Me!</h2>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-setup">Setup</h2>
<p>____________________________________________________________________________</p>
<h3 id="heading-technology">Technology</h3>
<ul>
<li><p>JavaScript</p>
</li>
<li><p>HTML</p>
</li>
</ul>
<p>____________________________________________________________________________</p>
<h3 id="heading-structure-file">Structure File</h3>
<p>Project</p>
<p>|— index.html</p>
<p>|— script.js</p>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-code-code">Code Code!</h2>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-url">URL</h2>
<p>____________________________________________________________________________</p>
<p>This Example URL</p>
<pre><code class="lang-bash">https://jsonplaceholder.typicode.com/users
</code></pre>
<p>Before we use this url, we can test this url with echo api</p>
<ul>
<li><p>first you can download echo api extension in vs code</p>
</li>
<li><p>then click http1/2 request</p>
</li>
<li><p>after that change <code>POST</code> to <code>GET</code></p>
</li>
<li><p>then click send and you will see the data from that api or that url</p>
</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768360427799/17a06efc-5fa9-40c5-8437-f2591e061967.png" alt class="image--center mx-auto" /></p>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-html">HTML</h2>
<p>____________________________________________________________________________</p>
<h3 id="heading-code-indexhtml">Code index.html</h3>
<pre><code class="lang-xml"><span class="hljs-tag">&lt;<span class="hljs-name">html</span> <span class="hljs-attr">lang</span>=<span class="hljs-string">"en"</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">head</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Trying Fetch API<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">head</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">body</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>users<span class="hljs-tag">&lt;/<span class="hljs-name">h1</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"users-container"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>
    <span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"module"</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"script.js"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">html</span>&gt;</span>
</code></pre>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-javascript">JAVASCRIPT</h2>
<p>____________________________________________________________________________</p>
<h3 id="heading-code-scriptjs">Code script.js</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> usersContainer = <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"users-container"</span>);

<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fetchUsers</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">try</span> {
    <span class="hljs-keyword">const</span> response = <span class="hljs-keyword">await</span> fetch(<span class="hljs-string">"https://jsonplaceholder.typicode.com/users"</span>);
    <span class="hljs-keyword">const</span> users = <span class="hljs-keyword">await</span> response.json();

    users.forEach(<span class="hljs-function">(<span class="hljs-params">user</span>) =&gt;</span> {
      <span class="hljs-keyword">const</span> userDiv = <span class="hljs-built_in">document</span>.createElement(<span class="hljs-string">"div"</span>);
      userDiv.innerHTML = <span class="hljs-string">`
        &lt;h2&gt;<span class="hljs-subst">${user.name}</span>&lt;/h2&gt;
        &lt;p&gt;Email: <span class="hljs-subst">${user.email}</span>&lt;/p&gt;
        &lt;p&gt;Phone: <span class="hljs-subst">${user.phone}</span>&lt;/p&gt;
      `</span>;
      usersContainer.appendChild(userDiv);
    });
  } <span class="hljs-keyword">catch</span> (error) {
    <span class="hljs-built_in">console</span>.error(<span class="hljs-string">"Error fetching users:"</span>, error);
  }
}

fetchUsers();
</code></pre>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-see-result">See Result</h2>
<p>____________________________________________________________________________</p>
<ul>
<li>Right-Click and choose Show Preview or Open With Live Server, If you don't have it yet, first download the extension in VS Code called "show preview" or "live server".</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768355201276/4bda5d5e-49fe-4622-9505-c820fdd979b8.png" alt class="image--center mx-auto" /></p>
<ul>
<li>And This is Result</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768355244052/48748657-b89d-4077-b47a-ac376c11c15d.png" alt class="image--center mx-auto" /></p>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-little-a-explain">Little A Explain</h2>
<p>____________________________________________________________________________</p>
<ul>
<li><p>We create a container to display the data using a <code>div</code> with the ID <code>users-container</code>.</p>
</li>
<li><p>In JavaScript, we create an asynchronous function named <code>fetchUsers</code>.</p>
</li>
<li><p>We use <code>fetch</code> to get data from the URL and store it in the <code>response</code> variable.</p>
</li>
<li><p>We convert that response into a JSON format so we can read the data easily.</p>
</li>
<li><p>We loop through the <code>users</code> array and create a new <code>div</code> for each person.</p>
</li>
<li><p>Finally, we append all those elements into our main container.</p>
</li>
</ul>
<p>__________________________________________________________________________________________________________</p>
<h2 id="heading-closing">Closing</h2>
<p>And there you have it! You have successfully built your very first <strong>"Digital Bridge"</strong>.</p>
<p>Using the <strong>Fetch API</strong> is like sending a professional messenger to gather treasures from across the internet and bringing them home to your website. This simple piece of code is the foundation of almost every modern app you see today.</p>
<p>Now that the messenger knows the way, what kind of data will you ask for next? Keep practicing, and happy coding! 🚀</p>
<p>__________________________________________________________________________________________________________</p>
]]></content:encoded></item><item><title><![CDATA[Connection to Database with Drizzle ORM in Node.js]]></title><description><![CDATA[___________________________________________
What’s
Today we’ll build a data courier system. The goal is to connect our application code to a database so we can seamlessly send and retrieve data using the Drizzle ORM.
_________________________________...]]></description><link>https://blog.alchemists.my.id/connection-to-database-with-drizzle-orm-in-nodejs</link><guid isPermaLink="true">https://blog.alchemists.my.id/connection-to-database-with-drizzle-orm-in-nodejs</guid><category><![CDATA[DrizzleORM]]></category><category><![CDATA[supabase]]></category><category><![CDATA[Databases]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[dotenv]]></category><category><![CDATA[technology]]></category><category><![CDATA[tech ]]></category><category><![CDATA[connection]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Sat, 10 Jan 2026 03:29:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1768177639933/37effc8a-0afe-4d5f-a08e-7b9d4333a6ef.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>___________________________________________</p>
<h2 id="heading-whats">What’s</h2>
<p>Today we’ll build a data courier system. The goal is to connect our application code to a database so we can seamlessly send and retrieve data using the Drizzle ORM.</p>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-lets-try-with-me">Let’s Try With Me!!</h2>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-setup">Setup</h2>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-technology">Technology</h3>
<ul>
<li><p>Node JS</p>
</li>
<li><p>Drizzle ORM</p>
</li>
<li><p>Supabase</p>
</li>
</ul>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-structure-file">Structure File</h3>
<p>project/</p>
<p>|— index.js</p>
<p>|— schema.js</p>
<p>|— seed.js</p>
<p>|— .env</p>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-create-database">Create Database</h3>
<ul>
<li><p>Login in Supabase</p>
</li>
<li><p>Create project</p>
</li>
</ul>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-init-amp-install-project">Init &amp; Install Project</h3>
<ul>
<li>NPM Init</li>
</ul>
<pre><code class="lang-javascript">npm init -y
</code></pre>
<ul>
<li>Install Drizzle ORM</li>
</ul>
<pre><code class="lang-bash">npm install drizzle-orm pg
npm install -D drizzle-kit
</code></pre>
<ul>
<li>Install .env</li>
</ul>
<pre><code class="lang-bash">npm install dotenv
</code></pre>
<ul>
<li>Update file package.json, add this code in file package.json</li>
</ul>
<pre><code class="lang-json"><span class="hljs-string">"type"</span>: <span class="hljs-string">"method"</span>,
</code></pre>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-code-code">Code Code!!</h2>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-connect-to-database">Connect to Database</h2>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-supabase">Supabase</h3>
<ul>
<li>Click connect</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768357242522/d3e8c772-1451-4061-876f-3a51ea4f6293.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Click and Click, then choose Transaction Pooler and copy url</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768358068794/df3a85d4-01a5-4eaa-a54b-f885d94a3d9d.png" alt class="image--center mx-auto" /></p>
<ul>
<li>and paste in file .env and write your password account in supabase</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768358395674/c276e0d7-8533-4212-acce-9f70da46cd66.png" alt class="image--center mx-auto" /></p>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-code-indexjs">Code Index.js</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { drizzle } <span class="hljs-keyword">from</span> <span class="hljs-string">'drizzle-orm/node-postgres'</span>;
<span class="hljs-keyword">import</span> { Pool } <span class="hljs-keyword">from</span> <span class="hljs-string">'pg'</span>;
<span class="hljs-keyword">import</span> * <span class="hljs-keyword">as</span> schema <span class="hljs-keyword">from</span> <span class="hljs-string">'./schema.js'</span>

<span class="hljs-keyword">const</span> pool = <span class="hljs-keyword">new</span> Pool({
    <span class="hljs-attr">connectionString</span>: process.env.DATABASE_URL,
    <span class="hljs-attr">ssl</span>: { <span class="hljs-attr">rejectUnauthorized</span>: <span class="hljs-literal">false</span> }
})

<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> db = drizzle(pool, { schema })
</code></pre>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-create-file-drizzle">Create file Drizzle</h3>
<p>Create File drizzle.config.js</p>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> <span class="hljs-string">'dotenv/config'</span>

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> {
    <span class="hljs-attr">dialect</span>: <span class="hljs-string">'postgresql'</span>,
    <span class="hljs-attr">schema</span>: <span class="hljs-string">'./schema.js'</span>,
    <span class="hljs-attr">out</span>: <span class="hljs-string">'./drizzle'</span>,
    <span class="hljs-attr">dbCredentials</span>: {
        <span class="hljs-attr">url</span>: process.env.DATABASE_URL,
        <span class="hljs-attr">ssl</span>: { <span class="hljs-attr">rejectUnauthorized</span>: <span class="hljs-literal">false</span> }
    }
}
</code></pre>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-schema-database">Schema Database</h2>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-code-schemajs">Code Schema.js</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { pgTable, serial, varchar, text, integer, timestamp, numeric } <span class="hljs-keyword">from</span> <span class="hljs-string">'drizzle-orm/pg-core'</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> note = pgTable(<span class="hljs-string">'latihan_catatan'</span>, {
    <span class="hljs-attr">id</span>: serial(<span class="hljs-string">'id'</span>).primaryKey(),
    <span class="hljs-attr">note</span>: varchar(<span class="hljs-string">'note'</span>, { <span class="hljs-attr">length</span>: <span class="hljs-number">256</span> }).notNull()
})
</code></pre>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-update-file-packagejson-in-scripts">Update File ‘package.json‘ in ‘scripts‘</h3>
<pre><code class="lang-javascript"><span class="hljs-string">"scripts"</span>: {
  <span class="hljs-string">"db:generate"</span>: <span class="hljs-string">"drizzle-kit generate"</span>,
  <span class="hljs-string">"db:migrate"</span>: <span class="hljs-string">"drizzle-kit migrate"</span>
},
</code></pre>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-run-code">Run Code</h3>
<ul>
<li>open your terminal with <code>ctrl</code> + <code>` </code> or click like this and choose terminal</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768359475734/ee670d03-0e21-4400-a0f2-9819afd41f9b.png" alt class="image--center mx-auto" /></p>
<ul>
<li>Write <code>npm run db:generate</code> then <code>npm run db:migrate</code> in terminal</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768015417011/310fffa1-e8ef-49ea-ad1e-0279ef940054.png" alt class="image--center mx-auto" /></p>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-seed-data">Seed Data</h2>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-code-seedjs">Code Seed.js</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> <span class="hljs-string">'dotenv/config'</span>;
<span class="hljs-keyword">import</span> { db } <span class="hljs-keyword">from</span> <span class="hljs-string">'./index.js'</span>;
<span class="hljs-keyword">import</span> { note } <span class="hljs-keyword">from</span> <span class="hljs-string">'./schema.js'</span>;

<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">seed</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Sedding database......'</span>)
    <span class="hljs-keyword">await</span> db.delete(note)

    <span class="hljs-keyword">const</span> note1 = <span class="hljs-keyword">await</span> db.insert(note).values({
        <span class="hljs-attr">note</span>: <span class="hljs-string">"First step"</span>
    })
    .returning();

    <span class="hljs-built_in">console</span>.log(note1);
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'✅ Sedding completed!'</span>)
    process.exit(<span class="hljs-number">0</span>)
}

seed().catch(<span class="hljs-function">(<span class="hljs-params">err</span>) =&gt;</span> {
    <span class="hljs-built_in">console</span>.error(<span class="hljs-string">'❌ Sedding failed:'</span>, err);
    process.exit(<span class="hljs-number">1</span>)
})
</code></pre>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-update-file-packagejson-in-scripts-1">Update File ‘package.json‘ in ‘scripts‘</h3>
<pre><code class="lang-javascript"><span class="hljs-string">"scripts"</span>: {
    <span class="hljs-string">"db:seed"</span>: <span class="hljs-string">"node seed.js"</span>
  }
</code></pre>
<ul>
<li>Run code with write <code>npm run db:seed</code> in terminal</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768359043311/d3253cee-b8a9-4106-bb6d-ab51d2c970fe.png" alt class="image--center mx-auto" /></p>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-see-result">See Result</h2>
<p>___________________________________________________________________________________________</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768359160521/ac7c979e-6d6d-4f41-a702-94b0f23ca916.png" alt class="image--center mx-auto" /></p>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-update-column">Update Column</h2>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-update-code-schemajs">Update Code Schema.js</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">export</span> <span class="hljs-keyword">const</span> note = pgTable(<span class="hljs-string">'latihan_catatan'</span>, {
    <span class="hljs-attr">id</span>: serial(<span class="hljs-string">'id'</span>).primaryKey(),
    <span class="hljs-attr">name</span>: varchar(<span class="hljs-string">'name'</span>, { <span class="hljs-attr">length</span>: <span class="hljs-number">256</span> }).default(<span class="hljs-string">'Anonymous'</span>).notNull(),
    <span class="hljs-attr">note</span>: varchar(<span class="hljs-string">'note'</span>, { <span class="hljs-attr">length</span>: <span class="hljs-number">256</span> }).notNull()
})
</code></pre>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-run-code-1">Run Code</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768015562898/95763325-253f-4fad-a85f-ff2d0d265029.png" alt class="image--center mx-auto" /></p>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-update-code-seedjs">Update Code Seed.js</h3>
<pre><code class="lang-javascript"><span class="hljs-keyword">const</span> note1 = <span class="hljs-keyword">await</span> db.insert(note).values({
        <span class="hljs-attr">name</span>: <span class="hljs-string">"The Champion"</span>,
        <span class="hljs-attr">note</span>: <span class="hljs-string">"We Are Champion"</span>
    })
    .returning();
</code></pre>
<p>___________________________________________________________________________________________</p>
<h3 id="heading-run-code-2">Run Code</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768015569253/b680a0a1-6d66-47cf-9509-fc2bca8c5e3a.png" alt class="image--center mx-auto" /></p>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-see-result-1">See Result</h2>
<p>___________________________________________________________________________________________</p>
<ul>
<li>This is result, we can add data to database</li>
</ul>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1768357096706/94b9ed84-ceda-4750-b476-3e35b7386a48.png" alt class="image--center mx-auto" /></p>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-repository">Repository</h2>
<ul>
<li>Github: <a target="_blank" href="https://github.com/MC-AHN/connection_to_database">https://github.com/MC-AHN/connection_to_database</a></li>
</ul>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-closing">Closing</h2>
<p>_____________________________________________________________________________________________________</p>
<p>Congratulations! You’ve just successfully built a solid <strong>data pipeline</strong>. Your application is no longer just isolated code—it can now seamlessly communicate with a PostgreSQL database.</p>
<p>From this project, we’ve learned how to:</p>
<ul>
<li><p><strong>Build the Bridge:</strong> Connect Node.js to a database using the lightweight and fast <strong>Drizzle ORM</strong>.</p>
</li>
<li><p><strong>Design the Blueprint:</strong> Create and update table structures (schemas) with ease.</p>
</li>
<li><p><strong>Test with Confidence:</strong> Use <strong>Seeding</strong> to automatically fill your database with sample data for quick testing.</p>
</li>
</ul>
<p>By skipping SSL, we've kept our setup simple and perfect for learning or local development. As you move forward, you can explore more complex data relationships or even add security layers when you're ready to take your project to the next level.</p>
<p><strong>Happy coding and keep building!</strong> 🚀</p>
<p>_____________________________________________________________________________________________________</p>
]]></content:encoded></item><item><title><![CDATA[Fighting Errors: My Story of Building an API with Hono & Drizzle]]></title><description><![CDATA[______________________________________________
About Project
In this project, we will build a bridge that can connect an API with a database.

Hono will be the architect who designs and builds the main bridge.

Drizzle serves as the inspector who mai...]]></description><link>https://blog.alchemists.my.id/fighting-errors-my-story-of-building-an-api-with-hono-and-drizzle</link><guid isPermaLink="true">https://blog.alchemists.my.id/fighting-errors-my-story-of-building-an-api-with-hono-and-drizzle</guid><category><![CDATA[api]]></category><category><![CDATA[hono]]></category><category><![CDATA[drizzle]]></category><category><![CDATA[error handling]]></category><category><![CDATA[Story]]></category><category><![CDATA[npm]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[Hashnode]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[EchoAPI]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Fri, 26 Sep 2025 01:41:16 GMT</pubDate><content:encoded><![CDATA[<p>______________________________________________</p>
<h2 id="heading-about-project">About Project</h2>
<p>In this project, we will <strong>build a bridge</strong> that can connect an API with a database.</p>
<ul>
<li><p><strong>Hono</strong> will be the <strong>architect</strong> who designs and builds the main bridge.</p>
</li>
<li><p><strong>Drizzle</strong> serves as the <strong>inspector</strong> who maintains type safety, This will help us prevent data and query errors, and ensure that every "vehicle" (data) that passes has the proper credentials.</p>
</li>
</ul>
<p>The goal is simple: to create seamless and secure communication between the API and the database, and avoid various common issues.</p>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-and-this-my-story"><strong>And This My Story</strong></h2>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-gearing-up-preparation">Gearing Up (Preparation)</h2>
<p>Before we start writing code, let's get all the tools and "ammunition" ready.</p>
<ol>
<li><p><strong>Main Tools</strong></p>
<ul>
<li><p><strong>Visual Studio Code (VS Code):</strong> Get it here: <a target="_blank" href="https://code.visualstudio.com/">https://code.visualstudio.com/</a>.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758852177500/bbd43d59-b48e-4a62-9292-e92573590b9a.png" alt class="image--center mx-auto" /></p>
<p>  Click download for windows if you use windows, else you can click other platform in below download for windows</p>
</li>
<li><p><strong>Node.js:</strong> Make sure you have this installed. If not, you can follow the guide in your own article: <a target="_blank" href="http://blog.alchemists.my.id/">http://blog.alchemists.my.id/</a><a target="_blank" href="https://the-digital-alchemists-log.hashnode.dev/download-node-js-and-try-with-git-bash">d</a><a target="_blank" href="http://blog.alchemists.my.id/fighting-errors-my-story-of-building-an-api-with-hono-and-drizzle">ownload-node-js-and-try-with-</a><a target="_blank" href="https://the-digital-alchemists-log.hashnode.dev/download-node-js-and-try-with-git-bash">git-bash</a> or <a target="_blank" href="https://the-digital-alchemists-log.hashnode.dev/download-node-js-and-try-with-git-bash">https://the-digital-alchemists-log.hashnode.dev/download-node-js-and-try-with-git-bash</a></p>
</li>
</ul>
</li>
<li><p>Setting Up the Worksplace</p>
<ul>
<li><p><strong>Create Your Project Folder:</strong> Make a new folder for this project using <em>Git Bash</em> or your <em>File Explorer</em>, for example i create folder with git bash</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758852428916/f9851b01-a82d-4445-9eb7-eb3433a19715.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Create Basic Structure:</strong> inside your project folder, make the following folder and files:</p>
<ul>
<li><p>Create a new folder named <code>db</code></p>
</li>
<li><p>inside the <code>db</code> folder, create three files: <code>schema.js</code> , <code>index.js</code> , and <code>seed.js</code></p>
</li>
</ul>
</li>
</ul>
</li>
<li><p>Installing the “Troops” ( Dependencies )</p>
<p> Open terminal in Visual Studio Code with click CTRL + ` (Grave accent above the tab key on the keyboard)</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758853877456/0639a846-72b8-4e54-9d46-4bec8c5b6d5f.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758853986652/0cee5fad-0811-4b32-a8ba-c1e09adc59c6.png" alt class="image--center mx-auto" /></p>
<p> Choose git bash</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758853991712/dbd6dd7b-dc00-45f3-991c-fe61c9468a9c.png" alt class="image--center mx-auto" /></p>
<p> And run these commands one by one:</p>
<ol>
<li><p>initialize the NPM project:</p>
<pre><code class="lang-bash"> npm init -y
</code></pre>
<p> after initialize npm go to file package.json and add <code>“type“: “module“,</code></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758896669684/7f14057d-2e31-452d-adf4-0d88aa0c3aec.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Install Core Dependencies: (Drizzle ORM, PostgreSQL Driver, Dotenv)</p>
<pre><code class="lang-bash"> npm install drizzle-orm pg dotenv
</code></pre>
</li>
<li><p>Setup <code>.env</code> , create file <code>.env</code> and write like this</p>
<p> This Query</p>
<pre><code class="lang-javascript"> DATABASE_URL=<span class="hljs-string">"postgresql://[user]:[password]@[host]:5432/[name-database]"</span>
</code></pre>
<p> This my code</p>
<pre><code class="lang-javascript"> DATABASE_URL=<span class="hljs-string">"postgresql://postgres:postgres@localhost:5432/dbproject2"</span>
</code></pre>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758954029903/adea52c3-278d-44e6-98a4-0600140d4089.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>install the Server Framework: (Hono)</p>
<pre><code class="lang-bash"> npm install hono @hono/node-server
</code></pre>
</li>
<li><p>install Development Dependencies: (Drizzle Kit for migration and Nodemon for auto-restart)</p>
<pre><code class="lang-bash"> npm install -D drizzle-kit nodemon
</code></pre>
</li>
<li><p>Add Migration Script, in package.json file like this</p>
<pre><code class="lang-javascript">   <span class="hljs-string">"scripts"</span>: {
     <span class="hljs-string">"db:generate"</span>: <span class="hljs-string">"drizzle-kit generate"</span>,
     <span class="hljs-string">"db:migrate"</span>: <span class="hljs-string">"drizzle-kit migrate"</span>,
     <span class="hljs-string">"dev"</span>: <span class="hljs-string">"node --watch server.js"</span>,
     <span class="hljs-string">"start"</span>: <span class="hljs-string">"node server.js"</span>
   },
</code></pre>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758898054060/6fede809-821b-4243-a5d7-3fe1d34fb0a0.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Configuration Drizzle kit, create file <code>drizzle.config.js</code> and write like this</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">import</span> <span class="hljs-string">'dotenv/config'</span>;

 <span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> {
   <span class="hljs-attr">dialect</span>: <span class="hljs-string">'postgresql'</span>,
   <span class="hljs-attr">schema</span>: <span class="hljs-string">'./db/schema.js'</span>,
   <span class="hljs-attr">out</span>: <span class="hljs-string">'./drizzle'</span>,
   <span class="hljs-attr">dbCredentials</span>: {
     <span class="hljs-attr">url</span>: process.env.DATABASE_URL,
   },
 };
</code></pre>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758953772489/0573878c-e7bd-4ef6-8ac9-c82a602c8317.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
<li><p><strong>Extension and Git ( optional )</strong></p>
<ol>
<li><p>API Tester Extension: install the Echo API extension in Visual Studio Code to test out API later. (Search for <code>Echo API</code> in the Extension Marketplace ).</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758855159881/a4fedac6-9559-4529-9baf-0e5a46d0c432.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>initialize Git</p>
<pre><code class="lang-bash"> git init
</code></pre>
</li>
</ol>
</li>
</ol>
<p>Congratulations, you have finished preparing the equipment.</p>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-code-code">Code Code !!</h2>
<p>_______________________________________________________________________________________________________________</p>
<h2 id="heading-main-content"><strong>Main Content</strong></h2>
<p>we will enter the core of the project</p>
<h2 id="heading-create-code"><strong>Create Code</strong></h2>
<ol>
<li><p><code>db/schema.js</code> (The Blueprint Book) 📘</p>
<ul>
<li><p>This file is the <strong>blueprint</strong> for your database table. Here, you tell Drizzle exactly what kind of columns the <code>student</code> table needs.</p>
</li>
<li><p><strong>Import Tools</strong>: Import <code>pgTable</code> , <code>serial</code> , <code>varchar</code> , <code>timestamp</code> from <code>drizzle-orm/pg-core</code></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758953113354/42020e21-c9bc-445b-a44e-15066e1c8f16.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Create The Table:</strong> create table student like table student in database</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759113221086/449dd0a5-0303-412c-8b66-93ee7a370822.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>run generation and migrate</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758955806511/5b00c6eb-57e8-4f6a-82d5-9d168cb90d77.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
</li>
<li><p><code>db/index.js</code> (The Bridge Guide) 🌉</p>
<ul>
<li><p>This file is the <strong>actual connection point</strong>. It takes the database URL from your <code>.env</code> file and creates a <strong>connection pool</strong> (like a waiting area for connections) so your Hono server can talk to the database anytime it needs to.</p>
</li>
<li><p><strong>Import Essentials:</strong> Import <code>drizzle</code>, the <code>Pool</code> from <code>pg</code> , <code>dotenv</code> , and your new <code>schema</code></p>
</li>
<li><p><strong>Create Connection Pool:</strong> Set up the <code>Pool</code> using the <code>DATABASE_URL</code> from the environment.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758955896888/73d01e24-d2d7-4cf0-b316-e96d053593ce.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Initialize Drizzle:</strong> Use the pool to create the <code>db</code> object—this is the <strong>magic key</strong> you’ll use in all your API routers.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758956039374/7554aaa6-22e3-41f2-abbc-862f05123ba3.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
</li>
<li><p><code>db/seed.js</code> (The Initial Filler) 🌱</p>
<ul>
<li><p>This is your <strong>first round of data</strong>. Before you build the API endpoints, it's good practice to insert some initial data so you can test the "Read" functions right away.</p>
</li>
<li><p><strong>Import Essentials:</strong> <code>db</code> from <code>./index.js</code> and student table from <code>./schema.js</code></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758956346845/a4e20b50-460e-4cae-bbe4-eb16b27e4a40.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>The Main Function &amp; Insert Data:</strong></p>
<pre><code class="lang-javascript">  <span class="hljs-keyword">import</span> { db } <span class="hljs-keyword">from</span> <span class="hljs-string">"./index.js"</span>;
  <span class="hljs-keyword">import</span> { student } <span class="hljs-keyword">from</span> <span class="hljs-string">"./schema.js"</span>;

  <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">main</span>(<span class="hljs-params"></span>) </span>{
    <span class="hljs-keyword">await</span> db.insert(student).values([
      {
        <span class="hljs-attr">id</span>: <span class="hljs-number">1</span>,
        <span class="hljs-attr">name</span>: <span class="hljs-string">"Jeromy Alexanderia"</span>,
        <span class="hljs-attr">address</span>: <span class="hljs-string">"12 Abdelsalam Aref Street, Alexandria, Egypt"</span>,
      },
      {
        <span class="hljs-attr">id</span>: <span class="hljs-number">2</span>,
        <span class="hljs-attr">name</span>: <span class="hljs-string">"Jhon Doe"</span>,
        <span class="hljs-attr">address</span>: <span class="hljs-string">"145 Willow Lane, Springfield, IL, USA"</span>,
      },
      {
        <span class="hljs-attr">id</span>: <span class="hljs-number">3</span>,
        <span class="hljs-attr">name</span>: <span class="hljs-string">"Xia gang"</span>,
        <span class="hljs-attr">address</span>: <span class="hljs-string">"9 Fuxing Road, Chaoyang District, Beijing, China"</span>,
      },
    ]);
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">" Student data successfully seeded."</span>);
  }

  main();
</code></pre>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758956579545/35f907c3-899b-43ca-ad60-71caae2c6da2.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
</li>
</ol>
<p>_______________________________________________________________________________________________________________</p>
<h2 id="heading-building-the-control-tower">Building the Control Tower 🏗️</h2>
<p>This is the most exciting part! In the <code>server.js</code> file, we're going to power up the <strong>Hono</strong> engine and connect it to <strong>Drizzle</strong> (our <code>db</code> Magic Key).</p>
<p>We will create <strong>five API routes</strong> to handle the full CRUD lifecycle (<em>Create, Read, Update, Delete</em>), allowing our database to finally 'speak' to the outside world.</p>
<h3 id="heading-step-by-step">Step-By-Step</h3>
<ol>
<li><p><strong>Importing Essentials (Powering Up):</strong></p>
<ul>
<li><p><code>Hono</code> as the core server engine, <code>db</code> object, <code>student</code> table from drizzle and <code>eq</code> function</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758982388035/9db3986d-1479-4158-a37e-d38671ec03b4.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
</li>
<li><p><strong>Route [C] Create:</strong></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758982448390/55557279-61c4-4bc5-b89d-775227dac0cc.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Route [R] Read All:</strong></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758982486722/8c67042b-9c0f-4a6b-8498-0a25318b0c2e.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Route [R] Read One:</strong></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758982523657/912acc05-5331-484d-b17a-09bf7acf988d.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Route [U] Update:</strong></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758982553159/c49bd8c0-6e6d-458e-a853-9fc3b8dcd1a3.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Route [D] Delete:</strong></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758982582088/96b89ce2-a9c5-4f7c-a157-8ff1f81dc7e1.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>Info about API and server initialize:</strong></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758982681122/0596f184-4361-4810-8350-0dbda62480cc.png" alt class="image--center mx-auto" /></p>
</li>
<li><p><strong>ALL Code:</strong></p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">import</span> { Hono } <span class="hljs-keyword">from</span> <span class="hljs-string">'hono'</span>;
 <span class="hljs-keyword">import</span> { serve } <span class="hljs-keyword">from</span> <span class="hljs-string">'@hono/node-server'</span>;
 <span class="hljs-keyword">import</span> { db } <span class="hljs-keyword">from</span> <span class="hljs-string">'./db/index.js'</span>;
 <span class="hljs-keyword">import</span> { student } <span class="hljs-keyword">from</span> <span class="hljs-string">'./db/schema.js'</span>;
 <span class="hljs-keyword">import</span> { eq } <span class="hljs-keyword">from</span> <span class="hljs-string">'drizzle-orm'</span>;

 <span class="hljs-keyword">const</span> app = <span class="hljs-keyword">new</span> Hono();

 <span class="hljs-comment">// [C] Create</span>
 app.post(<span class="hljs-string">'/api/student'</span>, <span class="hljs-keyword">async</span> (c) =&gt; {
   <span class="hljs-keyword">const</span> data = <span class="hljs-keyword">await</span> c.req.json();
   <span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> db.insert(student).values(data).returning();
   <span class="hljs-keyword">return</span> c.json({ <span class="hljs-attr">error</span>: <span class="hljs-literal">false</span>, <span class="hljs-attr">data</span>: result[<span class="hljs-number">0</span>] }, <span class="hljs-number">201</span>);
 });

 <span class="hljs-comment">// [R] Read All</span>
 app.get(<span class="hljs-string">'/api/student'</span>, <span class="hljs-keyword">async</span> (c) =&gt; {
   <span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> db.query.student.findMany();
   <span class="hljs-keyword">return</span> c.json({ <span class="hljs-attr">error</span>: <span class="hljs-literal">false</span>, <span class="hljs-attr">data</span>: result });
 });

 <span class="hljs-comment">// [R] Read One</span>
 app.get(<span class="hljs-string">'/api/student/:id'</span>, <span class="hljs-keyword">async</span> (c) =&gt; {
   <span class="hljs-keyword">const</span> id = <span class="hljs-built_in">Number</span>(c.req.param(<span class="hljs-string">'id'</span>));
   <span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> db.query.student.findFirst({
     <span class="hljs-attr">where</span>: eq(student.id, id),
   });
   <span class="hljs-keyword">if</span> (!result) <span class="hljs-keyword">return</span> c.json({ <span class="hljs-attr">error</span>: <span class="hljs-literal">true</span>, <span class="hljs-attr">message</span>: <span class="hljs-string">'Not found'</span> }, <span class="hljs-number">404</span>);
   <span class="hljs-keyword">return</span> c.json({ <span class="hljs-attr">error</span>: <span class="hljs-literal">false</span>, <span class="hljs-attr">data</span>: result });
 });

 <span class="hljs-comment">// [U] Update</span>
 app.put(<span class="hljs-string">'/api/student/:id'</span>, <span class="hljs-keyword">async</span> (c) =&gt; {
   <span class="hljs-keyword">const</span> id = <span class="hljs-built_in">Number</span>(c.req.param(<span class="hljs-string">'id'</span>));
   <span class="hljs-keyword">const</span> data = <span class="hljs-keyword">await</span> c.req.json();
   <span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> db
     .update(student)
     .set(data)
     .where(eq(student.id, id))
     .returning();
   <span class="hljs-keyword">if</span> (result.length === <span class="hljs-number">0</span>)
     <span class="hljs-keyword">return</span> c.json({ <span class="hljs-attr">error</span>: <span class="hljs-literal">true</span>, <span class="hljs-attr">message</span>: <span class="hljs-string">'Not found'</span> }, <span class="hljs-number">404</span>);
   <span class="hljs-keyword">return</span> c.json({ <span class="hljs-attr">error</span>: <span class="hljs-literal">false</span>, <span class="hljs-attr">data</span>: result[<span class="hljs-number">0</span>] });
 });

 <span class="hljs-comment">// [D] Delete</span>
 app.delete(<span class="hljs-string">'/api/student/:id'</span>, <span class="hljs-keyword">async</span> (c) =&gt; {
   <span class="hljs-keyword">const</span> id = <span class="hljs-built_in">Number</span>(c.req.param(<span class="hljs-string">'id'</span>));
   <span class="hljs-keyword">const</span> result = <span class="hljs-keyword">await</span> db.delete(student).where(eq(student.id, id)).returning();
   <span class="hljs-keyword">if</span> (result.length === <span class="hljs-number">0</span>)
     <span class="hljs-keyword">return</span> c.json({ <span class="hljs-attr">error</span>: <span class="hljs-literal">true</span>, <span class="hljs-attr">message</span>: <span class="hljs-string">'Not found'</span> }, <span class="hljs-number">404</span>);
   <span class="hljs-keyword">return</span> c.json({ <span class="hljs-attr">error</span>: <span class="hljs-literal">false</span>, <span class="hljs-attr">message</span>: <span class="hljs-string">`Deleted id <span class="hljs-subst">${id}</span>`</span> });
 });

 <span class="hljs-comment">// Info about API</span>
 app.get(<span class="hljs-string">'/'</span>, <span class="hljs-keyword">async</span> (c) =&gt; {
   <span class="hljs-keyword">return</span> c.html(
     <span class="hljs-string">`&lt;div&gt;&lt;h1&gt;Doc API&lt;/h1&gt;&lt;/div&gt;&lt;a href="/api/student"&gt;/api/student.&lt;/a&gt;`</span>
   );
 });

 serve({ <span class="hljs-attr">fetch</span>: app.fetch, <span class="hljs-attr">port</span>: <span class="hljs-number">5000</span> });
 <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'✅ API running at http://localhost:5000'</span>);
</code></pre>
</li>
</ol>
<p>_______________________________________________________________________________________________________________</p>
<h2 id="heading-test-teas">Test Teas !!</h2>
<p>_______________________________________________________________________________________________________________</p>
<h2 id="heading-test-server">Test Server</h2>
<ul>
<li><p>Run Server:</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758983183054/9ebcdb61-cf12-4c90-9902-cfa54eff8359.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758983279922/95c81317-4bf2-4033-a67c-59d51c11c5fe.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Ah ERROR!, because we don’t have data into table</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758983347061/a706352e-2c93-4208-86a5-a837653fd935.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Click ctrl + c for stop the server</p>
</li>
<li><p>and run the seed.js for add data into table</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758985131963/e9300e42-5533-4fd6-a21a-a873b495e82f.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>run server</p>
</li>
<li><p>and, yes successfully</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758985246123/0ce9f778-5553-416e-96b1-acf3a22cbb20.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>_______________________________________________________________________________________________________________</p>
<h2 id="heading-test-crud-api">Test CRUD API</h2>
<ul>
<li><p>open API extension</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758985566174/bbc44dbd-d34c-443e-ab4c-4eb8bf8a0d12.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Click</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758985676061/79dcfaf6-56ee-4b3f-ab64-93499574620b.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>________________________________________________________</p>
<h2 id="heading-testing-post-data-to-server">Testing POST data to server</h2>
<ul>
<li><p>Select <code>post</code>, fill in the url with the server address, select <code>body</code>, select <code>raw</code>, select <code>json</code>, and fill in with new student data</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758986137489/08aa87ab-b16f-4609-b82f-c974683bfc0c.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>and post data with click <code>Send</code></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758986405929/5620af8c-f8cb-4f76-beb3-18d454a86f5a.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>see the result in server, before that you can reload the server page</p>
</li>
<li><p>and error</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758987534552/cada75f3-a392-4539-8cd1-6eed3e8585a9.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>I missed a comma, and it threw an error code, now i delete comma after address</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758988047473/7a2e2976-16b1-4293-abee-c0999f34a3ee.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Oke Successfully!</p>
</li>
</ul>
<p>________________________________________________________</p>
<h2 id="heading-testing-read-data">Testing Read data</h2>
<ul>
<li><p>Select <code>GET</code>, and fill the url with server address for read, we have 2 url for read, one for read all and more for read one data</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759107397697/c7bf6008-b215-4e62-8e1f-2bf697debe7c.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>read for all</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759107887602/a460831f-f4dd-427c-ab8a-bc8bf149d84d.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>read for one data, like read for all but adding data id at the end url</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759108065236/cb6b7323-81c4-4298-ad02-0d94e085fc48.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>________________________________________________________</p>
<h2 id="heading-testing-update-data">Testing Update data</h2>
<ul>
<li><p>choose put for update data, and for url same with read one data, and you can add new data in body select raw select json dan write new data like write for post</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759108336099/2ca271eb-da13-4c15-8345-6b9c478cf69c.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>this result after we update data, we will see the data that after being updated will be in last place</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759108857948/26313ea1-f0f7-41e7-a63d-ebbb2ab13ec2.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>________________________________________________________</p>
<h2 id="heading-testing-delete-data">Testing Delete data</h2>
<ul>
<li><p>Select Delete and fill url like update or read more</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759109078041/9b631b37-5f9a-46ea-ae31-970391c33336.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>This result after we delete data, and we can see that the data with ID 2 was successfully deleted</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1759109140795/3fb2ee9c-c512-496c-aa67-e7966d183db2.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>_______________________________________________________________________________________________________________</p>
<h3 id="heading-closing">Closing</h3>
<p>And that's it! 🎉 You've now successfully built a simple CRUD application. You’ve mastered the fundamentals: creating, reading, updating, and deleting data. The bridge is complete, and the data is flowing smoothly!</p>
<p>From here, you can try to:</p>
<ul>
<li><p>Add more features, such as a search function or pagination.</p>
</li>
<li><p>Integrate with a frontend framework (like React or Vue) to build a full web application.</p>
</li>
<li><p>Create a more engaging user interface.</p>
</li>
</ul>
<p><strong>Thank you, Gemini, for following this entire journey!</strong> The process of writing and arranging this article was made easier because you served as the editor, writing organizer, and idea <em>debugger</em>.</p>
<p>See you in the next project!</p>
<p>_____________________________________________________________________________________________________</p>
]]></content:encoded></item><item><title><![CDATA[Mini APP CRUD With PostgreSQL and Node.js]]></title><description><![CDATA[___________________________________________
About application
an application used to process student data which includes entering student data, viewing student data, updating student data, deleting student data and this application runs on the termin...]]></description><link>https://blog.alchemists.my.id/mini-app-crud-with-postgresql-and-nodejs</link><guid isPermaLink="true">https://blog.alchemists.my.id/mini-app-crud-with-postgresql-and-nodejs</guid><category><![CDATA[PostgreSQL]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[crud]]></category><category><![CDATA[CRUD Operations]]></category><category><![CDATA[app]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Hashnode]]></category><category><![CDATA[GitHub]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[programmer]]></category><category><![CDATA[Visual Studio Code]]></category><category><![CDATA[visual studio]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Wed, 24 Sep 2025 00:53:17 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759457100997/5f8ae8f5-2f3a-49e6-9181-52d374da6fbb.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>___________________________________________</p>
<h2 id="heading-about-application"><strong><em>About application</em></strong></h2>
<p>an application used to process student data which includes entering student data, viewing student data, updating student data, deleting student data and this application runs on the terminal</p>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-lets-try-with-me">Let’s Try With Me !!</h2>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-setup">Setup</h2>
<ol>
<li><p>Prepare node.js and postgreSQL software</p>
</li>
<li><p>Create Folder and file for this project with terminal</p>
<ul>
<li><p>Structure file and folder</p>
<p>  db-project/</p>
<p>  ├── utils/</p>
<p>  │ ├── db.js</p>
<p>  │ └── input.js</p>
<p>  ├── 1-create.js</p>
<p>  ├── 2-read.js</p>
<p>  ├── 3-update.js</p>
<p>  ├── 4-delete.js</p>
<p>  ├── app.js</p>
<p>  ├── .env</p>
<p>  └── .gitignore</p>
</li>
<li><p>Create Folder db-project</p>
<pre><code class="lang-powershell">  mkdir db<span class="hljs-literal">-project</span>
</code></pre>
</li>
<li><p>Create utils folder into db-project</p>
<pre><code class="lang-powershell">  <span class="hljs-built_in">cd</span> db<span class="hljs-literal">-project</span>
  mkdir utils
</code></pre>
</li>
<li><p>Create a file for database and for input into utils folder</p>
<pre><code class="lang-powershell">  touch input.js
  touch db.js
</code></pre>
</li>
<li><p>Create a file for operation CRUD</p>
<pre><code class="lang-powershell">  <span class="hljs-built_in">cd</span> ..
  touch <span class="hljs-number">1</span><span class="hljs-literal">-create</span>.js
  touch <span class="hljs-number">2</span><span class="hljs-literal">-read</span>.js
  touch <span class="hljs-number">3</span><span class="hljs-literal">-update</span>.js
  touch <span class="hljs-number">4</span><span class="hljs-literal">-delete</span>.js
</code></pre>
</li>
<li><p>Create a file app.js for bridge or connector to access or perform CRUD operations</p>
<pre><code class="lang-powershell">  touch app.js
</code></pre>
</li>
<li><p>Create a file with the .env extension to store confidential data.</p>
<pre><code class="lang-powershell">  touch .env
</code></pre>
<p>  extension .env is A file acting as a secret diary for your code, holding sensitive information like passwords.</p>
</li>
<li><p>Create a file .gitignore</p>
<pre><code class="lang-powershell">  touch .gitignore
</code></pre>
<p>  .gitignore It's a list for Git to <strong>ignore</strong> certain files and folders.</p>
</li>
</ul>
</li>
<li><p>Enter to Visual Studio Code with that folder</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758678851910/d089dd7c-b8c5-4ab9-9283-f3ca8cacc591.png" alt class="image--center mx-auto" /></p>
<p> If you are confused about where the folder you created is, you can see it in the terminal.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758679102239/542d3508-bad2-4d82-8580-76d677e05054.png" alt class="image--center mx-auto" /></p>
<p> That is path or address your folder</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758678856462/e5473f57-e361-400a-8f89-7bdf5ac0b9c4.png" alt class="image--center mx-auto" /></p>
<p> These are the files and folders that we created earlier</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758678860051/7cf9ac12-72f8-4e65-8344-0bd8416085eb.png" alt class="image--center mx-auto" /></p>
<p> you can open terminal in Visual Studio Code with click ctrl + ` (Grave accent above the tab key on the keyboard)</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758678865274/8c63a34b-cc22-4804-81d6-d7bf61b483fd.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>install npm, pg and git in folder, Write this in your terminal or you can copy past</p>
<pre><code class="lang-powershell"> npm init <span class="hljs-literal">-y</span> <span class="hljs-comment"># install npm</span>
 npm install pg <span class="hljs-comment"># install pg for connect to database</span>
 npm install dotenv <span class="hljs-comment"># install extension env</span>
 git init <span class="hljs-comment"># install git</span>
</code></pre>
</li>
</ol>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-code-code">CODE CODE !!</h2>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-prepare-foundation">Prepare foundation</h2>
<ol>
<li><p>Setting or configuration npm</p>
<ul>
<li><p>open file package.json</p>
</li>
<li><p>write this <code>‘type‘: ‘module‘,</code> like this</p>
</li>
</ul>
</li>
</ol>
<pre><code class="lang-javascript">    {
      <span class="hljs-string">"name"</span>: <span class="hljs-string">"db-project"</span>,
      <span class="hljs-string">"version"</span>: <span class="hljs-string">"1.0.0"</span>,
      <span class="hljs-string">"description"</span>: <span class="hljs-string">""</span>,
      <span class="hljs-string">"type"</span>: <span class="hljs-string">"module"</span>, <span class="hljs-comment">// HERE</span>
      <span class="hljs-string">"main"</span>: <span class="hljs-string">"index.js"</span>,
      <span class="hljs-string">"scripts"</span>: {
        <span class="hljs-string">"test"</span>: <span class="hljs-string">"echo \"Error: no test specified\" &amp;&amp; exit 1"</span>
      },
      <span class="hljs-string">"keywords"</span>: [],
      <span class="hljs-string">"author"</span>: <span class="hljs-string">""</span>,
      <span class="hljs-string">"license"</span>: <span class="hljs-string">"ISC"</span>,
      <span class="hljs-string">"dependencies"</span>: {
        <span class="hljs-string">"dotenv"</span>: <span class="hljs-string">"^17.2.2"</span>,
        <span class="hljs-string">"env"</span>: <span class="hljs-string">"^0.0.2"</span>,
        <span class="hljs-string">"pg"</span>: <span class="hljs-string">"^8.16.3"</span>
      }
    }
</code></pre>
<ol start="2">
<li><p>Create database and table</p>
<pre><code class="lang-pgsql"> <span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">DATABASE</span> name_database;
 \c name_database <span class="hljs-comment">-- for enter to database</span>

 <span class="hljs-keyword">CREATE</span> <span class="hljs-keyword">TABLE</span> student(
 id <span class="hljs-type">SERIAL</span> <span class="hljs-keyword">PRIMARY KEY</span>,
 <span class="hljs-type">name</span> <span class="hljs-type">VARCHAR</span>(<span class="hljs-number">50</span>) <span class="hljs-keyword">NOT</span> <span class="hljs-keyword">NULL</span>,
 address <span class="hljs-type">VARCHAR</span>(<span class="hljs-number">100</span>) <span class="hljs-keyword">NOT</span> <span class="hljs-keyword">NULL</span>
 );
</code></pre>
</li>
<li><p>Connect to database</p>
<ul>
<li><p>Actually this is not connecting the database to the file but more about preparation</p>
</li>
<li><p>Go to file with extension <code>.env</code> and write like this</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758680055202/8f4197df-0bb1-4429-9632-da7507098fb2.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
</li>
<li><p>The contents of the .gitignore file are like this</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758680201885/811af12f-7725-439b-8550-e1848349c676.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-create-program">Create Program</h2>
<ul>
<li>Write the program for connect to database in file db.js which is in the utils folder</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> pg <span class="hljs-keyword">from</span> <span class="hljs-string">"pg"</span>;
<span class="hljs-keyword">import</span> <span class="hljs-string">"dotenv/config"</span>;

<span class="hljs-keyword">const</span> pool = <span class="hljs-keyword">new</span> pg.Pool({
  <span class="hljs-attr">user</span>: process.env.DB_USER,
  <span class="hljs-attr">host</span>: process.env.DB_HOST,
  <span class="hljs-attr">database</span>: process.env.DB_DATABASE,
  <span class="hljs-attr">password</span>: process.env.DB_PASSWORD,
  <span class="hljs-attr">port</span>: process.env.DB_PORT,
});

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> pool;
</code></pre>
<ul>
<li>Create function for input in file input.js which is in the utils folder</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> readline <span class="hljs-keyword">from</span> <span class="hljs-string">'node:readline/promises'</span>;
<span class="hljs-keyword">import</span> { stdin <span class="hljs-keyword">as</span> input, stdout <span class="hljs-keyword">as</span> output } <span class="hljs-keyword">from</span> <span class="hljs-string">'node:process'</span>;

<span class="hljs-keyword">const</span> rl = readline.createInterface({ input, output });

<span class="hljs-keyword">export</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">inputData</span>(<span class="hljs-params">question</span>) </span>{
 <span class="hljs-keyword">const</span> answer = <span class="hljs-keyword">await</span> rl.question(<span class="hljs-string">`<span class="hljs-subst">${question}</span>`</span>);
 <span class="hljs-keyword">return</span> answer.trim();
}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">closeInput</span>(<span class="hljs-params"></span>) </span>{
 <span class="hljs-keyword">await</span> rl.close();
}
</code></pre>
<ul>
<li>Write the program for Create data in file 1-create.js</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> pool <span class="hljs-keyword">from</span> <span class="hljs-string">'./utils/db.js'</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">addStudent</span>(<span class="hljs-params">name, address</span>) </span>{
 <span class="hljs-keyword">try</span>{
  <span class="hljs-comment">// this code for testing code </span>
  <span class="hljs-keyword">const</span> name = <span class="hljs-string">'fine'</span>
  <span class="hljs-keyword">const</span> address = <span class="hljs-string">'Tokyo'</span>

  <span class="hljs-keyword">const</span> queryText = <span class="hljs-string">'INSERT INTO student(name, address) VALUES ($1, $2) RETURNING *'</span>;
  <span class="hljs-keyword">const</span> res = <span class="hljs-keyword">await</span> pool.query(queryText, [name, address]);

  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'new student successfully added'</span>);
  <span class="hljs-built_in">console</span>.log(res.rows[<span class="hljs-number">0</span>]);
 } <span class="hljs-keyword">catch</span> (err) {
  <span class="hljs-built_in">console</span>.error(<span class="hljs-string">'fail adding student:'</span>, err.stack);
 } <span class="hljs-keyword">finally</span> { <span class="hljs-comment">// this block finally for testing code</span>
  pool.close()
  closeInput()
 }
}

addStudent() <span class="hljs-comment">// for testing code</span>
<span class="hljs-comment">// Run this file directly from the terminal to test it.</span>
<span class="hljs-comment">// If there are no issues, remove this test code. </span>
<span class="hljs-comment">// Otherwise, it could cause errors later.</span>
</code></pre>
<ul>
<li>Write the program for Read data in file 2-read.js</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> pool <span class="hljs-keyword">from</span> <span class="hljs-string">'./utils/db.js'</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">readStudent</span>(<span class="hljs-params"></span>) </span>{
 <span class="hljs-keyword">try</span> {
  <span class="hljs-keyword">const</span> res = <span class="hljs-keyword">await</span> pool.query(<span class="hljs-string">'SELECT * FROM student ORDER BY id ASC'</span>);

  <span class="hljs-keyword">if</span> (res.rows.length === <span class="hljs-number">0</span>) {
   <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'no student data'</span>);
   <span class="hljs-keyword">return</span>;
  }

  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'List Student:'</span>);
  res.rows.forEach(<span class="hljs-function"><span class="hljs-params">s</span> =&gt;</span> {
   <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`ID: <span class="hljs-subst">${s.id}</span>, Name: <span class="hljs-subst">${s.name}</span>, address: <span class="hljs-subst">${s.address}</span>`</span>);
  });
 } <span class="hljs-keyword">catch</span> (err) {
  <span class="hljs-built_in">console</span>.error(<span class="hljs-string">'failed to read student data:'</span>, err.stack);
 }
}
</code></pre>
<ul>
<li>Write the program for Update data in file 3-update.js</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> pool <span class="hljs-keyword">from</span> <span class="hljs-string">'./utils/db.js'</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">editStudent</span>(<span class="hljs-params">id, reName, reAddress</span>) </span>{
 <span class="hljs-keyword">try</span> {

  <span class="hljs-keyword">const</span> queryText = <span class="hljs-string">'UPDATE student SET name = $1 , address = $2 WHERE id = $3'</span>;
  <span class="hljs-keyword">const</span> res = <span class="hljs-keyword">await</span> pool.query(queryText, [reName, reAddress, id]);

  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'data edited successfully'</span>);
 } <span class="hljs-keyword">catch</span> (err) {
  <span class="hljs-built_in">console</span>.error(<span class="hljs-string">'data failed to edit'</span>);
 }
}
</code></pre>
<ul>
<li>Write the program for Delete data in file 4-delete.js</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> pool <span class="hljs-keyword">from</span> <span class="hljs-string">'./utils/db.js'</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">deleteStudent</span>(<span class="hljs-params">id</span>) </span>{
 <span class="hljs-keyword">try</span> {

  <span class="hljs-keyword">const</span> queryText = <span class="hljs-string">'DELETE FROM student WHERE id = $1'</span>;
  <span class="hljs-keyword">const</span> res = <span class="hljs-keyword">await</span> pool.query(queryText, [id]);

  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Student data was successfully deleted.'</span>);
 } <span class="hljs-keyword">catch</span> (err) {
  <span class="hljs-built_in">console</span>.error(<span class="hljs-string">'data failed to delete'</span>);
 }
}
</code></pre>
<ul>
<li>Write the program for app.js</li>
</ul>
<pre><code class="lang-javascript"><span class="hljs-keyword">import</span> { addStudent } <span class="hljs-keyword">from</span> <span class="hljs-string">"./1-create.js"</span>;
<span class="hljs-keyword">import</span> { readStudent } <span class="hljs-keyword">from</span> <span class="hljs-string">"./2-read.js"</span>;
<span class="hljs-keyword">import</span> { editStudent } <span class="hljs-keyword">from</span> <span class="hljs-string">"./3-update.js"</span>;
<span class="hljs-keyword">import</span> { deleteStudent } <span class="hljs-keyword">from</span> <span class="hljs-string">"./4-delete.js"</span>;

<span class="hljs-keyword">import</span> { closeInput, inputData } <span class="hljs-keyword">from</span> <span class="hljs-string">"./utils/input.js"</span>;

<span class="hljs-keyword">import</span> pg <span class="hljs-keyword">from</span> <span class="hljs-string">"pg"</span>;

<span class="hljs-keyword">const</span> pool = <span class="hljs-keyword">new</span> pg.Pool({
  <span class="hljs-attr">user</span>: <span class="hljs-string">"postgres"</span>,
  <span class="hljs-attr">host</span>: <span class="hljs-string">"localhost"</span>,
  <span class="hljs-attr">database</span>: <span class="hljs-string">"dbproject1"</span>,
  <span class="hljs-attr">password</span>: <span class="hljs-string">"postgres"</span>,
  <span class="hljs-attr">port</span>: <span class="hljs-number">5432</span>,
});

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">fitur</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"  APP Console JS  "</span>);
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"1) Add Student"</span>);
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"2) Read Student"</span>);
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"3) Edit Student"</span>);
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"4) Delete Student"</span>);
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"0) Close"</span>);
}

<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">addProgram</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> name = <span class="hljs-keyword">await</span> inputData(<span class="hljs-string">"Enter Name: "</span>);
  <span class="hljs-keyword">const</span> address = <span class="hljs-keyword">await</span> inputData(<span class="hljs-string">"Enter Address"</span>);
  <span class="hljs-keyword">await</span> addStudent(name, address);
}

<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">editProgram</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> id = <span class="hljs-keyword">await</span> inputData(<span class="hljs-string">"Enter ID: "</span>);
  <span class="hljs-keyword">const</span> name = <span class="hljs-keyword">await</span> inputData(<span class="hljs-string">"Enter New Name: "</span>);
  <span class="hljs-keyword">const</span> address = <span class="hljs-keyword">await</span> inputData(<span class="hljs-string">"Enter New Address: "</span>);
  <span class="hljs-keyword">await</span> editStudent(id, name, address);
}

<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">deleteProgram</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> id = <span class="hljs-keyword">await</span> inputData(<span class="hljs-string">"Enter ID: "</span>);
  <span class="hljs-keyword">await</span> deleteStudent(id);
}

<span class="hljs-keyword">async</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">program</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">while</span> (<span class="hljs-literal">true</span>) {
    fitur();
    <span class="hljs-keyword">const</span> choice = <span class="hljs-keyword">await</span> inputData(<span class="hljs-string">"Choose: "</span>);
    <span class="hljs-keyword">switch</span> (choice) {
      <span class="hljs-keyword">case</span> <span class="hljs-string">"1"</span>:
        <span class="hljs-keyword">await</span> addProgram();
        <span class="hljs-keyword">break</span>;

      <span class="hljs-keyword">case</span> <span class="hljs-string">"2"</span>:
        <span class="hljs-keyword">await</span> readStudent();
        <span class="hljs-keyword">break</span>;

      <span class="hljs-keyword">case</span> <span class="hljs-string">"3"</span>:
        <span class="hljs-keyword">await</span> editProgram();
        <span class="hljs-keyword">break</span>;

      <span class="hljs-keyword">case</span> <span class="hljs-string">"4"</span>:
        <span class="hljs-keyword">await</span> deleteProgram();
        <span class="hljs-keyword">break</span>;

      <span class="hljs-keyword">case</span> <span class="hljs-string">"0"</span>:
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"\nApp is Closed. Thank You.\n"</span>);
        closeInput();
        pool.end();
        <span class="hljs-keyword">return</span>;

      <span class="hljs-keyword">default</span>:
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Unknown choice. Please try again.\n"</span>);
    }
  }
}

program();
</code></pre>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-test-program">Test Program</h2>
<ol>
<li><p>Test Create Fitur</p>
</li>
<li><p>Test Read Fitur</p>
</li>
<li><p>Test Update Fitur</p>
</li>
<li><p>Test Delete Fitur</p>
</li>
</ol>
<p>_____________________________________________________________________________________________________</p>
<p>_____________________________________________________________________________________________________</p>
<h3 id="heading-closing"><strong>Closing</strong></h3>
<p>And that's it! 🎉 You've now successfully built a simple CRUD application. You've mastered the fundamentals: creating, reading, updating, and deleting data.</p>
<p>From here, you can try to:</p>
<ul>
<li><p>Add more features, such as a search function.</p>
</li>
<li><p>Use a web framework like <strong>Express.js</strong> to build a web-based application.</p>
</li>
<li><p>Create a more engaging user interface.</p>
</li>
</ul>
<p>Thanks for reading! See you in the next project.</p>
<p>_____________________________________________________________________________________________________</p>
<p>note : picture from <a target="_blank" href="https://www.atatus.com/glossary/crud/">https://www.atatus.com/glossary/crud/</a></p>
]]></content:encoded></item><item><title><![CDATA[A Simple Flowchart]]></title><description><![CDATA[What’s Flow Chart
A flow chart is a diagram that shows the steps of a process or decision using symbols and arrows.
— ChatGPT
Flowchart shapes
Flowcharts have many forms, including:

Example

The Flow:


The process starts when a new student opens th...]]></description><link>https://blog.alchemists.my.id/a-simple-flowchart</link><guid isPermaLink="true">https://blog.alchemists.my.id/a-simple-flowchart</guid><category><![CDATA[#Flowchart]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[tutor]]></category><category><![CDATA[draw.io]]></category><category><![CDATA[simple]]></category><category><![CDATA[knowledge]]></category><category><![CDATA[Hashnode]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Thu, 18 Sep 2025 01:45:36 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759457070424/4ac2e3cd-5e84-43f3-a631-d27499d0a6f2.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-whats-flow-chart"><em>What’s Flow Chart</em></h2>
<p>A <strong>flow chart</strong> is a diagram that shows the steps of a process or decision using symbols and arrows.</p>
<p>— ChatGPT</p>
<h2 id="heading-flowchart-shapes"><em>Flowchart shapes</em></h2>
<p>Flowcharts have many forms, including:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758158388246/a97a914b-cc2e-43b7-ac00-52cf6c05f758.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-example"><em>Example</em></h2>
<ul>
<li><p>The Flow:</p>
<hr />
<ul>
<li><p>The process starts when a new student opens the registration page on the High School website.</p>
</li>
<li><p>They fill out the form with name, address, etc.</p>
</li>
<li><p>After clicking the <strong>“Register”</strong> button, the system checks if all the required info is filled in.</p>
</li>
<li><p>Decision: <em>“Is the form complete?”</em></p>
<ul>
<li><p>If <strong>NO</strong> → the system shows an error message telling what’s missing, and the student has to complete the form again.</p>
</li>
<li><p>If <strong>YES</strong> → the system saves the student’s data into the database.</p>
</li>
</ul>
</li>
<li><p>Once saved, the system automatically creates a unique Registration Number.</p>
</li>
<li><p>The system then shows a confirmation page saying: <em>“Congrats, your registration was successful!”</em> + the Registration Number.</p>
</li>
<li><p>Done.</p>
</li>
<li><p>The process starts when a new student opens the registration page on the High School website.</p>
</li>
<li><p>They fill out the form with name, address, school, etc.</p>
</li>
<li><p>After clicking the <strong>“Register”</strong> button, the system checks if all the required info is filled in.</p>
</li>
<li><p>Decision: <em>“Is the form complete?”</em></p>
<ul>
<li><p>If <strong>NO</strong> → the system shows an error message telling what’s missing, and the student has to complete the form again.</p>
</li>
<li><p>If <strong>YES</strong> → the system saves the student’s data into the database.</p>
</li>
</ul>
</li>
<li><p>Once saved, the system automatically creates a unique Registration Number.</p>
</li>
<li><p>The system then shows a confirmation page saying: <em>“Congrats, your registration was successful!”</em> + the Registration Number.</p>
</li>
<li><p>Done.</p>
</li>
</ul>
</li>
</ul>
<hr />
<ul>
<li><p>This is Flowchart, you can draw in <a target="_blank" href="https://app.diagrams.net/">draw.io</a> Website</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1758159242527/de6d6930-23a7-42b6-8519-ea67f72f811e.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-closing">Closing</h2>
<p>And that’s it! 🎉</p>
<p>Now you’ve got a flowchart for sketch from application</p>
<p>Thanks for reading! Stay tuned on my blog for more articles or the next episode.</p>
<p>note : picture from <a target="_blank" href="https://unstop.com/blog/difference-between-algorithm-and-flowchart">https://unstop.com/blog/difference-between-algorithm-and-flowchart</a></p>
]]></content:encoded></item><item><title><![CDATA[A Little About Hono]]></title><description><![CDATA[What’s Hono?
Hono is a small and fast web framework for building APIs and web apps in JavaScript and TypeScript. It is lightweight, modern, and works across different runtimes like Node.js, Bun, and Deno.
_____________________________________________...]]></description><link>https://blog.alchemists.my.id/a-little-about-hono</link><guid isPermaLink="true">https://blog.alchemists.my.id/a-little-about-hono</guid><category><![CDATA[hono]]></category><category><![CDATA[honojs]]></category><category><![CDATA[Little ]]></category><category><![CDATA[about]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[terminal]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Web Development]]></category><category><![CDATA[webdev]]></category><category><![CDATA[backend]]></category><category><![CDATA[Backend Development]]></category><category><![CDATA[Hashnode]]></category><category><![CDATA[education]]></category><category><![CDATA[Git]]></category><category><![CDATA[npm]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Mon, 15 Sep 2025 02:33:08 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759457166570/1e1dfb24-4027-4ae7-8478-558810e6b515.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-whats-hono"><em>What’s Hono?</em></h2>
<p>Hono is a small and fast web framework for building APIs and web apps in JavaScript and TypeScript. It is lightweight, modern, and works across different runtimes like Node.js, Bun, and Deno.</p>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-lets-try-with-me">Let’s Try With Me !!</h2>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-setup">Setup</h2>
<ol>
<li><p>Open Git Bash and go to your project folder.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757902621789/5c0577db-e5f6-4af9-9c21-5c8e74689781.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>initialize npm.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757902655357/8431f51a-41e2-4b46-ae7b-9ae0887ab8d7.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>open package.json with nano and add ‘ ”type” : “module”, ‘ inside. This makes npm work with Hono or other modules that use ES modules.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757902888353/a19c7659-b477-421a-84b8-824255a0ccb5.png" alt class="image--center mx-auto" /></p>
<p> Use nano to edit a file, or create one if it doesn’t exist.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757902732984/e425ce0a-8bca-4d96-81cb-77b7b83e18a1.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>and install hono.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757902709980/f538b9ef-d7c6-45df-86ab-8b093a6a34b5.png" alt class="image--center mx-auto" /></p>
<p> and don’t forget from install @hono/node-server.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757903005440/dbb232ab-39c7-4782-a5d3-aeaadfaf65df.png" alt class="image--center mx-auto" /></p>
<p> <em>if you don’t install this, you will get an error when running the file later, like this</em></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757905145957/8f59314b-5948-46e4-9c7e-ea8cf08c819e.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-create-file">Create File</h2>
<ol>
<li><p>create a file named <code>service.js</code> (you can use nano or any editor)</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757904539408/bbd50038-523f-4731-bd62-af8de1f3cec6.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-run-the-server">Run the server</h2>
<ol>
<li><p>write this code inside file server.js</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757902727581/5c4f929e-c800-4655-b85b-aabbeda78d1f.png" alt class="image--center mx-auto" /></p>
<p> Save and exit with Ctrl + X, then press Y, then Enter.</p>
</li>
<li><p>Run the code with <code>node server.js</code></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757903257787/2ffc377d-d681-4e5b-91bb-38d33b3aaad4.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-routes-result">Routes Result</h2>
<ul>
<li><p>Open <a target="_blank" href="http://localhost:3000/"><code>http://localhost:3000/</code></a> → you will see the main page.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757903336598/f579b570-8326-4cd8-8a36-9d78bc68b2a4.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Open <a target="_blank" href="http://localhost:3000/text"><code>http://localhost:3000/text</code></a> → you will see the text response, or click /text in main page</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757903493631/fff92e0e-31b8-4b1e-8b35-73bb5491b3c0.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Open <a target="_blank" href="http://localhost:3000/json"><code>http://localhost:3000/json</code></a> → you will see the JSON response, or click /json in main page</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757903534867/4662d2d0-ac4e-4299-bb62-fc63a1306afe.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>_____________________________________________________________________________________________________</p>
<h2 id="heading-closing">Closing</h2>
<p>And that’s it! 🎉</p>
<p>Now you’ve got a simple Hono server running.</p>
<p>Later you can try middleware, auth, or even deploy it.</p>
<p>Thanks for reading! Stay tuned on my blog for more articles or the next episode.</p>
<p>_____________________________________________________________________________________________________</p>
<p>note: picture from <a target="_blank" href="https://dev.to/joodi/honojs-a-lightweight-framework-with-big-potential-3lh9">https://dev.to/joodi/honojs-a-lightweight-framework-with-big-potential-3lh9</a></p>
]]></content:encoded></item><item><title><![CDATA[Simple CRUD Object Into Array in JavaScript]]></title><description><![CDATA[Hey everyone! In this article, we're gonna learn how to do some simple CRUD stuff with objects inside an array using JavaScript.

Create object into array
 let itemList = [
  { code: "BRG001", name: "Soap", price: 1.3, qty: 10},
  { code: "BRG002", n...]]></description><link>https://blog.alchemists.my.id/simple-crud-object-into-array-in-javascript</link><guid isPermaLink="true">https://blog.alchemists.my.id/simple-crud-object-into-array-in-javascript</guid><category><![CDATA[simple]]></category><category><![CDATA[crud]]></category><category><![CDATA[CRUD Operations]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Object Oriented Programming]]></category><category><![CDATA[array]]></category><category><![CDATA[terminal]]></category><category><![CDATA[gitbash]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[node]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Thu, 11 Sep 2025 01:26:21 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1759457233377/ab00e40d-b758-4910-b797-2118173efcd7.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><strong>Hey everyone! In this article, we're gonna learn how to do some simple CRUD stuff with objects inside an array using JavaScript.</strong></p>
<ol>
<li><p>Create object into array</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">let</span> itemList = [
  { <span class="hljs-attr">code</span>: <span class="hljs-string">"BRG001"</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Soap"</span>, <span class="hljs-attr">price</span>: <span class="hljs-number">1.3</span>, <span class="hljs-attr">qty</span>: <span class="hljs-number">10</span>},
  { <span class="hljs-attr">code</span>: <span class="hljs-string">"BRG002"</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Shampoo"</span>, <span class="hljs-attr">price</span>: <span class="hljs-number">2.5</span>, <span class="hljs-attr">qty</span>: <span class="hljs-number">5</span> },
  { <span class="hljs-attr">code</span>: <span class="hljs-string">"BRG003"</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Toothpaste"</span>, <span class="hljs-attr">price</span>: <span class="hljs-number">2</span>, <span class="hljs-attr">qty</span>: <span class="hljs-number">7</span> }
 ];
</code></pre>
</li>
<li><p>add another object</p>
<pre><code class="lang-javascript"> itemList.push({ <span class="hljs-attr">code</span>: <span class="hljs-string">"BRG004"</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Tissue"</span>,   <span class="hljs-attr">price</span>: <span class="hljs-number">1.5</span>, <span class="hljs-attr">qty</span>: <span class="hljs-number">20</span>});
 itemList.push({ <span class="hljs-attr">code</span>: <span class="hljs-string">"BRG005"</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Brush"</span>,    <span class="hljs-attr">price</span>: <span class="hljs-number">2</span>, <span class="hljs-attr">qty</span>: <span class="hljs-number">12</span>});
 itemList.push({ <span class="hljs-attr">code</span>: <span class="hljs-string">"BRG006"</span>, <span class="hljs-attr">name</span>: <span class="hljs-string">"Detergent"</span>, <span class="hljs-attr">price</span>: <span class="hljs-number">5</span>, <span class="hljs-attr">qty</span>: <span class="hljs-number">9</span> });
</code></pre>
</li>
<li><p>Update data object</p>
<pre><code class="lang-javascript"> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Before Update Data"</span>, itemList);
 <span class="hljs-keyword">const</span> idShampoo = itemList.findIndex(<span class="hljs-function"><span class="hljs-params">b</span> =&gt;</span> b.code === <span class="hljs-string">"BRG002"</span>);
 <span class="hljs-keyword">if</span> ( idShampoo !== <span class="hljs-number">-1</span>) {
     itemList[idShampoo].price = <span class="hljs-number">2.6</span>;
     itemList[idShampoo].qty = <span class="hljs-number">6</span>;
 }

 <span class="hljs-keyword">const</span> idTisuee = itemList.findIndex(<span class="hljs-function"><span class="hljs-params">b</span> =&gt;</span> b.code === <span class="hljs-string">"BRG004"</span>);
 <span class="hljs-keyword">if</span> ( idTisuee !== <span class="hljs-number">-1</span> ) {
     itemList[idTisuee].price = <span class="hljs-number">1.6</span>;
     itemList[idTisuee].qty = <span class="hljs-number">22</span>;
 }

 <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"After Update Data"</span>, itemList);
</code></pre>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757736251887/47daf0e5-e4b4-452f-a6be-b25f73182895.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Delete data object</p>
<pre><code class="lang-javascript"> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Before Delete Data"</span>, itemList);

 <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">findIndexByCode</span>(<span class="hljs-params">list, code</span>) </span>{
   <span class="hljs-keyword">return</span> list.findIndex(
     <span class="hljs-function">(<span class="hljs-params">b</span>) =&gt;</span> b.code.toLowerCase() === code.toLowerCase()
   );
 }

 <span class="hljs-keyword">const</span> idx = findIndexByKode(itemList, <span class="hljs-string">"BRG002"</span>);
 <span class="hljs-keyword">if</span> (idx !== <span class="hljs-number">-1</span>) {
   itemList.splice(idx, <span class="hljs-number">1</span>);
 }

 <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"After Delete Data"</span>);
</code></pre>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757736531234/f6fead40-7eda-4228-ae48-c52d44cc8289.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Show data object with table</p>
<pre><code class="lang-javascript"> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"No | Code    | Name          | Price  | Qty"</span>);
 itemList.forEach(<span class="hljs-function">(<span class="hljs-params">b, i</span>) =&gt;</span> {
  <span class="hljs-keyword">const</span> no = <span class="hljs-built_in">String</span>(i + <span class="hljs-number">1</span>).padStart(<span class="hljs-number">2</span>, <span class="hljs-string">"0"</span>);
  <span class="hljs-keyword">const</span> code = b.code.padEnd(<span class="hljs-number">7</span>, <span class="hljs-string">" "</span>);
  <span class="hljs-keyword">const</span> name = b.name.padEnd(<span class="hljs-number">13</span>, <span class="hljs-string">" "</span>);
  <span class="hljs-keyword">const</span> price = <span class="hljs-built_in">String</span>(b.price).padStart(<span class="hljs-number">6</span>, <span class="hljs-string">" "</span>);
  <span class="hljs-keyword">const</span> qty = <span class="hljs-built_in">String</span>(b.qty).padStart(<span class="hljs-number">3</span>, <span class="hljs-string">" "</span>);
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`<span class="hljs-subst">${no}</span> | <span class="hljs-subst">${code}</span> | <span class="hljs-subst">${name}</span> | <span class="hljs-subst">${price}</span> | <span class="hljs-subst">${qty}</span>`</span>);
 });
</code></pre>
</li>
<li><p>This Result</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757553585818/a8a2e3a4-ef66-4dbf-a720-1ff0e055afc9.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>End!!</p>
<p>Your feedback is a gift. Let us know your thoughts in the comments below!.</p>
<p>See you next time guys!!!.</p>
<p>note: picture from <a target="_blank" href="https://www.geeksforgeeks.org/javascript/how-to-convert-set-to-array-in-javascript/">https://www.geeksforgeeks.org/javascript/how-to-convert-set-to-array-in-javascript/</a></p>
]]></content:encoded></item><item><title><![CDATA[Node.js Mini Calculator]]></title><description><![CDATA[okay you can follow me for create mini calculator with nodejs

first open your gitbash

go to your folder
 

create file input2.js and fill in the file as follows
 
 

create file calculator and fill like this
 
 and this code for content file
 impor...]]></description><link>https://blog.alchemists.my.id/nodejs-mini-calculator</link><guid isPermaLink="true">https://blog.alchemists.my.id/nodejs-mini-calculator</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[terminal]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[technology]]></category><category><![CDATA[js]]></category><category><![CDATA[calculator]]></category><category><![CDATA[#mini-project]]></category><category><![CDATA[simple]]></category><category><![CDATA[tutor]]></category><category><![CDATA[gitbash]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Mon, 08 Sep 2025 02:40:02 GMT</pubDate><content:encoded><![CDATA[<p>okay you can follow me for create mini calculator with nodejs</p>
<ol>
<li><p>first open your gitbash</p>
</li>
<li><p>go to your folder</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757297044107/4593053c-fc59-4095-bd07-191297dae660.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>create file input2.js and fill in the file as follows</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757297061901/b9d80b55-6d77-40ac-a7fc-76de53830ed7.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757297092907/77fb4792-ac56-4cd4-a98f-840e02312953.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>create file calculator and fill like this</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757297395543/cef1617c-35f4-4467-a585-6ee6ad34a4dd.png" alt class="image--center mx-auto" /></p>
<p> and this code for content file</p>
<pre><code class="lang-javascript"> <span class="hljs-keyword">import</span> { inputText, closeInput } <span class="hljs-keyword">from</span> <span class="hljs-string">"./input2.js"</span>;

 <span class="hljs-built_in">console</span>.clear();
 <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"  Calculator Console  "</span>);

 <span class="hljs-keyword">let</span> isRunning = <span class="hljs-literal">true</span>;

 <span class="hljs-keyword">while</span> (isRunning) {
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"\nChoose Operation:"</span>);
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"1. addition"</span>);
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"2. Subtraction"</span>);
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"3. Multiplication"</span>);
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"4. Division"</span>);
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"0. Exit"</span>);

  <span class="hljs-keyword">const</span> choice = <span class="hljs-keyword">await</span> inputText(<span class="hljs-string">"Enter a Choice (0-4)"</span>);
  <span class="hljs-keyword">switch</span> (choice) {
   <span class="hljs-keyword">case</span> <span class="hljs-string">"0"</span>: {
    isRunning = <span class="hljs-literal">false</span>;
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Thank you, Program finished."</span>);
    <span class="hljs-keyword">break</span>;
   }
   <span class="hljs-keyword">case</span> <span class="hljs-string">"1"</span>:
   <span class="hljs-keyword">case</span> <span class="hljs-string">"2"</span>:
   <span class="hljs-keyword">case</span> <span class="hljs-string">"3"</span>:
   <span class="hljs-keyword">case</span> <span class="hljs-string">"4"</span>: {
     <span class="hljs-keyword">const</span> a = <span class="hljs-built_in">Number</span>(<span class="hljs-keyword">await</span> inputText(<span class="hljs-string">"Enter the first number "</span>));
     <span class="hljs-keyword">const</span> b = <span class="hljs-built_in">Number</span>(<span class="hljs-keyword">await</span> inputText(<span class="hljs-string">"Enter the second number "</span>));
     <span class="hljs-keyword">switch</span> (choice) {
      <span class="hljs-keyword">case</span> <span class="hljs-string">"1"</span>: {
       <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Result: <span class="hljs-subst">${a}</span> + <span class="hljs-subst">${b}</span> = <span class="hljs-subst">${a + b}</span>`</span>);
       <span class="hljs-keyword">break</span>;
      }
      <span class="hljs-keyword">case</span> <span class="hljs-string">"2"</span>: {
       <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Result: <span class="hljs-subst">${a}</span> - <span class="hljs-subst">${b}</span> = <span class="hljs-subst">${a - b}</span>`</span>);
       <span class="hljs-keyword">break</span>;
      }
      <span class="hljs-keyword">case</span> <span class="hljs-string">"3"</span>: {
       <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Result: <span class="hljs-subst">${a}</span> * <span class="hljs-subst">${b}</span> = <span class="hljs-subst">${a * b}</span>`</span>);
      }
      <span class="hljs-keyword">case</span> <span class="hljs-string">"4"</span>: {
       <span class="hljs-keyword">if</span> (b === <span class="hljs-number">0</span>) {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"❌ cannot divide by 0"</span>);
       } <span class="hljs-keyword">else</span> {
        <span class="hljs-built_in">console</span>.log(<span class="hljs-string">`Result: <span class="hljs-subst">${a}</span> / <span class="hljs-subst">${b}</span> = <span class="hljs-subst">${a / b}</span>`</span>);
       }
       <span class="hljs-keyword">break</span>;
      }
     }
    <span class="hljs-keyword">break</span>;
   }
  <span class="hljs-attr">default</span>:
    <span class="hljs-built_in">console</span>.log(<span class="hljs-string">"Invalid choice, Please try again!"</span>);
  }
 }
</code></pre>
</li>
<li><p>test your code or your program</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757298633857/3bec08ff-d8c7-4213-a61b-4862b274c506.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757298654490/f63e6fd0-04a3-4ae2-aa23-4d94f67e4455.png" alt class="image--center mx-auto" /></p>
<p> if you want to exit from program you can click ctrl + c</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757298815820/aebbd3b4-22a1-4350-bcaf-a9725441a52b.png" alt class="image--center mx-auto" /></p>
<p> you have left the program.</p>
</li>
</ol>
<p>End !!</p>
<p>thank you, and follow me for more content about IT specifically backend.</p>
]]></content:encoded></item><item><title><![CDATA[A Little About NPM]]></title><description><![CDATA[What’s NPM
NPM ( Node Package Manager ) is the official package manager for Node.js or in python you can call this it PIP
Its use

Installing libraries or packages from outside

Manage dependencies ( library required by the project )

Provides a regi...]]></description><link>https://blog.alchemists.my.id/a-little-about-npm</link><guid isPermaLink="true">https://blog.alchemists.my.id/a-little-about-npm</guid><category><![CDATA[simple article]]></category><category><![CDATA[npm]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[tutor]]></category><category><![CDATA[simple]]></category><category><![CDATA[easy]]></category><category><![CDATA[about]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[terminal]]></category><category><![CDATA[gitbash]]></category><category><![CDATA[Hashnode]]></category><category><![CDATA[Little ]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Sat, 06 Sep 2025 06:49:13 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-whats-npm">What’s NPM</h2>
<p>NPM ( Node Package Manager ) is the official package manager for Node.js or in python you can call this it PIP</p>
<h2 id="heading-its-use">Its use</h2>
<ul>
<li><p>Installing libraries or packages from outside</p>
</li>
<li><p>Manage dependencies ( library required by the project )</p>
</li>
<li><p>Provides a registry at npmjs.com</p>
</li>
</ul>
<h2 id="heading-standar-project">Standar Project</h2>
<p>Project Node.js usually have file ‘ package.json ‘ for configuration center</p>
<h2 id="heading-step-by-step">Step by step</h2>
<ul>
<li><p>First you can open terminal or git bash and choose your location to study or create a new folder, for example i want to create folder for project in future</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757230147758/51b83534-4b02-48c7-a2bc-c7b130204364.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757230226530/2a0ba060-7ab2-4127-9ac4-e036340ff5f7.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Write 'npm init -y' to initialize npm if you have downloaded node.js otherwise you can read my other article about installing node.js, ‘npm init -y‘ for simple initialize and ‘npm init‘ for initialization and full configuration package.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757230256748/2f97f733-d68b-4172-94df-cf8ec0def20e.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>config your npm like this</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757231370948/66ba9cea-08b6-45e9-a597-aa1d63600f73.png" alt class="image--center mx-auto" /></p>
<p>  ls for check the content into folder</p>
<p>  add <code>“type“ : “module“,</code> after “main“, and don’t forget comma, and remove content in script and write <code>“start“: “node index.js“</code> like this.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757231390885/edfe9221-d3a8-4edb-a8db-93d5bb9169da.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>create file input.js and follow me</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757230771896/f11251bd-75b4-4131-a599-0b8a52b6d7d2.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757230793740/5709e17a-9f7d-47a9-a888-dfac77c17e2f.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>create more file index.js</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757230829760/01054da8-48bf-48cc-b542-25f1b15a7f6c.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757230836489/5d5c91e7-e008-404c-a080-af73b2c6689a.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>you can try the code by writing <code>npm start</code></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757238144181/394eeb6c-2a6c-475a-ad19-ae3a0cbdf5e0.png" alt class="image--center mx-auto" /></p>
<p>  This is an error, if you get an error like me, you can open a terminal and run the code there, this error is caused by an error in the terminal MINGW64</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1757238469097/359cfa03-fd88-4813-a876-aed2dbc925c6.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<p>END !!</p>
<p>Thank you for your attention, wait for my other content on my bolg,</p>
<p>Seee you next time.</p>
]]></content:encoded></item><item><title><![CDATA[3 Best Practice In PostgerSQL]]></title><description><![CDATA[3 Big Point

Each column has only one value

All non-key columns must be fully dependent on the primary key, not just partially

There should be no transitive dependencies, that is, non-key columns depending on other non-key columns.


Example
create...]]></description><link>https://blog.alchemists.my.id/3-best-practice-in-postgersql</link><guid isPermaLink="true">https://blog.alchemists.my.id/3-best-practice-in-postgersql</guid><category><![CDATA[Tutorial]]></category><category><![CDATA[technology]]></category><category><![CDATA[table]]></category><category><![CDATA[PostgreSQL]]></category><category><![CDATA[normalization]]></category><category><![CDATA[best practices]]></category><category><![CDATA[terminal]]></category><category><![CDATA[ERD (Entity-Relationship Diagrams)]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Programming Tips]]></category><category><![CDATA[programming]]></category><category><![CDATA[program]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Thu, 04 Sep 2025 02:26:32 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-3-big-point">3 Big Point</h2>
<ol>
<li><p>Each column has only one value</p>
</li>
<li><p>All non-key columns must be fully dependent on the primary key, not just partially</p>
</li>
<li><p>There should be no transitive dependencies, that is, non-key columns depending on other non-key columns.</p>
</li>
</ol>
<h2 id="heading-example">Example</h2>
<p>create table for save contact</p>
<h3 id="heading-wrong-way">Wrong way</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756950576998/722251ad-40db-48b8-9314-464a00032018.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-the-right-way">The right way</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756950593180/b4e7c305-18b9-49f8-94be-d7a8e3293390.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-practice">Practice</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756951892775/d174d1ca-8294-4c4d-a390-faef26506691.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-study-case">Study Case</h2>
<p>online shop, Create a table to record orders and goods</p>
<h3 id="heading-the-wrong-way">The Wrong Way</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756951207059/48342389-ec07-4b59-bc04-68b8ed343189.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-the-right-way-1">The Right way</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756950996334/946619fb-2b5f-47a3-b347-4672c3207606.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756951032488/486a4ab7-30d1-4eed-b5d3-a8610e9d0fc2.png" alt class="image--center mx-auto" /></p>
<h2 id="heading-case-study">Case Study</h2>
<p>Table for mini library</p>
<h3 id="heading-wrong-way-1">Wrong Way</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756951390583/6f19f3c8-5556-4928-8a85-41986b57aa77.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-right-way">Right Way</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756951531978/3f525943-8557-45a9-92bf-43bbd7c90d19.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756951545875/8c3babef-7490-45fc-af66-be3c37008993.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-practice-1">Practice</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756952562007/532b004d-a2dd-400b-ab3d-02c54e1be5dd.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756952565775/d4364b9e-e8a6-4db4-b6ba-6544ede8617e.png" alt class="image--center mx-auto" /></p>
<p>Why you can't use "order" for a table name in PostgreSQL?</p>
<hr />
<p>It's like having a special key for a specific door. In PostgreSQL, <code>ORDER</code> is a <strong>reserved keyword</strong>. This means it has a special job—it's used to sort data (like in <code>ORDER BY</code>).</p>
<p>Because it's a reserved word, the database won't let you use it for a table or column name, as it would cause confusion and errors.</p>
<p>To fix this, you just need to pick a different name that isn't already "taken," like <code>orders</code> or <code>purchase_orders</code>.</p>
<p>— GEMINI</p>
<p>END !!!!</p>
<p>SEE YOU NEXT TIME .</p>
]]></content:encoded></item><item><title><![CDATA[Download Node JS and Try With Git Bash]]></title><description><![CDATA[Go to https://nodejs.org/en/download/ and download node js


Open node js installer


and click and click








Open your Git Bash and write ‘node —version‘ for check version node

create a folder for our project and go into it write ‘node name_fil...]]></description><link>https://blog.alchemists.my.id/download-node-js-and-try-with-git-bash</link><guid isPermaLink="true">https://blog.alchemists.my.id/download-node-js-and-try-with-git-bash</guid><category><![CDATA[Tutorial]]></category><category><![CDATA[tutor]]></category><category><![CDATA[Node.js]]></category><category><![CDATA[node]]></category><category><![CDATA[terminal]]></category><category><![CDATA[gitbash]]></category><category><![CDATA[download]]></category><category><![CDATA[simple]]></category><category><![CDATA[Developer]]></category><category><![CDATA[technology]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[programming languages]]></category><category><![CDATA[programming]]></category><category><![CDATA[software development]]></category><category><![CDATA[Software Engineering]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Thu, 04 Sep 2025 00:52:16 GMT</pubDate><content:encoded><![CDATA[<p>Go to <a target="_blank" href="https://nodejs.org/en/download/">https://nodejs.org/en/download</a>/ and download node js</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756882752570/525626a2-1601-4f5d-95d7-72909f731a24.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756882769576/cc670c4a-d7e6-4a75-9f19-d99f6c25be8f.png" alt class="image--center mx-auto" /></p>
<p>Open node js installer</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756883004217/68ec4f80-4200-4719-9a31-93c5dde28f44.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756882828125/9eba099a-499c-4f34-8eea-534142767aea.png" alt class="image--center mx-auto" /></p>
<p>and click and click</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756882853930/c0d971da-502f-4c25-90a2-3187b85ff661.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756882859659/353f5edf-e787-4ee7-ba06-b810dcd60337.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756882863100/12853b16-c7d5-4f2d-a997-8bb1ef92fea6.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756882866639/ece4461d-2b03-470b-b045-414a04978643.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756882871785/1f901f99-d821-490b-bf03-44e77d756149.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756882875820/0e1164cd-27c7-481a-99b7-8cc786549a07.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756882878866/a983b539-23f0-4424-900b-2412e7d17bef.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756882888532/950d4338-b6b3-4bfe-83e4-363962010fb9.png" alt class="image--center mx-auto" /></p>
<p>Open your Git Bash and write ‘node —version‘ for check version node</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756883014226/6e69e81d-9df8-4ac5-bb5a-5a7a64444a42.png" alt class="image--center mx-auto" /></p>
<p>create a folder for our project and go into it write ‘node name_file‘ to edit the file if you have a file, and if you don’t have a file it will create a file</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756946515231/37d368d0-dbb4-4491-ac8c-a52429211f23.png" alt class="image--center mx-auto" /></p>
<p>this is the image if you enter ‘node name_file‘ it is empty but i have filed it in</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756945922466/930cda9a-bea2-4ecd-8ebf-9f92d23ae832.png" alt class="image--center mx-auto" /></p>
<p>you can write the contents of the file there</p>
<p>To get out of there, you can click ctrl + x then write the letter y in capital letters then enter</p>
<p>to run the code you can write ‘node name_file‘</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756946532305/e24c704f-c086-41f3-a5b1-6b56d4cccad1.png" alt class="image--center mx-auto" /></p>
<p>ANDDD ENDDDD!!!!!</p>
<p>Hey you can also follow me for further tutorials 😁😁😁😁</p>
]]></content:encoded></item><item><title><![CDATA[Database For Simple Register]]></title><description><![CDATA[Preparation

Create ERD with draw.io

Determine type data for column every table


Let’s Practice

Go to terminal

Create all table
 
 

Insert data into table
 
 

show list student with parent
 

Show list student who haven’t paid
 

Show total pai...]]></description><link>https://blog.alchemists.my.id/database-for-simple-register</link><guid isPermaLink="true">https://blog.alchemists.my.id/database-for-simple-register</guid><category><![CDATA[Databases]]></category><category><![CDATA[PostgreSQL]]></category><category><![CDATA[simple]]></category><category><![CDATA[terminal]]></category><category><![CDATA[technology]]></category><category><![CDATA[tech ]]></category><category><![CDATA[ERD (Entity-Relationship Diagrams)]]></category><category><![CDATA[table]]></category><category><![CDATA[register]]></category><category><![CDATA[data]]></category><category><![CDATA[for]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[tutorials]]></category><category><![CDATA[tutor]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Mon, 01 Sep 2025 03:26:26 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-preparation">Preparation</h2>
<ol>
<li><p>Create ERD with draw.io</p>
</li>
<li><p>Determine type data for column every table</p>
</li>
</ol>
<h2 id="heading-lets-practice">Let’s Practice</h2>
<ol>
<li><p>Go to terminal</p>
</li>
<li><p>Create all table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756862013163/6189e67c-d11e-40ab-8687-eb4ef6760361.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756862017764/76131c5b-d7d4-433c-b09f-ec6bed9fd6f1.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Insert data into table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756862034331/2cff6c91-1e9e-48de-a7a0-ce60d5be43a2.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756862039037/e0f7cd3d-bcda-45d1-ac3d-5c8aa6164f62.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>show list student with parent</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756864143768/4bed8849-1574-492a-8302-0cc11853764d.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Show list student who haven’t paid</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756864159850/6a59d94d-03bd-4a7e-aeca-362a8025e7d6.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Show total paid</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756864149712/38aa2b2f-6d0d-44cd-92ed-bf5566036a0f.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<h2 id="heading-end"><strong>END!!!!!</strong></h2>
<p>Thanks and see you next time</p>
<p>😁😁😵‍💫😵‍💫🤗🤗😆😆</p>
]]></content:encoded></item><item><title><![CDATA[Practice Creating an Attendance System in a Boarding School]]></title><description><![CDATA[Create ERD
 

Create all table
 
 
 

Create Index
 

Insert data into tables
 
 
 
 

crud operations on tables

In table class

Create
 
 

Read
 

Update
 

Delete
 
 



In table teacher

Create
 

Read
 

Update
 

Delete
 



In table student

...]]></description><link>https://blog.alchemists.my.id/practice-creating-an-attendance-system-in-a-boarding-school</link><guid isPermaLink="true">https://blog.alchemists.my.id/practice-creating-an-attendance-system-in-a-boarding-school</guid><category><![CDATA[practice]]></category><category><![CDATA[boarding schools]]></category><category><![CDATA[system]]></category><category><![CDATA[database]]></category><category><![CDATA[PostgreSQL]]></category><category><![CDATA[terminal]]></category><category><![CDATA[create database]]></category><category><![CDATA[create]]></category><category><![CDATA[ERD (Entity-Relationship Diagrams)]]></category><category><![CDATA[#ERD]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Thu, 28 Aug 2025 07:02:13 GMT</pubDate><content:encoded><![CDATA[<ol>
<li><p>Create ERD</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756352062203/e6ef4319-e6db-4197-9092-9405844aef2d.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Create all table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756352139996/8f549810-9a9e-43b2-b369-1d950b483b21.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756352163420/5dbefd85-a349-4706-88b3-d8887e467cc8.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756352178933/f153bbc6-6a90-478c-84a3-27dccab9a0f7.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Create Index</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756352188164/1d242c4e-e9bc-4104-8207-5a6072e30cb0.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Insert data into tables</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756362280290/17820f2b-28a6-4102-a4bb-e832eb40d23c.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756362286073/a21afdbc-4139-4f42-9697-e90fcbeae9f0.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756362290358/d54f5eab-85f7-4683-99e3-5e8fc5c8471f.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756362371948/c8377ca7-26ee-40b9-b026-c8de154b8077.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>crud operations on tables</p>
<ol>
<li><p>In table class</p>
<ol>
<li><p>Create</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756362581161/74367cd0-ad59-4dfc-8e3c-eec74d6dacbc.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756362585589/8b3ceb45-9a7e-433e-86d8-0b96e93c9547.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Read</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756362672290/a428d66f-c387-400a-8745-78feecd63a1d.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Update</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756362784785/bb5a9ff6-c153-43e2-ba62-e64bb4ff0d2f.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Delete</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756362866095/53875544-2daa-4c8f-998b-032d03c22727.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756363551497/1a6ae4e7-11b6-4510-a970-ee4a9a2119e3.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
<li><p>In table teacher</p>
<ol>
<li><p>Create</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756363136665/857598ee-2a78-4ea9-ac91-16d8796a2957.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Read</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756363213733/1036f59f-faaf-44ab-bf57-d50b8d007959.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Update</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756363534024/b8d517a7-4a0a-482a-b12f-276b7e91364f.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Delete</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756363540032/1e345790-f87f-4118-9b8c-7930600c0d08.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
<li><p>In table student</p>
<ol>
<li><p>Create</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756364083001/33248f92-c144-4bab-ab42-ae181966a28d.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Update</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756364109035/f7abc9d5-2cd1-4fbc-9973-478e4f046f12.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Read</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756364099996/c55a2d81-22e4-47cf-b514-4802a0ae6953.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Delete</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756364115037/5f6d3b20-0d57-4725-8d46-2d01d388fda1.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
<li><p>In table schedule</p>
<ol>
<li><p>Create</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756534847162/bddb3081-1872-45b1-b777-d70f2ae4e8fc.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Update &amp; Read</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756534856528/fb813ba4-6e49-46de-b9d9-0d54d0fddc0f.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Delete</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756534860507/d49c73ac-d7cc-4827-9d99-8a0f3e4b48df.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
<li><p>In table attendance</p>
<ol>
<li><p>Create</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756534864779/da8dc695-0b7b-4e2b-906e-c77d79f15ecd.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Update &amp; Read</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756534874500/96c175d7-733f-4535-994d-d97d0219ff07.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Delete</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756534878942/37a0593c-566c-4ac3-9a16-d2b87b103d64.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
</ol>
</li>
<li><p>Recap</p>
<ol>
<li><p>Status</p>
<ol>
<li><p>per day</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756695459134/b0190418-dd98-45ac-b2d8-9b2be5effcfd.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>per month</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756695481203/10473bad-b267-4b04-b9d9-38f8a81d1710.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
<li><p>Late</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756695497918/8ade1411-0030-4602-83e0-ea088a3c1c2b.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
<li><p>Constraint test</p>
<ol>
<li><p>By student_id</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756695517830/afc15a38-bb37-4a55-b29b-1119ad1d523c.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756695549478/576c39c9-9c1c-478c-913c-9c9b69dad387.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>By FK</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756695546499/11f5769b-fb10-444a-8e47-c7fcee0a00f0.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>UNIQUE( date, schedule, student ) in table attendance</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756695555762/bb91fd16-ed4d-4e92-bbb7-ba79815970a1.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756695563631/d654df84-9281-49fd-8ee9-0e86e3a6599d.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Test check in column late_minutes in attendance table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756695559326/cd147eb2-3fe7-4bc3-a377-c8b0b306abe1.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
</ol>
<h3 id="heading-oke-see-you-next-time-gusy">Oke See You next time gusy</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756859913009/94230bb6-ffdd-4c59-bf86-1bdf68be3e8c.gif" alt class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Book Loan Records]]></title><description><![CDATA[what will we do
We will create a book lending system so that we can know what books are borrowed and who borrowed them and prevent books from getting lost.
travel map

Create ERD and determine type from each data

Practice and create the system

Inse...]]></description><link>https://blog.alchemists.my.id/book-loan-records</link><guid isPermaLink="true">https://blog.alchemists.my.id/book-loan-records</guid><category><![CDATA[PostgreSQL]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[system]]></category><category><![CDATA[backend]]></category><category><![CDATA[backend developments]]></category><category><![CDATA[Backend Development]]></category><category><![CDATA[library]]></category><category><![CDATA[Records]]></category><category><![CDATA[ERD (Entity-Relationship Diagrams)]]></category><category><![CDATA[books]]></category><category><![CDATA[book]]></category><category><![CDATA[tutor]]></category><category><![CDATA[terminal]]></category><category><![CDATA[Case Study]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Wed, 27 Aug 2025 07:02:49 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-what-will-we-do">what will we do</h2>
<p>We will create a book lending system so that we can know what books are borrowed and who borrowed them and prevent books from getting lost.</p>
<h2 id="heading-travel-map">travel map</h2>
<ol>
<li><p>Create ERD and determine type from each data</p>
</li>
<li><p>Practice and create the system</p>
</li>
<li><p>Insert data to each table</p>
</li>
<li><p>See results</p>
</li>
</ol>
<h2 id="heading-lets-go">Let’s Go!!!!</h2>
<ol>
<li><p>Create ERD</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756277234868/ad9a8707-3636-459e-bd47-2fc0771d5c0d.png" alt class="image--center mx-auto" /></p>
<p> PK = Primary Key</p>
<p> FK = Foreign Key</p>
</li>
<li><p>Open your terminal and login to postgresql</p>
</li>
<li><p>Cek your table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756277762125/c5a763c8-3251-4f3e-abf0-bb08114932e4.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>If you have a book table, you can delete it first.</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756277773321/29ea5ea8-6c2d-4c80-b967-86cbf8e40fef.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Create All tables</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756277524426/a21d8e78-0170-4556-be85-064e959e948a.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756277536569/cb169b58-421d-4681-b6ff-3d3d11613624.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756277545000/60b2728c-0310-413c-8600-96172ed8c4cc.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Insert data to table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756277752127/817eee1d-804c-4d2d-b0e8-97a076210308.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756277617175/c44e9df1-a36b-472a-ab6b-2035bcaddf9b.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Show result</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756277657123/b0432141-9473-4435-9821-822a4fc03b02.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>My Error and typos</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756277780737/07085d74-f2c3-4d66-91fe-27a39e9cc33e.png" alt class="image--center mx-auto" /></p>
<p>i forget the quotation marks</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756277784382/00153074-9dff-46c6-b3db-2e9a3355a737.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756277788123/dfa34174-ced4-4a03-a066-41dca9250d9b.png" alt class="image--center mx-auto" /></p>
<p>END !!!</p>
<p>See you next time 😵‍💫🥱🤗😁👋.</p>
]]></content:encoded></item><item><title><![CDATA[Entity Relationship Diagram (ERD)]]></title><description><![CDATA[What is ERD ?
ERD is diagram data for facilitate manufacture database, in this diagram we can determined type data before we create table.
ERD definition

Entity => object

Attribute => Detailed information owned by the object

Relationship => relati...]]></description><link>https://blog.alchemists.my.id/entity-relationship-diagram-erd</link><guid isPermaLink="true">https://blog.alchemists.my.id/entity-relationship-diagram-erd</guid><category><![CDATA[ERD (Entity-Relationship Diagrams)]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[PostgreSQL]]></category><category><![CDATA[Databases]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Sat, 23 Aug 2025 06:15:12 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-what-is-erd">What is ERD ?</h2>
<p>ERD is diagram data for facilitate manufacture database, in this diagram we can determined type data before we create table.</p>
<h2 id="heading-erd-definition">ERD definition</h2>
<ul>
<li><p>Entity =&gt; object</p>
</li>
<li><p>Attribute =&gt; Detailed information owned by the object</p>
</li>
<li><p>Relationship =&gt; relationship between object</p>
</li>
</ul>
<h2 id="heading-types-of-relationship">Types of relationship</h2>
<ul>
<li><p>One to One ( 1 : 1 )</p>
</li>
<li><p>One to Many ( 1 : N )</p>
</li>
<li><p>Many to Many ( M : N )</p>
</li>
</ul>
<h2 id="heading-preparation-before-create-erd">Preparation before create ERD</h2>
<ul>
<li><p>Create case study ( today i want to take a case study of a class and student )</p>
</li>
<li><p>Identification entity required</p>
</li>
<li><p>Specify the attribute type</p>
</li>
<li><p>Specify relation entity</p>
</li>
<li><p>Create ERD with draw.io</p>
</li>
</ul>
<h2 id="heading-lets-practice">Let's Practice</h2>
<ul>
<li><p>Open draw.io</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755930942556/6b811a8e-38a5-4c4f-98b4-84407fa8690d.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Create 5 list</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755931720956/cef9897b-8cc6-4ca1-aaef-173ce63e5876.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>List for learner, mentor, profil_mentor, project and class.</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756092068527/0a4bd4e6-7acf-4338-81c5-70d4b6c706a4.png" alt class="image--center mx-auto" /></p>
<p>  PK =&gt; Primary Key</p>
<p>  o =&gt; many</p>
<p>  | =&gt; one</p>
</li>
<li><p>Go to terminal</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755931838700/29c6986b-1e3b-43fd-a186-a876cd1a0212.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Create All Table</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756090135019/e93f9bb8-0d0b-4279-911b-5973539f9b49.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756090139748/512582c1-363e-46f6-8558-69a251a3bb01.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756090162994/6f99eca9-fd24-4e25-a8ce-bc43cb81b1b9.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756090484111/17b19bf7-f6b1-4e2b-a9c3-ec1683399d9b.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Insert data into table</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756090146838/74aebe99-dcc2-480c-9466-129424a51b3d.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756090491249/2007a8bb-fae6-4654-b156-2809b5d7a67a.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>See final the table from the merge of all tables</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756091101041/a17cc76d-d05d-4804-a69c-cb8fd8c4b1ec.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756090514282/cd320882-91fe-4405-a547-7f3ca9a2d31a.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1756090532436/2365f7a0-f2a5-477f-a63b-314bf29938b5.png" alt class="image--center mx-auto" /></p>
</li>
</ul>
<h2 id="heading-tables-relationships">TABLES Relationships</h2>
<ul>
<li><p>Mentor to profil_mentor =&gt; 1 : 1</p>
</li>
<li><p>Mentor to Class =&gt; 1 : M</p>
</li>
<li><p>Class to learner =&gt; M : 1</p>
</li>
<li><p>Project to Mentor =&gt; N : M</p>
</li>
<li><p>Project to Learner =&gt; N : M</p>
</li>
</ul>
<h2 id="heading-end">END !!! 😵‍💫😵‍💫😵‍💫🥱🥱</h2>
<h2 id="heading-see-you-next-time">SEE YOU NEXT TIME 😁😁🤗🤗</h2>
]]></content:encoded></item><item><title><![CDATA[Simple Case Study for Exercise CRUD in PostgreSQL Terminal]]></title><description><![CDATA[Case Study

create a database for bootcamp registration

Flow main

day-1 : open registration bootcamp

day-2 : incoming registrants

day-3 : assessment >= 60 = accepted, < 59-40 = reserve, <40 = rejected

day-5 : remove those with lower scores and i...]]></description><link>https://blog.alchemists.my.id/simple-case-study-for-exercise-crud-in-postgresql-terminal</link><guid isPermaLink="true">https://blog.alchemists.my.id/simple-case-study-for-exercise-crud-in-postgresql-terminal</guid><category><![CDATA[crud]]></category><category><![CDATA[CRUD Operations]]></category><category><![CDATA[PostgreSQL]]></category><category><![CDATA[postgres]]></category><category><![CDATA[terminal]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Exercise]]></category><category><![CDATA[technology]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Wed, 20 Aug 2025 06:28:35 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-case-study"><strong>Case Study</strong></h2>
<ul>
<li>create a database for bootcamp registration</li>
</ul>
<h2 id="heading-flow-main"><strong>Flow main</strong></h2>
<ul>
<li><p>day-1 : open registration bootcamp</p>
</li>
<li><p>day-2 : incoming registrants</p>
</li>
<li><p>day-3 : assessment &gt;= 60 = accepted, &lt; 59-40 = reserve, &lt;40 = rejected</p>
</li>
<li><p>day-5 : remove those with lower scores and incomplete personal data</p>
</li>
</ul>
<h2 id="heading-data"><strong>Data</strong></h2>
<ul>
<li><p>Fajar, test scores = 85, already paid the payment, complete personal data</p>
</li>
<li><p>Rika, test scores = 58, have not paid the payment, personal data is incomplete</p>
</li>
<li><p>Tono, test score = 35, have not paid the payment, complete personal data</p>
</li>
</ul>
<h2 id="heading-crud"><strong>CRUD</strong></h2>
<ol>
<li><p>open terminal and login to postgres</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755672334285/e6160c23-d76c-487c-92df-2ffff991518e.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Create table bootcamp —day-1</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755672349535/24d39db6-f70b-41ff-9e4f-93789daf0b83.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>INSERT data INTO table —day-2</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755672359240/225b3d4c-5195-49fe-9523-522588b8bc95.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755672384008/f4069294-e52e-4f05-b7ba-717b1d3557bb.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>update data —day-3</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755742371613/05a2523b-34de-4e48-8ce4-5629fc425099.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>update data and delete whose personal data is incomplete and have not paid —day-5</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755672652999/82a621c1-00ca-43f0-9327-2c7c831b5ea9.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>END!</p>
<p>Thanks and see you next time.</p>
]]></content:encoded></item><item><title><![CDATA[Simple Practice CRUD with 7 case studies]]></title><description><![CDATA[First open and login to database

Guest Book

Problem context : Classes often have visitors (parents, alumni, stationery suppliers). It's important to note who's coming, what they need, and their contact information—so you can easily follow up.

Main...]]></description><link>https://blog.alchemists.my.id/simple-practice-crud-with-7-case-studies</link><guid isPermaLink="true">https://blog.alchemists.my.id/simple-practice-crud-with-7-case-studies</guid><category><![CDATA[crud]]></category><category><![CDATA[PostgreSQL]]></category><category><![CDATA[postgres]]></category><category><![CDATA[terminal]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Case Study]]></category><category><![CDATA[simple]]></category><category><![CDATA[practice]]></category><category><![CDATA[Practice coding]]></category><category><![CDATA[coding]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Sat, 16 Aug 2025 04:28:51 GMT</pubDate><content:encoded><![CDATA[<p>First open and login to database</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349399526/616851f4-2d54-492f-b433-45bb501f427c.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-guest-book">Guest Book</h3>
<ul>
<li><p><strong>Problem context :</strong> Classes often have visitors (parents, alumni, stationery suppliers). It's important to note who's coming, what they need, and their contact information—so you can easily follow up.</p>
</li>
<li><p><strong>Main Flow :</strong></p>
<ol>
<li><p>Guests arrive → are recorded.</p>
</li>
<li><p>The homeroom teacher reviews today's guest list.</p>
</li>
<li><p>If there are any typos, correct them.</p>
</li>
<li><p>Invalid entries → delete them.</p>
</li>
</ol>
</li>
<li><p><strong>solution</strong></p>
<ol>
<li><p>Create table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349401411/cd1e0165-09c9-4279-9d9c-8fadf8542715.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Insert data into table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349413184/845ca84b-163f-4d3c-a603-de88f2dd20a4.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349420577/ae6515e2-21a6-4011-8d12-7a7ec0c48a42.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>see the result</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349426847/79d88d88-776d-4c33-8c90-e8015192515a.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>update and delete data</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349431911/ed95b5ca-39c0-47a9-a569-96fcd82cf4eb.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
</ul>
<h3 id="heading-daily-activity-agenda">Daily Activity Agenda</h3>
<ul>
<li><p><strong>Problem Context:</strong> Lots of activities: on duty, studying, sports, competitions. I often forget the time and who's in charge. Keep a simple daily agenda.</p>
</li>
<li><p><strong>Main Flow:</strong> Create agenda → view today's list → mark status as complete → correct/delete if necessary.</p>
</li>
<li><p><strong>Solution</strong></p>
<ol>
<li><p>Create table and insert data into table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349455601/ff6f2375-c96c-4707-9d3b-a47df4286f80.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>update and delete data</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349465695/683fb758-6a6d-48f3-86e5-04ddf8832263.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
</ul>
<h3 id="heading-contact-list">Contact List</h3>
<ul>
<li><p><strong>Problem Context:</strong> Likely to lose friends/parents/dormitor numbers. Create a simple contact book.</p>
</li>
<li><p><strong>Main Flow:</strong> Add contact → search contact → update number → delete duplicate.</p>
</li>
<li><p><strong>Solution</strong></p>
<ol>
<li><p>Create Table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349472185/bad81074-e670-4f81-a719-f59e27a71076.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Insert data into table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349476679/c69f2b52-6e34-4ae1-b008-d41cd9989e47.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>see the results</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349480263/c7af1608-502a-4d7c-b803-228cc652a8e4.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>update and delete data</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349482610/89814a1c-bf50-482a-86d4-587485eb57fd.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
</ul>
<h3 id="heading-daily-memorization-notes">Daily Memorization Notes</h3>
<ul>
<li><p><strong>Problem Context:</strong> Students need to record their memorization notes so that they can see their progress day by day.</p>
</li>
<li><p><strong>Main Flow:</strong> Record deposits → see weekly recap → correct if wro<strong>ng.</strong></p>
</li>
<li><p><strong>Solution</strong></p>
<ol>
<li><p>Create table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349497910/b0f59524-0b5c-4487-8aec-e76fcccdfd49.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Insert data into table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349503870/aa765f9d-fd44-4567-a478-38f803c69765.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>See the results</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349507425/84269e1f-89d2-4dc3-b836-4db29036cedf.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Update and Delete data</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349514434/7e5cee82-82b9-48cc-b6a6-05a4924e2df5.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
</ul>
<h3 id="heading-personal-savings-notes">Personal Savings Notes</h3>
<ul>
<li><p><strong>Problem Context:</strong> Students want to keep track of small savings (pocket money). A simple in/out transaction table.</p>
</li>
<li><p><strong>Main Flow:</strong> Record income/expenses → see the final balance → correct if there are any wrong numbers.</p>
</li>
<li><p><strong>Solution:</strong></p>
<ol>
<li><p>Create table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349516583/6b76712a-021e-479c-8ae0-dc658ddca8da.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Insert Data Into table, and see the remaining money results</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349542587/0259bed2-2cb2-4bfc-8d25-6b42dca0e216.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Update and Delete data</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349550198/9c62d93f-f6e6-4d78-9d0c-1f1b86fe6c08.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349554658/0f7c9fe9-bdd0-4407-abbf-06523ba1f9b9.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
</ul>
<p>t</p>
<h3 id="heading-classroom-item-loan-simple-log">Classroom Item Loan (Simple Log)</h3>
<p><code>“This single-table version is just a log, not a full inventory system. It's enough to know who borrowed what today.“</code></p>
<ul>
<li><p><strong>Problem Context:</strong> The class has equipment (balls, markers, speakers). They're often borrowed but I forget who brought them.</p>
</li>
<li><p><strong>Main Flow:</strong> Record borrowing → when returned, update the return column → active borrowing list.</p>
</li>
<li><p><strong>Solution:</strong></p>
<ol>
<li><p>Create Table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755352816106/5775ac6c-e56b-47dc-a41b-aedce648003e.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Insert data into table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755352820233/5c8b323d-9edb-498d-91ae-87de851f0f25.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Update and Delete data</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755352825429/1e6ec716-92a1-4b9f-98f5-6dc9910bd24c.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
</ul>
<h3 id="heading-simple-assignmentsquizzes-grade-per-assignment">Simple Assignments/Quizzes (Grade Per Assignment)</h3>
<p><code>Not a report card system; simply record the grade for one assignment/quiz per line.</code></p>
<ul>
<li><p><strong>Problem Context:</strong> Teachers want a quick recap of daily quiz scores without the hassle of lots of tables.</p>
</li>
<li><p><strong>Main Flow:</strong> Input value → see today's ranking → correct value if written incorrectly.</p>
</li>
<li><p><strong>Solution</strong></p>
<ol>
<li><p>Create Table Insert data into table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755352837731/9596f1a3-63ce-4a48-b0db-baa0bc9f8058.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Update and Delete Data</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755352843676/1361ccd3-e8ad-4a2b-8d17-79d31942d12f.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
</li>
</ul>
<p>ERRORS</p>
<ul>
<li><p>My error just because of typos and use the ‘</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349410402/663eadb2-9b50-4c07-b2d7-f8429bfc7f2c.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349417574/f3825c23-c2f0-4c67-81c3-f647ef0e61d7.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349434832/3eb61f9b-cd01-4879-8b75-8ffaa5e12020.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755349467994/2de216fd-9734-4219-8e5c-dda907a880d6.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755352811806/1ff59c9d-9eba-4cad-a553-1ee5ac644347.png" alt class="image--center mx-auto" /></p>
<p>  Follow me for more practice</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Build ERD & Database Without the Headache: Dormitory Exit Permit Case Study]]></title><description><![CDATA[Today i want to create Database and ERD with case study is an exit permission for student in Dormitories

Go to gemini and write like this
 

if you already understand, go to draw.io, for create ERD
 

create 3 list, for teacher, student, and licensi...]]></description><link>https://blog.alchemists.my.id/build-erd-and-database-without-the-headache-dormitory-exit-permit-case-study</link><guid isPermaLink="true">https://blog.alchemists.my.id/build-erd-and-database-without-the-headache-dormitory-exit-permit-case-study</guid><category><![CDATA[PostgreSQL]]></category><category><![CDATA[postgres]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[terminal]]></category><category><![CDATA[terminal command]]></category><category><![CDATA[SQL]]></category><category><![CDATA[#SQLtutorial ]]></category><category><![CDATA[technology]]></category><category><![CDATA[IT]]></category><category><![CDATA[ERD (Entity-Relationship Diagrams)]]></category><category><![CDATA[Case Study]]></category><category><![CDATA[Databases]]></category><category><![CDATA[database]]></category><category><![CDATA[data]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Thu, 14 Aug 2025 06:23:40 GMT</pubDate><content:encoded><![CDATA[<h2 id="heading-today-i-want-to-create-database-and-erd-with-case-study-is-an-exit-permission-for-student-in-dormitories">Today i want to create Database and ERD with case study is an exit permission for student in Dormitories</h2>
<ol>
<li><p>Go to gemini and write like this</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755047993802/989e9b6c-cf3c-4633-acfd-bc0e0226a60a.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>if you already understand, go to draw.io, for create ERD</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755048170598/8c366ac3-c3f1-4538-96e1-bfbbe83ef70c.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>create 3 list, for teacher, student, and licensing with type data column</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755131822928/113daa0c-5407-4fb9-aa19-47f2a12d895b.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>finally ERD</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755130340099/75d68d5b-877d-427e-82e7-128cd6b84f65.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>go to terminal, and login for start our project</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755136532617/12dac6cd-8c2e-4d2a-9f92-5c74082e5f4f.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>create table student, teacher and exitpermits</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755136463179/2bbdf8e6-495b-481e-812e-b90bb8e68018.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755136469063/92d41ac0-64ca-4f23-94a4-4876552b3b2b.png" alt class="image--center mx-auto" /></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755136477355/45fd0538-7680-45b7-9289-afcbaf8cee00.png" alt class="image--center mx-auto" /></p>
<p> FOREIGN KEY is</p>
</li>
<li><p>add values to tables</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755136447051/c496608e-18e7-4eea-942d-4ab78a98ad17.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>and the finally step is displaying the data</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755136426445/dd714a29-ac23-49de-89ba-4d29fb71e58d.png" alt class="image--center mx-auto" /></p>
<p> in the table there are two identical clolumns, one is student and other is teacher</p>
</li>
</ol>
<h2 id="heading-bonuses">BONUSES</h2>
<p>Behind The Scene &amp; ERRORS.</p>
<ul>
<li><p>here I made mistake, instead of creating table i creating a database</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755138898777/73bdcc50-65f5-4a6f-9ad2-a9a07b80d57e.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>this error is due to my typos, primary key can’t written in front type data column</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755138982077/a1cc71b8-1f4e-461f-b5f5-c03dc93b8fae.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>FOREIGN KEY should unique or type data is PRIMARY KEY</p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755138990760/50733798-9c91-4b9b-8480-e6ee52577533.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755138997207/abc5143b-1418-4d6e-85c4-a55e6ce78586.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755139005953/05a5ac5b-301a-496d-adad-377b72b61760.png" alt class="image--center mx-auto" /></p>
<p>  <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1755139023030/5f1b5730-24ce-44de-a471-84b6d94b240e.png" alt class="image--center mx-auto" /></p>
<p>  EENNNNNDDDDDDD!!!!!!, follow me for more tutorial about database.</p>
<p>  I 💖 Error.</p>
</li>
</ul>
]]></content:encoded></item><item><title><![CDATA[Simple CRUD in Postgres]]></title><description><![CDATA[Open Your Terminal
 

write “psql -U postgres”, -U = User , postgres is user
 

Create Database book store
 

enter to database book store with “\c book_store”, in the second red box is name database that we enter
 

Create Table book, ‘create table ...]]></description><link>https://blog.alchemists.my.id/simple-crud-in-postgres</link><guid isPermaLink="true">https://blog.alchemists.my.id/simple-crud-in-postgres</guid><category><![CDATA[CRUD Operations]]></category><category><![CDATA[crud]]></category><category><![CDATA[PostgreSQL]]></category><category><![CDATA[terminal]]></category><category><![CDATA[terminal command]]></category><dc:creator><![CDATA[MUHAMMAD]]></dc:creator><pubDate>Mon, 11 Aug 2025 03:21:08 GMT</pubDate><content:encoded><![CDATA[<ol>
<li><p>Open Your <strong>Terminal</strong></p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754881063547/7b5c0d63-eead-4996-9365-b3eb477aefa4.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>write “psql -U postgres”, -U = User , postgres is user</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754881266790/f30690b8-6827-432f-803a-19dbc6253b11.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Create Database book store</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754881278144/1849e55e-14a2-4fa0-b450-9f1170cd1c74.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>enter to database book store with “\c book_store”, in the second red box is name database that we enter</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754881289790/348b25f8-74b3-4907-a522-333b0055bf05.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Create Table book, ‘create table book (column);’</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754881294169/22609e61-3bd7-4f59-8172-f5a4b97eb17a.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>insert data into book table</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754881297797/56ec7682-d77f-4c4b-86f9-767ca795810a.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>view saved data with select <em>from book, *</em> = all data</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754881301524/b89e0f02-201e-4ab0-bcd1-986483707cf7.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Update data ‘Update book Set price = 40 WHERE id =1’ , update data in table book and edit price in id 1</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754881309681/396fd459-acd6-40bf-96ab-6fcd441a5652.png" alt class="image--center mx-auto" /></p>
</li>
<li><p>Delete data, but before that enter one more data</p>
<p> <img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1754881312586/4ffc3271-1bf8-447b-be05-ce5e7ed7d60e.png" alt class="image--center mx-auto" /></p>
</li>
</ol>
<p>Note:</p>
<ol>
<li><p>don’t copy paste because this trains your writing details from typos</p>
</li>
<li><p>don’t forget semicolon because it makes your command not work</p>
</li>
<li><p>don’t forget between dots and commas</p>
</li>
</ol>
<p>follow me for more and more information about IT!, Thanks.</p>
]]></content:encoded></item></channel></rss>