<?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: Brito He4rt</title>
    <description>The latest articles on DEV Community by Brito He4rt (@brito).</description>
    <link>https://dev.to/brito</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%2F359079%2Fff7a99af-feb8-4b48-ae05-6da0b3c5f3c4.jpg</url>
      <title>DEV Community: Brito He4rt</title>
      <link>https://dev.to/brito</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/brito"/>
    <language>en</language>
    <item>
      <title>Create node-react-docker apps easily</title>
      <dc:creator>Brito He4rt</dc:creator>
      <pubDate>Fri, 03 Jul 2020 19:27:02 +0000</pubDate>
      <link>https://dev.to/brito/create-node-react-docker-apps-easily-5b4a</link>
      <guid>https://dev.to/brito/create-node-react-docker-apps-easily-5b4a</guid>
      <description>&lt;p&gt;Every time that we start a new project, even to play around with new technologies in express/node/react. We need to configure a bunch of things, and that can be a little boring.&lt;/p&gt;

&lt;p&gt;That's why I've created &lt;a href="https://www.npmjs.com/package/create-nrd-app"&gt;create-nrd-app&lt;/a&gt;. This package is a way to generate a clean and configured project with Node/Typescript in backend, React in frontend (with &lt;a href="https://www.npmjs.com/package/create-react-app"&gt;create-react-app&lt;/a&gt;) and Docker containers (with development and production mode)&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Overview
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-nrd-app my-app
&lt;span class="nb"&gt;cd &lt;/span&gt;my-app
docker-compose &lt;span class="nt"&gt;-f&lt;/span&gt; docker-compose.yml up &lt;span class="nt"&gt;--build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;(&lt;a href="https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b"&gt;npx&lt;/a&gt; comes with npm 5.2+ and higher)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then open:&lt;br&gt;
&lt;a href="http://localhost:3000/"&gt;http://localhost:3000/&lt;/a&gt; to see your app.&lt;br&gt;
&lt;a href="http://localhost:3001/"&gt;http://localhost:3001/&lt;/a&gt; to see your server.&lt;/p&gt;
&lt;h3&gt;
  
  
  Get Started Immediately
&lt;/h3&gt;

&lt;p&gt;You &lt;strong&gt;don’t&lt;/strong&gt; need to install or configure tools like Webpack or Babel.&lt;br&gt;
They are preconfigured and hidden so that you can focus on the code.&lt;/p&gt;

&lt;p&gt;Just create a project, and you’re good to go.&lt;/p&gt;
&lt;h2&gt;
  
  
  Creating an App
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;You’ll need to have Node 8.16.0 or Node 10.16.0 or later version on your local development machine&lt;/strong&gt; (but it’s not required on the server). You can use &lt;a href="https://github.com/creationix/nvm#installation"&gt;nvm&lt;/a&gt; (macOS/Linux) to easily switch Node versions between different projects.&lt;/p&gt;

&lt;p&gt;To create a new app, you may choose one of the following methods:&lt;/p&gt;
&lt;h3&gt;
  
  
  npx
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx create-nrd-app my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;em&gt;(&lt;a href="https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b"&gt;npx&lt;/a&gt; is a package runner tool that comes with npm 5.2+ and higher)&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  npm
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm init nrd-app my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;em&gt;&lt;code&gt;npm init &amp;lt;initializer&amp;gt;&lt;/code&gt; is available in npm 6+&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Yarn
&lt;/h3&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn create nrd-app my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;em&gt;&lt;code&gt;yarn create&lt;/code&gt; is available in Yarn 0.25+&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It will create a directory called &lt;code&gt;my-app&lt;/code&gt; inside the current folder.&lt;br&gt;
Inside that directory, it will generate the initial project structure and install the transitive dependencies:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;my-app
├── docker-compose.dev.yml
├── docker-compose.yml
├── package.json
├── server
│   ├── .gitignore
│   ├── .dockerignore
│   ├── .prettierrc
│   ├── .eslintrc.json
│   ├── node_modules
│   ├── package.json
│   ├── tsconfig.json
│   ├── dev.Dockerfile
│   ├── Dockerfile
│   ├── server.ts
└── client
    ├── conf
    │   └── conf.d
    │      └── default.conf
    ├── README.md
    ├── node_modules
    ├── package.json
    ├── .gitignore
    ├── .dockerignore
    ├── dev.Dockerfile
    ├── Dockerfile
    ├── public
    │   ├── favicon.ico
    │   ├── index.html
    │   └── manifest.json
    └── src
        ├── App.css
        ├── App.js
        ├── App.test.js
        ├── index.css
        ├── index.js
        ├── logo.svg
        └── serviceWorker.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the installation is done, you can open your project folder:&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;cd &lt;/span&gt;my-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside the newly created project, you can run some built-in commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker-compose &lt;span class="nt"&gt;-f&lt;/span&gt; docker-compose.dev.yml up &lt;span class="nt"&gt;--build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Runs the app in development mode.&lt;br&gt;
Open &lt;a href="http://localhost:3000"&gt;http://localhost:3000&lt;/a&gt; to view your app in the browser.&lt;br&gt;
Open &lt;a href="http://localhost:3001"&gt;http://localhost:3001&lt;/a&gt; to view your server in the browser.&lt;/p&gt;

&lt;p&gt;The page will automatically reload if you make changes to the code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker-compose &lt;span class="nt"&gt;-f&lt;/span&gt; docker-compose.yml up &lt;span class="nt"&gt;--build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Runs the app in production mode.&lt;br&gt;
Open &lt;a href="http://localhost:3000"&gt;http://localhost:3000&lt;/a&gt; to view your app in the browser.&lt;br&gt;
Open &lt;a href="http://localhost:3001"&gt;http://localhost:3001&lt;/a&gt; to view your server in the browser.&lt;/p&gt;

&lt;p&gt;Thanks for reading, I'll love to see if you liked it :D&lt;/p&gt;

</description>
      <category>react</category>
      <category>node</category>
      <category>docker</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
