<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Husen</title>
    <description>The latest articles on DEV Community by Husen (@heyhusen).</description>
    <link>https://dev.to/heyhusen</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F384364%2F2749674b-067d-4210-966e-64d6076b8d0f.jpg</url>
      <title>DEV Community: Husen</title>
      <link>https://dev.to/heyhusen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/heyhusen"/>
    <language>en</language>
    <item>
      <title>Esteros - Online ice cream shop</title>
      <dc:creator>Husen</dc:creator>
      <pubDate>Mon, 29 Aug 2022 16:49:42 +0000</pubDate>
      <link>https://dev.to/heyhusen/esteros-online-ice-cream-shop-30ib</link>
      <guid>https://dev.to/heyhusen/esteros-online-ice-cream-shop-30ib</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbn4focipeiczu9qmo3io.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbn4focipeiczu9qmo3io.jpg" alt="Es terosss meme" width="225" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Overview of My Submission
&lt;/h3&gt;

&lt;p&gt;My main inspiration in creating this project was the project that was used as an example for this Hackaton. That is, &lt;a href="https://github.com/GoogleCloudPlatform/microservices-demo" rel="noopener noreferrer"&gt;microservices-demo&lt;/a&gt; which is licensed under the &lt;a href="https://github.com/GoogleCloudPlatform/microservices-demo/blob/main/LICENSE" rel="noopener noreferrer"&gt;Apache 2.0 license&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For the name of this project, I was inspired by the meme above. Hahahaha...&lt;/p&gt;

&lt;p&gt;This meme basically describes how most Indonesian mothers respond when their child coughs. Most of them will immediately respond by saying "es terosss" which means "ice agaiiin". So, ice (or ice cream) is always considered the cause of our coughs.&lt;/p&gt;

&lt;p&gt;Okay, time to get serious.&lt;/p&gt;

&lt;p&gt;This project is a very simple web-based online ice cream shop. The app is powered by 3 microservices, all of which are written in TypeScript for the Node.js platform. The three microservices communicate with each other using Redis Pub/Sub, and are linked using API Gateway which is also written in TypeScript for the Node.js platform. To display the interface to the user, this application uses Svelte with its SvelteKit framework which is also written in TypeScript.&lt;/p&gt;

&lt;p&gt;All data is stored in Redis using RedisJSON which can be retrieved with RediSearch, except photos stored in Minio.&lt;/p&gt;

&lt;h3&gt;
  
  
  Submission Category: Microservice Mavens
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Language Used
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Node.js (TypeScript) - Back-end microservices&lt;/li&gt;
&lt;li&gt;Svelte (TypeScript) - Fron-end&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Link to Code
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/hapakaien/esteros" rel="noopener noreferrer"&gt;https://github.com/hapakaien/esteros&lt;/a&gt;&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A9-wwsHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/heyhusen" rel="noopener noreferrer"&gt;
        heyhusen
      &lt;/a&gt; / &lt;a href="https://github.com/heyhusen/esteros" rel="noopener noreferrer"&gt;
        esteros
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Simple online ice cream shop with 3 microservices showcasing the power of Redis Stack.
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;Esteros&lt;/h1&gt;
&lt;/div&gt;
&lt;p&gt;&lt;a href="https://github.com/hapakaien/esteros/actions/workflows/main.yml" rel="noopener noreferrer"&gt;&lt;img src="https://camo.githubusercontent.com/48e90e5ac3ddf87cb1112cc4c13c2df047fb32976b2a1c0424f39fdd09368968/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f686170616b6169656e2f65737465726f732f43493f6c6162656c3d4349267374796c653d666c61742d737175617265" alt="GitHub Workflow Status"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Esteros&lt;/strong&gt; is a microservices demo application. Esteros consists of 4
microservices applications and a front-end. This app is a web-based online ice
cream shop where users can search for the ice cream they like, add it to their
cart, and purchase it.&lt;/p&gt;
&lt;p&gt;This app was created to demonstrate the use of Redis and Minio in modern
microservices based web development.&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/heyhusen/esteros./data/screenshots/1.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JOn5G3-u--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://github.com/heyhusen/esteros./data/screenshots/1.png" alt="Esteros homepage screenshot"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/heyhusen/esteros./data/screenshots" rel="noopener noreferrer"&gt;Click here&lt;/a&gt; for more screenshots.&lt;/p&gt;
&lt;div class="markdown-heading"&gt;
&lt;h2 class="heading-element"&gt;How it works&lt;/h2&gt;
&lt;/div&gt;
&lt;div class="markdown-heading"&gt;
&lt;h3 class="heading-element"&gt;Architecture&lt;/h3&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Esteros&lt;/strong&gt; is composed of 4 microservices written in TypeScript (Node.js) that
talk to each other over &lt;a href="https://redis.io/docs/manual/pubsub/" rel="nofollow noopener noreferrer"&gt;Redis Pub/Sub&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a rel="noopener noreferrer" href="https://github.com/heyhusen/esteros./architecture-diagram.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NmRdgHEc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://github.com/heyhusen/esteros./architecture-diagram.png" alt="Architecture Diagram"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Service&lt;/th&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/heyhusen/esteros./src/frontend" rel="noopener noreferrer"&gt;front-end&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Svelte (TypeScript)&lt;/td&gt;
&lt;td&gt;Exposes an HTTP server to serve the website. Does not require signup/login and generates cookie-based session IDs for all users automatically.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/heyhusen/esteros./src/api-gateway" rel="noopener noreferrer"&gt;api-gateway&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Node.js (TypeScript)&lt;/td&gt;
&lt;td&gt;Connecting all back-end microservices into one REST API.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/heyhusen/esteros./src/product-service" rel="noopener noreferrer"&gt;product-service&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Node.js (TypeScript)&lt;/td&gt;
&lt;td&gt;Provides the list of products from a RedisJSON and ability to search products and get individual products.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;a href="https://github.com/heyhusen/esteros./src/currencyservice" rel="noopener noreferrer"&gt;cart-service&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Node.js (TypeScript)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;…&lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/heyhusen/esteros" rel="noopener noreferrer"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;


