<?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: Dávid Szabó</title>
    <description>The latest articles on DEV Community by Dávid Szabó (@davidszabo97).</description>
    <link>https://dev.to/davidszabo97</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%2F19063%2Fb75e6b9f-3e67-4306-b4d7-4d34deffcb1c.jpg</url>
      <title>DEV Community: Dávid Szabó</title>
      <link>https://dev.to/davidszabo97</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/davidszabo97"/>
    <language>en</language>
    <item>
      <title>Node.js TypeScript monorepo via NPM workspaces</title>
      <dc:creator>Dávid Szabó</dc:creator>
      <pubDate>Sun, 14 Aug 2022 21:01:59 +0000</pubDate>
      <link>https://dev.to/davidszabo97/nodejs-typescript-monorepo-via-npm-workspaces-4fi3</link>
      <guid>https://dev.to/davidszabo97/nodejs-typescript-monorepo-via-npm-workspaces-4fi3</guid>
      <description>&lt;p&gt;Monorepos are all the rage right now. Modern projects are all using &lt;a href="https://nx.dev/"&gt;NX&lt;/a&gt; to set up a monorepo. But why would you introduce such a complex tool into your tech stack when something simple is often enough?&lt;/p&gt;

&lt;p&gt;Both Yarn and NPM include workspace management in their feature-set. Thus you can manage multiple projects in one workspace. In addition, one of the tools is always available in your project, so why not use it?&lt;/p&gt;

&lt;h2&gt;
  
  
  The fantastic project
&lt;/h2&gt;

&lt;p&gt;You are working on a fantastic project that you happened to name &lt;code&gt;fantastic&lt;/code&gt;. How creative, isn't it?&lt;/p&gt;

&lt;p&gt;&lt;code&gt;fantastic&lt;/code&gt; is a command line application that will showcase how to set up a TypeScript monorepo using NPM workspaces. The &lt;code&gt;fantastic&lt;/code&gt; project was a massive success as a CLI application, and many users wanted to have a graphical user interface to use it. So you decided to create a web interface. Your code currently lives in a single module containing the core logic and the CLI entry-point.&lt;/p&gt;

&lt;p&gt;Therefore you decided to separate the project into three separate packages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;core&lt;/code&gt; - this package contains the core logic of your &lt;code&gt;fantastic&lt;/code&gt; project&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;web&lt;/code&gt; - provides a web interface that interacts with the &lt;code&gt;core&lt;/code&gt; package&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cli&lt;/code&gt; - provides a command line interface that interacts with the &lt;code&gt;core&lt;/code&gt; package&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Initialize the project
&lt;/h3&gt;

&lt;p&gt;Let's create an empty directory and initialize an NPM package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;fantastic
&lt;span class="nb"&gt;cd &lt;/span&gt;fantastic
npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now create the packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nt"&gt;--scope&lt;/span&gt; @fantastic &lt;span class="nt"&gt;-w&lt;/span&gt; packages/core
npm init &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nt"&gt;--scope&lt;/span&gt; @fantastic &lt;span class="nt"&gt;-w&lt;/span&gt; packages/web
npm init &lt;span class="nt"&gt;-y&lt;/span&gt; &lt;span class="nt"&gt;--scope&lt;/span&gt; @fantastic &lt;span class="nt"&gt;-w&lt;/span&gt; packages/cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Define the dependencies between the packages:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @fantastic/core &lt;span class="nt"&gt;-w&lt;/span&gt; @fantastic/web
npm &lt;span class="nb"&gt;install&lt;/span&gt; @fantastic/core &lt;span class="nt"&gt;-w&lt;/span&gt; @fantastic/cli
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Test it!
&lt;/h3&gt;

&lt;p&gt;Now that we have the foundation in place, let's add some code to test it:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;packages/core/index.js&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello from Core!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;packages/web/index.js&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@fantastic/core&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello from Web!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;packages/cli/index.js&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@fantastic/core&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello from CLI!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Running the CLI outputs the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;node packages/cli/index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello from Core!
Hello from CLI!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This confirms that the setup is working fine.&lt;/p&gt;

&lt;h3&gt;
  
  
  Here comes TypeScript
&lt;/h3&gt;

&lt;p&gt;Time to turn this project from JavaScript to TypeScript!&lt;/p&gt;

&lt;p&gt;First of all, install &lt;code&gt;typescript&lt;/code&gt; as a dev dependency in the workspace project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-D&lt;/span&gt; typescript
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Every package requires its own &lt;code&gt;tsconfig.json&lt;/code&gt; file. Since the &lt;code&gt;fantastic&lt;/code&gt; project uses the same configuration for all the three packages, create a common &lt;code&gt;tsconfig.base.json&lt;/code&gt; file in the root directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tsconfig.base.json&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"incremental"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"target"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"es2020"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"module"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"commonjs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"declaration"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"sourceMap"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"strict"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"moduleResolution"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"node"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"esModuleInterop"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"skipLibCheck"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"forceConsistentCasingInFileNames"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="nl"&gt;"composite"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is just a typical &lt;code&gt;tsconfig.json&lt;/code&gt; file, except for one compiler option: &lt;code&gt;composite&lt;/code&gt;. This option makes it possible for TypeScript to determine if a project has been built yet quickly.&lt;/p&gt;

