29
loading...
This website collects cookies to deliver better user experience
Files & Folders ◄─────────► Everything's a Repository
ℹ️ BTW this "multiple repositories" approach is great for open-source, because that's a low-trust, high-latency work environment where the workflow must be optimized for letting separate groups move at their own individual pace, but it is an extremely poor fit for a team whose value is their product.
ℹ️ BTW the Monorepo pattern is probably more usually seen where each package is versioned and published individually. That's a common pattern for open-source solutions. But that is explicitly not the goal for this series where we focus on a team that just wants to focus on their product, and want a way to organize the code so its easy to understand.
ℹ️ BTW, to keep our learnings easy we'll use a simple example to illustrate the complexity of a real product, but as a result it won't actually warrant any code-organizing. So please imagine the code is complex enough that we definitely need to reorganize 😅.
webby
├── package.json
├── prisma/
├── src
│ ├── analytics.spec.ts
│ ├── analytics.ts
│ ├── api.ts
│ ├── client.tsx
│ ├── index.ts
│ ├── logging.ts
│ ├── pages/
│ ├── server.tsx
│ └── types.ts
├── tsconfig.json
└── typings/
ℹ️ BTW, I've prepared the Files & Folders solution above via VSCode on GitHub1s.com if you'd like to explore the code yourself. You can also clone the repository ([email protected]:gaggle/exploring-the-monorepo.git
) and check out the attempt-files-&-folders
branch. It's also fine to just continue reading, as we'll cover all the necessary details as we get to them.
client.tsx
relates to the frontend, so possibly server.tsx
is the HTML-serving backend for that. That'd make api.ts
a backend, but what does analytics.ts
connect to? Maybe both? And maybe you don't know what that prisma
folder is about? How do we know what areas connect to what?package.json
file doesn't give an overview either because it is an overwhelming superset of all the dependencies for the product, with no way to tell which one belongs to what part of the product.┌─────┐ ┌─────┐
│ web │ │ api ├─┐
└────┬┘ └┬────┘ │
│ │ │
│ │ │
│ │ │
┌─▼───▼─┐ ┌▼──────────┐
│ types │ │ analytics │
└───────┘ └┬──────────┘
│
┌─────────┐ │
│ logging ◄───┘
└─────────┘
web
is straightforward:$ npm ci
$ npm run web:start
> Started on port 3000
api
:$ npm run api+db:start
[api] api started at http://localhost:3002