<?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>Forem: Akash</title>
    <description>The latest articles on Forem by Akash (@akashdsamantra).</description>
    <link>https://forem.com/akashdsamantra</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%2F365377%2F66f7d7e5-cd55-430e-a677-5f833eb62aec.jpg</url>
      <title>Forem: Akash</title>
      <link>https://forem.com/akashdsamantra</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/akashdsamantra"/>
    <language>en</language>
    <item>
      <title>Project folder structure</title>
      <dc:creator>Akash</dc:creator>
      <pubDate>Mon, 19 Oct 2020 01:33:00 +0000</pubDate>
      <link>https://forem.com/akashdsamantra/project-folder-structure-4pnb</link>
      <guid>https://forem.com/akashdsamantra/project-folder-structure-4pnb</guid>
      <description>&lt;p&gt;There are so many ways to create a project folder structure.&lt;br&gt;
You can find many examples of it with a quick search. Different structures solve different use cases. One that seems best to me may not seem adequate to someone else. But at the end of the day, the best folder structure is the one which suits your team’s use-case.&lt;/p&gt;

&lt;p&gt;I am going to share the folder structure which we use in our organisation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- dist
- node_modules
- src
    - assets
    - js
      - app
        - App.jsx
      - modules
      - index.js
    - styles
    - index.html
- webpack
- package.json
- package-lock.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;dist&lt;/code&gt; is the location where final production-build code is present. Files under it should not be changed under any circumstances. This folder along with its content is automatically generated by webpack (or some other bundler you are using). This folder is also included the &lt;code&gt;.gitignore&lt;/code&gt; so that no one commits this folder to git.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;node_modules&lt;/code&gt; is the directory where all kinds of dependency packages are being stored.  Whenever you run &lt;code&gt;npm install&lt;/code&gt; , npm creates this folder. Same as &lt;code&gt;diet&lt;/code&gt; there is no need to change the content of any file in this directory.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;package.json&lt;/code&gt; contains information regarding our project and all the packages used in out project.&lt;/li&gt;
&lt;li&gt;Whenever we do &lt;code&gt;npm install&lt;/code&gt;, npm searches for &lt;code&gt;package-lock.json&lt;/code&gt; (yarn.lock if you are using yarn) to install the dependencies. This file contains a json of all dependencies. This also contains all dependencies for the packages being used in the project. Ex. Suppose we are using a package called A. A may contain B and C as it’s dependencies. &lt;code&gt;package- lock.json&lt;/code&gt; has all the information regarding packages and its corresponding dependencies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Coming to the main part, all logics (or codes) are written in &lt;code&gt;src&lt;/code&gt; folder.  It contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;assets&lt;/li&gt;
&lt;li&gt;js&lt;/li&gt;
&lt;li&gt;styles&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;As the names imply, &lt;code&gt;assets&lt;/code&gt; and &lt;code&gt;styles&lt;/code&gt;  contains images and css files respectively. The files may vary according to what you are going to use in the project. &lt;code&gt;styles&lt;/code&gt; can contain css/scss/sass or combination of those. Same goes for assets.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;js&lt;/code&gt; directory is further divided into &lt;code&gt;app&lt;/code&gt; and &lt;code&gt;modules&lt;/code&gt; .&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;code&gt;app&lt;/code&gt; directory contains all common components, constants, app context or services.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- app
    - components
    - constants
    - context
    - routes
    - services
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Same folder structure is followed for each module. Each module can have its own context i.e. Any component has access to app level context and its module level context.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>react</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