&lt;p&gt;Now you have a common TS config file, but you aren't using it yet. Create a &lt;code&gt;tsconfig.json&lt;/code&gt; file in each package's root directory:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;packages/core/tsconfig.json&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"extends"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"../../tsconfig.base.json"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;cli&lt;/code&gt; and &lt;code&gt;web&lt;/code&gt; package is a bit different. You need to list out all your dependencies in the &lt;code&gt;references&lt;/code&gt; property:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;packages/cli/tsconfig.json&lt;/strong&gt; and &lt;strong&gt;packages/web/tsconfig.json&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"extends"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"../../tsconfig.base.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"references"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"../core"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that independent packages are setup, create the &lt;code&gt;tsconfig.json&lt;/code&gt; in the root directory:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tsconfig.json&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"files"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"references"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"packages/core"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"packages/cli"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"packages/web"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Empty &lt;code&gt;files&lt;/code&gt; array tells TypeScript to ignore all files except those in the references.&lt;/p&gt;

&lt;p&gt;Rename all your &lt;code&gt;.js&lt;/code&gt; files to &lt;code&gt;.ts&lt;/code&gt; and replace &lt;code&gt;require&lt;/code&gt; with &lt;code&gt;import&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@fantastic/core&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@fantastic/core&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You are ready to compile:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx tsc &lt;span class="nt"&gt;--build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;--build&lt;/code&gt; flag is required because the project contains multiple projects.&lt;/p&gt;

&lt;p&gt;Now that you are done with all these changes, test your app again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;node packages/cli/index.js
Hello from Core!
Hello from CLI!

&lt;span class="nv"&gt;$ &lt;/span&gt;node packages/web/index.js
Hello from Core!
Hello from Web!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Separate source code and build output
&lt;/h3&gt;

&lt;p&gt;First of all, remove all the build outputs from the previous step. The following command will delete all &lt;code&gt;.js&lt;/code&gt;, &lt;code&gt;.js.map&lt;/code&gt;, &lt;code&gt;.d.ts&lt;/code&gt; and &lt;code&gt;.tsbuildinfo&lt;/code&gt; files in the &lt;code&gt;packages&lt;/code&gt; directory.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm &lt;/span&gt;packages/&lt;span class="k"&gt;**&lt;/span&gt;/&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="k"&gt;*&lt;/span&gt;.js,&lt;span class="k"&gt;*&lt;/span&gt;.js.map,&lt;span class="k"&gt;*&lt;/span&gt;.d.ts,&lt;span class="k"&gt;*&lt;/span&gt;.tsbuildinfo&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Having your source code and build output in different directories is a good practice. Therefore, move each package's source code into an &lt;code&gt;src&lt;/code&gt; directory, and change the build output directory to &lt;code&gt;dist&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Extend your &lt;code&gt;packages/*/tsconfig.json&lt;/code&gt; files with the following snippet:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"rootDir"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"src"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"outDir"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dist"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As an example, this is how the &lt;code&gt;packages/web/tsconfig.json&lt;/code&gt; looks now:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"extends"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"../../tsconfig.base.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"rootDir"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"src"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"outDir"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"dist"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"references"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"../core"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tells TypeScript that your source code files are in the &lt;code&gt;src&lt;/code&gt; directory, and the build output should go into the &lt;code&gt;dist&lt;/code&gt; directory. These are relative to your &lt;code&gt;tsconfig.json&lt;/code&gt; file.&lt;/p&gt;

&lt;p&gt;Move your &lt;code&gt;index.ts&lt;/code&gt; files into the respective &lt;code&gt;src&lt;/code&gt; directory. At this point, you should have the following directory tree:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;├── package-lock.json
├── package.json
├── packages
│   ├── cli
│   │   ├── package.json
│   │   ├── src
│   │   │   └── index.ts
│   │   └── tsconfig.json
│   ├── core
│   │   ├── package.json
│   │   ├── src
│   │   │   └── index.ts
│   │   └── tsconfig.json
│   └── web
│       ├── package.json
│       ├── src
│       │   └── index.ts
│       └── tsconfig.json
├── tsconfig.base.json
└── tsconfig.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before building your project, adjust the &lt;code&gt;main&lt;/code&gt; property in the &lt;code&gt;package.json&lt;/code&gt; of each package. Change &lt;code&gt;index.js&lt;/code&gt; to &lt;code&gt;dist/index.js&lt;/code&gt; since that's where it lives now.&lt;/p&gt;

&lt;p&gt;Now build your project and run your CLI app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx tsc &lt;span class="nt"&gt;--build&lt;/span&gt;
node packages/cli/dist/index.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see the usual output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Hello from Core!
Hello from CLI!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  You've done it! Good Job!
&lt;/h2&gt;

&lt;p&gt;Now that you have laid the foundation for your project, go on and create something extraordinary!&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/david-szabo97/example-typescript-npm-workspaces"&gt;project's source code&lt;/a&gt; is available on GitHub. The repository contains a few little changes. Feel free to explore!&lt;/p&gt;