&lt;h3&gt;
  
  
  Contributors
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;None&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;Many thanks to all the open source projects that have helped me in making this application.&lt;/p&gt;

&lt;p&gt;Some of them are below.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://git-scm.com/" rel="noopener noreferrer"&gt;Git&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/redis-stack/redis-stack" rel="noopener noreferrer"&gt;Redis Stack&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/minio/minio" rel="noopener noreferrer"&gt;Minio&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/nodejs/node" rel="noopener noreferrer"&gt;Node.js&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/pnpm/pnpm" rel="noopener noreferrer"&gt;pnpm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/microsoft/TypeScript/" rel="noopener noreferrer"&gt;TypeScript&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/sveltejs/kit" rel="noopener noreferrer"&gt;SvelteKit&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Apart from the above, there are many others. However, it would be too long to explain one by one. Mainly which are dependencies of my project.&lt;/p&gt;

&lt;p&gt;Thank you so much everyone for creating a project that has helped the work of many people.&lt;/p&gt;

&lt;h4&gt;
  
  
  Screenshoots
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Homepage&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwm3e6asbnmffbbkgyep7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwm3e6asbnmffbbkgyep7.png" alt="Esteros homepage" width="800" height="599"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Product detail&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frgmlsdk76npcb8ezt3my.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frgmlsdk76npcb8ezt3my.png" alt="Esteros's product detail" width="800" height="599"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cart&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo094gdpmrtmma5ujpr5v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo094gdpmrtmma5ujpr5v.png" alt="Esteros's filled cart" width="800" height="599"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Order complete&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzkjwtaham04ww40pv3py.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzkjwtaham04ww40pv3py.png" alt="Esteros's order complete" width="800" height="599"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Check out &lt;a href="https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries" rel="noopener noreferrer"&gt;Redis OM&lt;/a&gt;, client libraries for working with Redis as a multi-model database.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Use &lt;a href="https://redis.info/redisinsight" rel="noopener noreferrer"&gt;RedisInsight&lt;/a&gt; to visualize your data in Redis.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Sign up for a &lt;a href="https://redis.info/try-free-dev-to" rel="noopener noreferrer"&gt;free Redis database&lt;/a&gt;.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redishackathon</category>
      <category>microservices</category>
      <category>node</category>
      <category>svelte</category>
    </item>
    <item>
      <title>How to use UUID in Laravel</title>
      <dc:creator>Husen</dc:creator>
      <pubDate>Wed, 17 Jun 2020 14:57:18 +0000</pubDate>
      <link>https://dev.to/heyhusen/how-to-use-uuid-in-laravel-240c</link>
      <guid>https://dev.to/heyhusen/how-to-use-uuid-in-laravel-240c</guid>
      <description>&lt;p&gt;As we all know, Laravel provided &lt;code&gt;Str&lt;/code&gt; helper to produce a UUIDv4. However, UUID is not the default primary key they use in their Eloquent. We must implement it ourselves.&lt;/p&gt;

&lt;p&gt;In this article, I will share how use that helper to generate ID (primary key) in Eloquent automatically.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;FYI, I used &lt;a href="https://laravel.com/docs/6.x" rel="noopener noreferrer"&gt;Laravel 6.x&lt;/a&gt; for this example. Maybe, you have to adjust some code, if you have different version.&lt;br&gt;
I assume you have installed Laravel without a single table created.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here are the simple steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Change the automatic increment primary key in the table to UUID.&lt;/li&gt;
&lt;li&gt;Disable auto increment, change the table's primary key to String in Eloquent.&lt;/li&gt;
&lt;li&gt;Use helper to generate UUID in Eloquent automatically.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Change the automatic increment primary key in the table to UUID
&lt;/h3&gt;

&lt;p&gt;Let's take default User model as example.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;The migration above will create &lt;code&gt;users&lt;/code&gt; table with auto increment big integer id as primary key. We can change the migration to something like this.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;blockquote&gt;
&lt;p&gt;If your table has been filled with some data, you must change the primary key by creating a new migration. Delete the primary key, and change the id type column to UUID.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Disable auto increment, and change the table's primary key to String in Eloquent
&lt;/h3&gt;

&lt;p&gt;This is default &lt;code&gt;User&lt;/code&gt; table.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;We have to override &lt;code&gt;getIncrementing()&lt;/code&gt; and &lt;code&gt;getKeyType()&lt;/code&gt; method from system Model. &lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Actually, you can override this using the property. But, I prefer to use the methode. :)&lt;/p&gt;

&lt;h3&gt;
  
  
  Use helper to generate UUID in Eloquent automatically
&lt;/h3&gt;

&lt;p&gt;And finally, add this to boot method of the Model.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;At this point, UUID will automatically be filled. But, this only applies to ordinary Model. If you have a custom Pivot model, you must change it to be like this.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;h2&gt;
  
  
  Bonus
&lt;/h2&gt;

&lt;p&gt;Some of you might not want to bothered with the manual method above. So, I have provided a faster way.&lt;br&gt;
This is the package that I made. You can read the documentation about how to use it.&lt;/p&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A9-wwsHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/datakrama" rel="noopener noreferrer"&gt;
        datakrama
      &lt;/a&gt; / &lt;a href="https://github.com/datakrama/eloquid" rel="noopener noreferrer"&gt;
        eloquid
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Eloquid - Auto set UUID for Eloquent Model
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


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