<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="190080" data-post-id="190080">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dopatraman" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dopatraman/120/18188_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dopatraman
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Agreed, but in theory descriptive naming would actually help collaborators find things easier.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="190080" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/renaming-the-root-folder-from-lib-to-app-is-this-a-bad-convention/34436/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-190080" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="190080"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="190120" data-post-id="190120">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cnck1387" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cnck1387
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="cmkarlsson" data-post="9" data-topic="34436">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cmkarlsson/48/23000_2.png" class="avatar"> cmkarlsson:</div>
<blockquote>
<p>I would be interested in what framework, languages you are comparing with as non of the other I work with does things differently than elixir.</p>
</blockquote>
</aside>
<p>With Rails, you have <code>app/</code> and <code>lib/</code> living at the same directory depth. Your app’s code goes in app and your generic library code goes in lib.</p>
<p>With Flask, there’s no conventions or special behavior around a <code>lib/</code> directory so you can do anything you want. I usually roll with a <code>hello/</code>, <code>lib/</code> approach where both dirs are living at the same depth. It gives a similar separation as Rails and in Python it’s a convention to name your app’s folder the name of your project, which is why I didn’t pick “app” for it.</p>
<p>In this Elixir case, app vs lib as a name isn’t my main concern. It’s not having a clean and well defined area to put library / generic code. Your first “how about” example seems reasonable but it feels like we have to force a 2nd name to describe what a library is without using <code>lib/</code>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="190120" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/renaming-the-root-folder-from-lib-to-app-is-this-a-bad-convention/34436/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-190120" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="190120"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="190124" data-post-id="190124">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="LostKobrakai" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/LostKobrakai/120/3072_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  LostKobrakai
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="cnck1387" data-post="13" data-topic="34436">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/c/2bfe46/48.png" class="avatar"> cnck1387:</div>
<blockquote>
<p>It’s not having a clean and well defined area to put library / generic code.</p>
</blockquote>
</aside>
<p>The clean way imo is not having library code in your application, but like third party libraries in dependencies. Sadly this is often neglected (by myself as well) for the overhead it generates. Also there’s nothing stopping you from separating code within <code>lib/</code>. Just like phoenix does <code>myapp</code> and <code>myapp_web</code> you can have <code>myapp_lib</code> or whatever. In one of my projects I have <code>myapp_auxiliary</code>, which holds all the domain unrelated stuff integrating with dependencies I have (potentially even temporarily).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="190124" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/renaming-the-root-folder-from-lib-to-app-is-this-a-bad-convention/34436/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-190124" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="190124"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="190128" data-post-id="190128">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="cnck1387" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  cnck1387
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="LostKobrakai" data-post="14" data-topic="34436">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/48/3072_2.png" class="avatar"> LostKobrakai:</div>
<blockquote>
<p>Sadly this is often neglected (by myself as well) for the overhead it generates.</p>
</blockquote>
</aside>
<p>Yeah because in practice that library code usually follows the path of being inlined somewhere, then pulled out into a generic function or module and then maybe if deemed useful over time extracted out into a third party library that may or may not be open sourced.</p>
<p>If you skip the middle step, as you mentioned, it adds a massive burden to your development work flow and it could also lead to premature abstraction and poor library design choices. It’s why you can’t often “invent” a good library. It needs to be extracted from a real world project, and the pipeline to get there is critically important.</p>
<aside class="quote no-group" data-username="LostKobrakai" data-post="14" data-topic="34436">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/48/3072_2.png" class="avatar"> LostKobrakai:</div>
<blockquote>
<p>Just like phoenix does <code>myapp</code> and <code>myapp_web</code> you can have <code>myapp_lib</code></p>
</blockquote>
</aside>
<p>Do you namespace those lib modules as <code>MyAppLib.CountryCodes</code> or <code>CountryCodes</code>?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="190128" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/renaming-the-root-folder-from-lib-to-app-is-this-a-bad-convention/34436/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-190128" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="190128"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="190132" data-post-id="190132">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="LostKobrakai" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/LostKobrakai/120/3072_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  LostKobrakai
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="cnck1387" data-post="15" data-topic="34436">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/c/2bfe46/48.png" class="avatar"> cnck1387:</div>
<blockquote>
<p>Do you namespace those lib modules as <code>MyAppLib.CountryCodes</code> or <code>CountryCodes</code> ?</p>
</blockquote>
</aside>
<p>The first one, mostly for preventing the slim possibility of collision with proper dependencies.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="190132" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/renaming-the-root-folder-from-lib-to-app-is-this-a-bad-convention/34436/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-190132" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="190132"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="190157" data-post-id="190157">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="josevalim" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/120/1787_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  josevalim
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Elixir</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Previously Phoenix did put things in the “app” directory and many complained that “Phoenix was leading people away from Elixir conventions” or that “building a Phoenix application should not be different than any other Elixir codebase”.</p>
<p>It is one of the discussions that could go in loops forever, especially as it is an easy topic to get sidetracked with. So my recommendation would be to stick with the current conventions. If you really want to change it, do it in your mix.exs.</p>
<p>Once you choose a directory, you can do whatever structure you want inside that directory. It doesn’t have to be only <code>my_app</code> and <code>my_app_web</code>, feel free to create directories for other needs. I personally go with similar approach to <a class="mention" href="/u/lostkobrakai" rel="nofollow">@LostKobrakai</a> (my_app, my_app_lib, my_app_web, etc).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="190157" data-batch-url="/posts/batch_likers">
                        9
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/renaming-the-root-folder-from-lib-to-app-is-this-a-bad-convention/34436/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-190157" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="190157"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="190169" data-post-id="190169">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="lawik" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lawik/120/32028_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  lawik
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Nerves Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I don’t care if the folder is named lib or app. It could be named “stuff” honestly, but that would have more people dissatisfied. What I do care about is that there is a strong convention that is consistently used. When I pick up a project I can immediately find my way. The lib name is probably not perfect but it absolutely works well in my book.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="190169" data-batch-url="/posts/batch_likers">
                        7
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/renaming-the-root-folder-from-lib-to-app-is-this-a-bad-convention/34436/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-190169" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="190169"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>