&lt;p&gt;If you would like to learn more about NPM workspaces and TypeScript, check out these links:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.npmjs.com/cli/v8/using-npm/workspaces"&gt;NPM Workspaces documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.typescriptlang.org/docs/handbook/project-references.html"&gt;TypeScript Project References documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;PS.&lt;/strong&gt; &lt;a href="https://nx.dev/"&gt;NX&lt;/a&gt; is an awesome tool! But sometimes, it's better to use the tools you already have at your disposal. Please take your time to decide whether to use NX or NPM / Yarn workspaces.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>npm</category>
      <category>monorepo</category>
    </item>
    <item>
      <title>My feelings about Go after spending a weekend together</title>
      <dc:creator>Dávid Szabó</dc:creator>
      <pubDate>Wed, 17 Feb 2021 17:36:16 +0000</pubDate>
      <link>https://dev.to/davidszabo97/my-feelings-about-go-after-spending-a-weekend-together-mip</link>
      <guid>https://dev.to/davidszabo97/my-feelings-about-go-after-spending-a-weekend-together-mip</guid>
      <description>&lt;blockquote class="ltag__twitter-tweet"&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--5oHYepcM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1218962166667149314/pjSuHvvu_normal.jpg" alt="David Szabo profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        David Szabo
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        @david_szabo97
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ir1kO05j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      A &lt;a href="https://twitter.com/hashtag/weekend"&gt;#weekend&lt;/a&gt; with &lt;a href="https://twitter.com/hashtag/golang"&gt;#golang&lt;/a&gt;:&lt;br&gt;- ❤️Love it!&lt;br&gt;- 😐Syntax is meh (I grew up on C, Java, JS, PHP) Switching up the order of the variable name and type is strange at first.&lt;br&gt;- 😍😍Goroutines, channels&lt;br&gt;- 🥴Passing Context everywhere&lt;br&gt;- 😍Built-in Tooling (test runner, formatting, linting)
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      08:42 AM - 16 Feb 2021
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1361596761647820802" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fFnoeFxk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-reply-action-238fe0a37991706a6880ed13941c3efd6b371e4aefe288fe8e0db85250708bc4.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1361596761647820802" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k6dcrOn8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-retweet-action-632c83532a4e7de573c5c08dbb090ee18b348b13e2793175fea914827bc42046.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/like?tweet_id=1361596761647820802" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SRQc9lOp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-like-action-1ea89f4b87c7d37465b0eb78d51fcb7fe6c03a089805d7ea014ba71365be5171.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;
TLDR;




&lt;p&gt;I had a great weekend following the &lt;a href="https://quii.gitbook.io/learn-go-with-tests/"&gt;Learn Go with Tests&lt;/a&gt; online book. I spent about 15 hours going through the whole book and fire up a few practice projects.&lt;/p&gt;

&lt;p&gt;I know it’s not a lot to come to a conclusion, but I had enough experience with other languages to find the pros and cons of the language. As we all know, the biggest and most exciting features of Go area the goroutines and channels. It’s built for concurrency and it’s so stupid simple to work with it.&lt;/p&gt;

&lt;p&gt;Go comes with its own little problems. You need to pass &lt;a href="https://faiface.github.io/post/context-should-go-away-go2/"&gt;Context&lt;/a&gt; around, down to the deepest of your call stack. At the time of this post, Go doesn’t have generics, it’s on the way though. Check out the &lt;a href="https://blog.golang.org/generics-next-step"&gt;last blog post&lt;/a&gt; about it on Golang blog for yourself. Don’t get excited about the syntax though…&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;
&lt;span class="c"&gt;// Print prints the elements of any slice.&lt;/span&gt;
&lt;span class="c"&gt;// Print has a type parameter T and has a single (non-type)&lt;/span&gt;
&lt;span class="c"&gt;// parameter s which is a slice of that type parameter.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;Print&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt;&lt;span class="p"&gt;{}](&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;T&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c"&gt;// same as above&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What’s the fuss about the syntax?
&lt;/h2&gt;

&lt;p&gt;I’m a JavaScript developer who switched from C, Java, C#, PHP languages in this particular order. If you ever worked with those languages – and I bet you did -, then you know the &lt;strong&gt;drill&lt;/strong&gt; :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
type variableName = value;

function functionName(MyType $val) {}

public static void main(String[] args) {}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You know, going left to right. Type to variable name. Then Go comes to the show and…&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;SayHelloToThePeople&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;people&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;Person&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hellos&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Left to right, then right to left. Like, what in the name of Gopher is happening here?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QFlccgfZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.kym-cdn.com/photos/images/newsfeed/001/167/690/e55.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QFlccgfZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i.kym-cdn.com/photos/images/newsfeed/001/167/690/e55.png" alt=""&gt;&lt;/a&gt;I guess you get it now&lt;/p&gt;

&lt;p&gt;Maybe the problem lies in me, I should’ve gone down the route of exotic languages rather than the mainstream ones.&lt;/p&gt;

&lt;p&gt;After all, as a full-time JS developer, I’m not sure if these two languages can live together in one &lt;em&gt;muscle&lt;/em&gt;. As you get used to writing out &lt;code&gt;type variableName&lt;/code&gt; then suddenly switching to &lt;code&gt;variableName []type&lt;/code&gt; really twitches my &lt;em&gt;muscle memories&lt;/em&gt;. Practice makes perfect though.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simplicity of Go
&lt;/h2&gt;

&lt;p&gt;Did you know Go only has 25 keywords? We got 32 in C, 54 in Java, 54 in PHP, 59 in JavaScript, and 102 in C#. That’s according to a &lt;a href="https://www.reddit.com/r/ProgrammerHumor/comments/6inj17/languages_by_number_of_keywords/"&gt;mid-2017 reddit post&lt;/a&gt;. God knows how many keywords now C# got… Anyway, I was lazy to look it up on my own so probably those numbers are off – according to my one minute Google research C# only got 79 keywords. You still get the point, right? Go has few keywords and they managed to stuff the magic of Go – concurrency – into those few keywords.&lt;/p&gt;

