question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What folders do we recommend packages go in?

See original GitHub issue

Minor decision we should have an opinion on. Start of a conversation around folder structure.

My base assumption for the package-containing folder every monorepo will have:

  • /packages - has packages designed to be consumed by other packages

Some other folders that make sense to me:

  • /apps - has node apps designed to be deployed
  • /websites - has websites designed to be deployed

Other option maybe?

  • /tools or /build - has node or bash or other scripts designed to be run in the repository, but not consumed by other packages.

NB: Assumption is you have 1 or more of these, not that every monorepo should have all 4.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Novinycommented, Feb 3, 2020

Decision:

- package.json
- packages/* - where packages designed to be consumed by other packages (published OR internal) live
- apps/* - where user-facing apps and websites should live
- services/* - where back-end services should live
- tools/* - where you should put packages intended to be used only within dev loops for your repository
- website/ - the location of the documentation website

For a design system being built alongside an app, you should put the design system packages inside a folder design-system that mirrors the above structure (as needed) except without a package.json in the design-system folder.


1reaction
emmatowncommented, Jan 30, 2020

Do you have recs on which node apps go in ‘apps’ and which go in ‘services’? That distinction doesn’t seem clear.

I think the answer is that apps is for front-end things and services is for back-end things. That of course gets blurry with things like Keystone so I’m not totally sure if it’s the ideal way to split things but as an example, in the two client projects I referred to, there is a Next site in /apps and a GraphQL API in /services.

Most of our repos do this, but it feels like an antipattern for me. It makes a lot of sense for library monorepos, but is likely harmful for product monorepos so it would be good to consistency it out of existence, and put the website in a thing.

I think that because it makes sense for library monorepos, we should document it. Also, I think there is a chance that we might want it for product monorepos if there are a bunch of products so that we can have packages for a particular product(e.g. ["/products/*/app", "/products/*/packages/*"]). (Let’s not document this now, It’s just an idea, this might be something I explore with the client project I’m about to be on a lot more)

Now you have said /scripts I think I like it better than my suggestions 😛 - I’m more interested in having conventions though so if you have more than weak opinions happy to go with them.

I’m happy to go with /scripts.

I propose this as a topic to finalise in the next monorepo meeting based on opinions gathered in this issue.

Agreed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Packages vs Folders – What's the Best Way to Save Your ...
Packages are self-contained Project Files. Everything you need for your Project is saved inside the Package. Which makes it easy to share.
Read more >
How to Write Go Code - The Go Programming Language
Go programs are organized into packages. A package is a collection of source files in the same directory that are compiled together.
Read more >
Relationship between a package statement and the directory ...
The go tool mandates that all (there are special cases, I know) your source files of a package reside in one file system...
Read more >
Package vs Folder - What's the Best Way to Save Your Logic ...
**Enjoy this video on Packages vs Folders ? ... Should you save your Logic Projects as Packages or Folders ? ... Does it...
Read more >
Standard Go Project Layout - GitHub
This workspace includes the top level /pkg , /bin and /src directories. Your actual project ends up being a sub-directory under /src ,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found