&lt;p&gt;Let’s talk about the included batteries, in my opinion that’s still something that belongs to the simplicity section. Go comes with all the fun stuff without any external dependencies. Let’s see what we got here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Code formatting (&lt;code&gt;gofmt&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Code linting (&lt;code&gt;golint&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;More code static checks (&lt;code&gt;go vet&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Tests (&lt;code&gt;go test&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Test coverage (&lt;code&gt;go test -cover&lt;/code&gt;, &lt;code&gt;go test -coverprofile=coverprofile.out&lt;/code&gt;, &lt;code&gt;go tool cover&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;An awesome standard library&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you are just starting with Go then you probably don’t need to do anything other than just installing Go. That’s a huge plus for me. Whenever I fire up a new JS project I need to go through setting up a linter, a formatter, a test runner, and many many dependencies (depends on the project though).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ANZJziXX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--FqSJ910J--/c_imagga_scale%2Cf_auto%2Cfl_progressive%2Ch_500%2Cq_auto%2Cw_1000/https://thepracticaldev.s3.amazonaws.com/i/9i6bs4g6cx05jeagfhum.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ANZJziXX--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://res.cloudinary.com/practicaldev/image/fetch/s--FqSJ910J--/c_imagga_scale%2Cf_auto%2Cfl_progressive%2Ch_500%2Cq_auto%2Cw_1000/https://thepracticaldev.s3.amazonaws.com/i/9i6bs4g6cx05jeagfhum.png" alt=""&gt;&lt;/a&gt;I’m sure you are familiar with this&lt;/p&gt;

&lt;p&gt;Our modern world of programming is very bloated I must say. I miss the good old days of just putting together a few PHP files and uploading them via FTP.&lt;/p&gt;

&lt;h2&gt;
  
  
  What’s next?
&lt;/h2&gt;

&lt;p&gt;Well, Go 2 is coming and I’m thrilled but scared at the same time. Hopefully Go 2 will follow what Go 1 started.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pFpOuw6j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://preview.redd.it/7t1p88ct13ez.jpg%3Fwidth%3D640%26crop%3Dsmart%26auto%3Dwebp%26s%3D275f5223e0e32f2d836a83824fb7cf62704ec2ff" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pFpOuw6j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://preview.redd.it/7t1p88ct13ez.jpg%3Fwidth%3D640%26crop%3Dsmart%26auto%3Dwebp%26s%3D275f5223e0e32f2d836a83824fb7cf62704ec2ff" alt=""&gt;&lt;/a&gt;Let’s hope this won’t happen. Source: &lt;a href="https://www.reddit.com/r/golang/comments/6rxfjo/go_2_please_dont_make_it_happen/"&gt;Reddit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’m hoping for the best regarding the future of Go. I love the current state of the language and I’ll probably continue learning it and putting together a few projects with it.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>go</category>
      <category>learning</category>
    </item>
    <item>
      <title>Index-naming-hell, what is it and how to avoid it</title>
      <dc:creator>Dávid Szabó</dc:creator>
      <pubDate>Thu, 24 Dec 2020 22:55:00 +0000</pubDate>
      <link>https://dev.to/davidszabo97/index-naming-hell-what-is-it-and-how-to-avoid-it-489b</link>
      <guid>https://dev.to/davidszabo97/index-naming-hell-what-is-it-and-how-to-avoid-it-489b</guid>
      <description>&lt;p&gt;I used to fall into the same trap…&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KMpIJqup--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/media/Epy0sFWXYAM4_FK%3Fformat%3Djpg%26name%3Dlarge" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KMpIJqup--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/media/Epy0sFWXYAM4_FK%3Fformat%3Djpg%26name%3Dlarge" alt="screenshot of Visusal Studio Code with many index.tsx files open"&gt;&lt;/a&gt;Look at all those index files&lt;/p&gt;

&lt;p&gt;This is how it looks like in the explorer&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FfwsUpkH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://daveiscoding.files.wordpress.com/2020/12/image.png%3Fw%3D1024" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FfwsUpkH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://daveiscoding.files.wordpress.com/2020/12/image.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This works great and in practice it’s easy to use. You can just do&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./components/MyComponent

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but when you are editing them in your editor it’s ugly and takes up too much space. It also wrecks quick file navigation since all your files are named… guess what – &lt;code&gt;index&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In this case it’s fine to add some redundancy. If your component is called &lt;code&gt;BirthdayItem&lt;/code&gt;, then feel free to rename all your files to &lt;code&gt;BirthdayItem&lt;/code&gt; with the proper extension then create an &lt;code&gt;index&lt;/code&gt; file that exports your component. So you don’t need to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./components/MyComponent/MyComponent

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Let’s see how it looks in action:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Daku_VGN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://daveiscoding.files.wordpress.com/2020/12/image-1.png%3Fw%3D1024" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Daku_VGN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://daveiscoding.files.wordpress.com/2020/12/image-1.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;A lot better, now you can actually see what you are editing&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XT7xvz5h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://daveiscoding.files.wordpress.com/2020/12/image-2.png%3Fw%3D1024" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XT7xvz5h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://daveiscoding.files.wordpress.com/2020/12/image-2.png%3Fw%3D1024" alt=""&gt;&lt;/a&gt;Explorer is clean as well&lt;/p&gt;

&lt;p&gt;As you can see both the open editors and explorer is a lot more readable. Quick file search also reacts better and easier to find what you are looking for.&lt;/p&gt;

&lt;p&gt;Now let’s talk about Intellisense. Whenever I type &lt;code&gt;BirthdayList&lt;/code&gt;, VS Code wants to import it from &lt;code&gt;./components/BirthdayList/BirthdayList&lt;/code&gt;. Before the restructure it imported it from the directory like this &lt;code&gt;./components/BirthdayList&lt;/code&gt;. You can clearly see that the latter is the better one. You might think about using the following code and you will get the bad result – just like me.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./BirthdayList&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How do we fix this? In my codebases I try to avoid &lt;code&gt;export default&lt;/code&gt; as much as possible. So you can either do it by importing then reexporting as default, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;BirthdayList&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./BirthdayList&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;BirthdayList&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But as I said, I’d rather avoid &lt;code&gt;export default&lt;/code&gt; at all costs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;BirthdayList&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./BirthdayList&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;BirthdayList&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way you will get awesome autocompletion and auto imports without the filename.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>node</category>
    </item>
    <item>
      <title>Monster - Frontend exercise project</title>
      <dc:creator>Dávid Szabó</dc:creator>
      <pubDate>Tue, 28 Apr 2020 22:07:26 +0000</pubDate>
      <link>https://dev.to/davidszabo97/monster-frontend-exercise-project-18de</link>
      <guid>https://dev.to/davidszabo97/monster-frontend-exercise-project-18de</guid>
      <description>&lt;p&gt;Hey everyone! Recently started my own YouTube channel in Hungarian.&lt;br&gt;
I've created a few videos about learning projects, but they are in Hungarian so I can't share it with the world. But... My dear friend translated the text to English so everyone can enjoy these exercises!&lt;/p&gt;

&lt;p&gt;English version can be found here:&lt;br&gt;
&lt;a href="https://github.com/david-szabo97/dv-mini-project-monsters/blob/master/README.en.md"&gt;https://github.com/david-szabo97/dv-mini-project-monsters/blob/master/README.en.md&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All the files you need to complete the project are in the repository.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DsmAoZA5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tulk8abc77rh26er415d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DsmAoZA5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tulk8abc77rh26er415d.png" alt="Wireframe"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>project</category>
      <category>learning</category>
      <category>exercise</category>
    </item>
    <item>
      <title>(How) Do you improve your creativity/designer skills?</title>
      <dc:creator>Dávid Szabó</dc:creator>
      <pubDate>Sat, 19 Jan 2019 19:20:11 +0000</pubDate>
      <link>https://dev.to/davidszabo97/how-do-you-improve-your-creativitydesigner-skills-2ilc</link>
      <guid>https://dev.to/davidszabo97/how-do-you-improve-your-creativitydesigner-skills-2ilc</guid>
      <description>&lt;p&gt;Hey dev.to-ers!&lt;/p&gt;

&lt;p&gt;I was wondering how other people overcome creativity problems as being a programmer.&lt;/p&gt;

&lt;p&gt;I have a few sideprojects and I have no idea how to start creating a logo or user interface for them.&lt;/p&gt;

&lt;p&gt;Recently I have been playing around in adobe illustator, putting together a few logos and web designs.... and I LOVE DOING IT!&lt;/p&gt;

&lt;p&gt;What's a proper way to get into the graphic/design world as programmer?&lt;br&gt;
Does it worth it?&lt;br&gt;
How do you get graphics for your hobby projects?&lt;/p&gt;

</description>
      <category>design</category>
    </item>
    <item>
      <title>Open Checklist - React (Preact)</title>
      <dc:creator>Dávid Szabó</dc:creator>
      <pubDate>Sat, 25 Aug 2018 20:19:34 +0000</pubDate>
      <link>https://dev.to/davidszabo97/open-checklist---react-preact-4ohl</link>
      <guid>https://dev.to/davidszabo97/open-checklist---react-preact-4ohl</guid>
      <description>&lt;p&gt;Hi guys,&lt;/p&gt;

&lt;p&gt;It's late here and I'm lazy to write anything here.&lt;/p&gt;

&lt;p&gt;I just pushed my new open source project live and I just finished making it compatible on mobile. It is meant to be used on desktop so I didn't have mobile in mind. So the UX on mobile is crap.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You can create new sections by typing ":" at the end of the task's name. For example "Goals:" will create a new section as seen on the image below.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I'm open to any suggestions, feel free to post issues on &lt;a href="https://github.com/david-szabo97/open-checklist"&gt;Github&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Link to web app: &lt;a href="https://checklist.messedcode.com"&gt;https://checklist.messedcode.com&lt;/a&gt;
&lt;/h3&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--i3JOwpme--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/github-logo-ba8488d21cd8ee1fee097b8410db9deaa41d0ca30b004c0c63de0a479114156f.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/david-szabo97"&gt;
        david-szabo97
      &lt;/a&gt; / &lt;a href="https://github.com/david-szabo97/open-checklist"&gt;
        open-checklist
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      Simple checklist (todo list) built upon Preact + Redux
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Open Checklist&lt;/h1&gt;
&lt;h2&gt;
CLI Commands&lt;/h2&gt;
&lt;div class="highlight highlight-source-shell js-code-highlight"&gt;
&lt;pre&gt;&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; install dependencies&lt;/span&gt;
npm install

&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; serve with hot reload at localhost:8080&lt;/span&gt;
npm run dev

&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; build for production with minification&lt;/span&gt;
npm run build

&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; test the production build locally&lt;/span&gt;
npm run serve

&lt;span class="pl-c"&gt;&lt;span class="pl-c"&gt;#&lt;/span&gt; run tests with jest and preact-render-spy&lt;/span&gt;
npm run &lt;span class="pl-c1"&gt;test&lt;/span&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;For detailed explanation on how things work, checkout the &lt;a href="https://github.com/developit/preact-cli/blob/master/README.md"&gt;CLI Readme&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/david-szabo97/open-checklist"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PGKTzwbb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/r3b2ha6kb7jtl5yxkvzj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PGKTzwbb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/r3b2ha6kb7jtl5yxkvzj.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>showdev</category>
      <category>opensource</category>
      <category>github</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Checklist - Animation showoff</title>
      <dc:creator>Dávid Szabó</dc:creator>
      <pubDate>Sat, 04 Aug 2018 18:31:11 +0000</pubDate>
      <link>https://dev.to/davidszabo97/checklist---animation-showoff-1dll</link>
      <guid>https://dev.to/davidszabo97/checklist---animation-showoff-1dll</guid>
      <description>&lt;p&gt;Soon I'll release this web app on GitHub! But first, a quick question to everyone:&lt;/p&gt;

&lt;p&gt;Do you like the animation? :)&lt;br&gt;
Imagine you are using this web app to create a to-do list or checklist. Would the animation annoy you or you like it?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fuluuueb79p8drb8iti17.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fuluuueb79p8drb8iti17.gif" alt="Text"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>showdev</category>
      <category>preact</category>
      <category>opensource</category>
    </item>
    <item>
      <title>Soon releasing a new open source project: Checklist</title>
      <dc:creator>Dávid Szabó</dc:creator>
      <pubDate>Wed, 01 Aug 2018 13:28:26 +0000</pubDate>
      <link>https://dev.to/davidszabo97/soon-releasing-a-new-open-source-project-checklist-5a5f</link>
      <guid>https://dev.to/davidszabo97/soon-releasing-a-new-open-source-project-checklist-5a5f</guid>
      <description>&lt;blockquote class="ltag__twitter-tweet"&gt;
      &lt;div class="ltag__twitter-tweet__media ltag__twitter-tweet__media__video-wrapper"&gt;
        &lt;div class="ltag__twitter-tweet__media--video-preview"&gt;
          &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8doAsxZP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/ext_tw_video_thumb/1024646701309673473/pu/img/TGNeNVHB-MDUE-oR.jpg" alt="unknown tweet media content"&gt;
          &lt;img src="/assets/play-butt.svg" class="ltag__twitter-tweet__play-butt" alt="Play butt"&gt;
        &lt;/div&gt;
        &lt;div class="ltag__twitter-tweet__video"&gt;
          
            
          
        &lt;/div&gt;
      &lt;/div&gt;

  &lt;div class="ltag__twitter-tweet__main"&gt;
    &lt;div class="ltag__twitter-tweet__header"&gt;
      &lt;img class="ltag__twitter-tweet__profile-image" src="https://res.cloudinary.com/practicaldev/image/fetch/s--ViGEiU_F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/870269880506994688/59YX_pnC_normal.jpg" alt="David Szabo profile image"&gt;
      &lt;div class="ltag__twitter-tweet__full-name"&gt;
        David Szabo
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__username"&gt;
        @messedcode_dave
      &lt;/div&gt;
      &lt;div class="ltag__twitter-tweet__twitter-logo"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ir1kO05j--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-f95605061196010f91e64806688390eb1a4dbc9e913682e043eb8b1e06ca484f.svg" alt="twitter logo"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__body"&gt;
      &lt;a href="https://twitter.com/_developit"&gt;@_developit&lt;/a&gt; You know why I love Preact? Because it's compatible with React. And do you know why I love React? Because it has HUNDREDS of open source libs I can leverage and build things crazy fast. Soon releasing as an open source project ;) 
    &lt;/div&gt;
    &lt;div class="ltag__twitter-tweet__date"&gt;
      13:25 PM - 01 Aug 2018
    &lt;/div&gt;


    &lt;div class="ltag__twitter-tweet__actions"&gt;
      &lt;a href="https://twitter.com/intent/tweet?in_reply_to=1024647351527464960" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fFnoeFxk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-reply-action-238fe0a37991706a6880ed13941c3efd6b371e4aefe288fe8e0db85250708bc4.svg" alt="Twitter reply action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/retweet?tweet_id=1024647351527464960" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k6dcrOn8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-retweet-action-632c83532a4e7de573c5c08dbb090ee18b348b13e2793175fea914827bc42046.svg" alt="Twitter retweet action"&gt;
      &lt;/a&gt;
      &lt;a href="https://twitter.com/intent/like?tweet_id=1024647351527464960" class="ltag__twitter-tweet__actions__button"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SRQc9lOp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev.to/assets/twitter-like-action-1ea89f4b87c7d37465b0eb78d51fcb7fe6c03a089805d7ea014ba71365be5171.svg" alt="Twitter like action"&gt;
      &lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/blockquote&gt;


&lt;p&gt;Keep tuned. Feel free to criticise :)&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>showdev</category>
    </item>
    <item>
      <title>REST API - Yet Another UI</title>
      <dc:creator>Dávid Szabó</dc:creator>
      <pubDate>Mon, 09 Jul 2018 09:01:13 +0000</pubDate>
      <link>https://dev.to/davidszabo97/rest-api---yet-another-ui-9l2</link>
      <guid>https://dev.to/davidszabo97/rest-api---yet-another-ui-9l2</guid>
      <description>&lt;p&gt;I'm working on my new product and it's my task to develop the backend.&lt;br&gt;
It's not a complicated tech stack, we are going only with a few pieces for an MVP:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MongoDB &amp;lt;-&amp;gt; Node.js &amp;lt;-&amp;gt; React Native (Android &amp;amp; iOS)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's been a while since I've worked on a not small project. I'm trying to decouple the Service Layer from the "Web Service (Layer)" (REST API), and I just realized something: &lt;/p&gt;

&lt;h1&gt;
  
  
  &lt;strong&gt;REST API is just a UI&lt;/strong&gt;
&lt;/h1&gt;

&lt;p&gt;This might be a bit silly or bold statement, but if you think about it then it makes sense in my opinion. When I realized that, the tech stack changed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MongoDB &amp;lt;-&amp;gt; Core (Node.js) &amp;lt;-&amp;gt; REST API (Node.js) &amp;lt;-&amp;gt; React Native (Android &amp;amp; iOS)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All of these pieces are decoupled. &lt;br&gt;
I might be stupid, but this is a serious realization for me.&lt;/p&gt;




&lt;p&gt;I just wanted to share this with you guys and would like to hear what you think.&lt;br&gt;
We never stop learning and hopefully you will write something that will make me realize something very important.&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Github Guesser - A Starry Game - 2 weeks of data</title>
      <dc:creator>Dávid Szabó</dc:creator>
      <pubDate>Thu, 21 Jun 2018 21:09:29 +0000</pubDate>
      <link>https://dev.to/davidszabo97/github-guesser---a-starry-game---2-weeks-of-data-35c1</link>
      <guid>https://dev.to/davidszabo97/github-guesser---a-starry-game---2-weeks-of-data-35c1</guid>
      <description>&lt;p&gt;Hey devs!&lt;/p&gt;

&lt;p&gt;In my last post, I promised that I will come back with some stats about my simple game: &lt;strong&gt;Github Guesser&lt;/strong&gt;.&lt;br&gt;
I wanted to wait until we reach 20k plays, but seems like the game is losing interest so I would rather not wait until that! (We are at 19k by the way)&lt;/p&gt;

&lt;p&gt;All of the stats I am showing you here are from&lt;br&gt;
&lt;strong&gt;7 Jun 2018 - 21 Jun 2018&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I have posted about Github Guesser on 3 different platforms: Twitter, Reddit and dev.to. Github Guesser is also available on GitHub so that also drove some traffic to the site. I have one post on Reddit and about 11 tweets on Twitter and one tweet which mentions it by the creator of Preact: Jason Miller (&lt;a class="mentioned-user" href="https://dev.to/_developit"&gt;@_developit&lt;/a&gt;
) (Thanks a lot!). Lastly, I have two posts about it on dev.to. (This will be the third)&lt;/p&gt;




&lt;h1&gt;
  
  
  Total visitors: 1182, 41 stars on GitHub
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Top 10 countries - most guesses
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The game has been played from 85 different countries!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is the top 10, sorted by guesses&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Country&lt;/th&gt;
&lt;th&gt;Starts&lt;/th&gt;
&lt;th&gt;Guesses&lt;/th&gt;
&lt;th&gt;Corrects&lt;/th&gt;
&lt;th&gt;Wrongs&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;United States&lt;/td&gt;
&lt;td&gt;218&lt;/td&gt;
&lt;td&gt;2417&lt;/td&gt;
&lt;td&gt;1557&lt;/td&gt;
&lt;td&gt;860&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Brazil&lt;/td&gt;
&lt;td&gt;104&lt;/td&gt;
&lt;td&gt;1603&lt;/td&gt;
&lt;td&gt;1047&lt;/td&gt;
&lt;td&gt;556&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;France&lt;/td&gt;
&lt;td&gt;118&lt;/td&gt;
&lt;td&gt;1512&lt;/td&gt;
&lt;td&gt;943&lt;/td&gt;
&lt;td&gt;569&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Germany&lt;/td&gt;
&lt;td&gt;95&lt;/td&gt;
&lt;td&gt;1343&lt;/td&gt;
&lt;td&gt;845&lt;/td&gt;
&lt;td&gt;498&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;United Kingdom&lt;/td&gt;
&lt;td&gt;90&lt;/td&gt;
&lt;td&gt;1127&lt;/td&gt;
&lt;td&gt;703&lt;/td&gt;
&lt;td&gt;424&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;India&lt;/td&gt;
&lt;td&gt;63&lt;/td&gt;
&lt;td&gt;922&lt;/td&gt;
&lt;td&gt;584&lt;/td&gt;
&lt;td&gt;338&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Spain&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;td&gt;622&lt;/td&gt;
&lt;td&gt;394&lt;/td&gt;
&lt;td&gt;228&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sweden&lt;/td&gt;
&lt;td&gt;37&lt;/td&gt;
&lt;td&gt;460&lt;/td&gt;
&lt;td&gt;304&lt;/td&gt;
&lt;td&gt;156&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Finland&lt;/td&gt;
&lt;td&gt;47&lt;/td&gt;
&lt;td&gt;428&lt;/td&gt;
&lt;td&gt;270&lt;/td&gt;
&lt;td&gt;158&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Denmark&lt;/td&gt;
&lt;td&gt;15&lt;/td&gt;
&lt;td&gt;424&lt;/td&gt;
&lt;td&gt;292&lt;/td&gt;
&lt;td&gt;132&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Top 3 browsers (93.32% of total visitors)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Browser&lt;/th&gt;
&lt;th&gt;Visitors&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Chrome&lt;/td&gt;
&lt;td&gt;843&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Safari&lt;/td&gt;
&lt;td&gt;183&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Firefox&lt;/td&gt;
&lt;td&gt;76&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Top 5 operating systems (99.5% of total visitors)
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operating System&lt;/th&gt;
&lt;th&gt;Visitors&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Macintosh&lt;/td&gt;
&lt;td&gt;380&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Android&lt;/td&gt;
&lt;td&gt;283&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Windows&lt;/td&gt;
&lt;td&gt;219&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;iOS&lt;/td&gt;
&lt;td&gt;170&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Linux&lt;/td&gt;
&lt;td&gt;124&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Devices
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Device&lt;/th&gt;
&lt;th&gt;Visitors&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Desktop&lt;/td&gt;
&lt;td&gt;729&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Mobile&lt;/td&gt;
&lt;td&gt;403&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Tablet&lt;/td&gt;
&lt;td&gt;50&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Main sources of visitors
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Source&lt;/th&gt;
&lt;th&gt;Visitors&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Direct&lt;/td&gt;
&lt;td&gt;442&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Twitter&lt;/td&gt;
&lt;td&gt;341&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;dev.to&lt;/td&gt;
&lt;td&gt;290&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GitHub&lt;/td&gt;
&lt;td&gt;95&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reddit&lt;/td&gt;
&lt;td&gt;19&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;p&gt;It's a really simple game: You need to guess which GitHub repository has more stars, based on the given information! Just click / touch the one you think is more popular and in a moment you will know whether you won or lost!&lt;/p&gt;

&lt;p&gt;You can find the game here: &lt;a href="https://githubguesser.messedcode.com/?utm_source=devto"&gt;&lt;strong&gt;Github Guesser&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
(plain link if you prefer that: &lt;a href="https://githubguesser.messedcode.com/"&gt;https://githubguesser.messedcode.com/&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;You can find the source code here:&lt;br&gt;
&lt;a href="https://github.com/david-szabo97/github-guesser"&gt;https://github.com/david-szabo97/github-guesser&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;PS&lt;/strong&gt; Have you met &lt;a href="https://dev.to/davidszabo97/static---a-simple-fun-website-1f0p"&gt;&lt;strong&gt;&lt;em&gt;Static&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; yet? &lt;br&gt;
&lt;strong&gt;PPS&lt;/strong&gt; You can find my blog at &lt;a href="https://messedcode.com"&gt;https://messedcode.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>preact</category>
      <category>showdev</category>
      <category>github</category>
    </item>
    <item>
      <title>Github Guesser - A Starry Game - Release #2</title>
      <dc:creator>Dávid Szabó</dc:creator>
      <pubDate>Fri, 08 Jun 2018 15:20:32 +0000</pubDate>
      <link>https://dev.to/davidszabo97/github-guesser---a-starry-game---release-2-20g3</link>
      <guid>https://dev.to/davidszabo97/github-guesser---a-starry-game---release-2-20g3</guid>
      <description>&lt;p&gt;Hey devs!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I am happy to announce that I've released the second version of my new pet project.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;AND &lt;strong&gt;THE SOURCE CODE IS AVAILABLE&lt;/strong&gt;, feel free to criticism my crap code and make this project better together!!!!! Love you guys, I am coming back with some stats soon!!!&lt;/p&gt;




&lt;p&gt;It's a really simple game: You need to guess which GitHub repository has more stars, based on the given information! Just click / touch the one you think is more popular and in a moment you will know whether you won or lost!&lt;/p&gt;

&lt;p&gt;You can find the game here: &lt;a href="https://githubguesser.messedcode.com/?utm_source=devto"&gt;&lt;strong&gt;Github Guesser&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
(plain link if you prefer that: &lt;a href="https://githubguesser.messedcode.com/"&gt;https://githubguesser.messedcode.com/&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;You can find the source code here:&lt;br&gt;
&lt;a href="https://github.com/david-szabo97/github-guesser"&gt;https://github.com/david-szabo97/github-guesser&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;I am planning a few features to be released in the next few weeks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login using Github so you can track your stats&lt;/li&gt;
&lt;li&gt;Backend: Uploading stats&lt;/li&gt;
&lt;li&gt;Backend: Pull repositories&lt;/li&gt;
&lt;li&gt;Frontend: Show how many people won or lost the combination you just finished&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GOT ANY IDEAS? Share it!!!!&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;PS&lt;/strong&gt; Have you met &lt;a href="https://dev.to/davidszabo97/static---a-simple-fun-website-1f0p"&gt;&lt;strong&gt;&lt;em&gt;Static&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; yet? &lt;br&gt;
&lt;strong&gt;PPS&lt;/strong&gt; You can find my blog at &lt;a href="https://messedcode.com"&gt;https://messedcode.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>preact</category>
      <category>showdev</category>
      <category>github</category>
    </item>
    <item>
      <title>Github Guesser - A Starry Game</title>
      <dc:creator>Dávid Szabó</dc:creator>
      <pubDate>Thu, 07 Jun 2018 07:45:33 +0000</pubDate>
      <link>https://dev.to/davidszabo97/github-guesser---a-starry-game-bp6</link>
      <guid>https://dev.to/davidszabo97/github-guesser---a-starry-game-bp6</guid>
      <description>&lt;p&gt;&lt;strong&gt;UPDATE&lt;/strong&gt; Release #2 is OUT!&lt;br&gt;
&lt;a href="https://dev.to/davidszabo97/github-guesser---a-starry-game---release-2-20g3"&gt;https://dev.to/davidszabo97/github-guesser---a-starry-game---release-2-20g3&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Hey devs!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I am happy to announce that I am releasing the very first version of my new pet project.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's a really simple game: You need to guess which GitHub repository has more stars, based on the given information! Just click / touch the one you think is more popular and in a moment you will know whether you won or lost!&lt;/p&gt;

&lt;p&gt;You can find the game here: &lt;a href="https://githubguesser.messedcode.com/?utm_source=devto"&gt;&lt;strong&gt;Github Guesser&lt;/strong&gt;&lt;/a&gt;&lt;br&gt;
(plain link if you prefer that: &lt;a href="https://githubguesser.messedcode.com/"&gt;https://githubguesser.messedcode.com/&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Soon I will release the source code too on GitHub.&lt;br&gt;
The repository is already initialize if you are interested in watching or starring it: &lt;a href="https://github.com/david-szabo97/github-guesser"&gt;https://github.com/david-szabo97/github-guesser&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;I am planning a few features to be released in the next few weeks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Login using Github so you can track your stats&lt;/li&gt;
&lt;li&gt;Backend: Uploading stats&lt;/li&gt;
&lt;li&gt;Backend: Pull repositories&lt;/li&gt;
&lt;li&gt;Frontend: Show how many people won or lost the combination you just finished&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GOT ANY IDEAS? Share it!!!!&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;PS&lt;/strong&gt; Have you met &lt;a href="https://dev.to/davidszabo97/static---a-simple-fun-website-1f0p"&gt;&lt;strong&gt;&lt;em&gt;Static&lt;/em&gt;&lt;/strong&gt;&lt;/a&gt; yet? &lt;br&gt;
&lt;strong&gt;PPS&lt;/strong&gt; You can find my blog at &lt;a href="https://messedcode.com"&gt;https://messedcode.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>game</category>
      <category>preact</category>
      <category>react</category>
      <category>github</category>
    </item>
  </channel>
</rss>
