rill icon indicating copy to clipboard operation
rill copied to clipboard

chore: monorepo package structure

Open briangregoryholmes opened this issue 1 year ago β€’ 3 comments

This PR proposes migrating our shared code structure to follow a more traditional monorepo organization. This essentially follows the guidelines from Turborepo, though this PR does not go so far as to actually use it. See Orval for a codebase that uses Turbo.

Namely, there is a new top level packages folder that houses isolated modules of shared/reusable code. Each of these will have their own dependencies, scripts, versions, test suites and will import from each other as you would import from any other package. This PR begins this process by migrating some web-common code to three packages: utils, events and actions.

I think there are number of benefits to this structure (and Turbo), though I would be lying if I said I wasn't mostly motivated by shortening our exceedingly long import paths. 🀷

A follow up PR would move our web-local, web-admin and web-auth apps into an apps folder, at which point I think we should rename them to developer, cloud and auth.

This is an open discussion, but I anticipate creating the following additional packages based on our existing code: ui, state, formatting, query, icons, time, features, metrics and other packages for shared configuration.

This PR also upgrades eslint to v9.

briangregoryholmes avatar Oct 19 '24 19:10 briangregoryholmes

I think there are number of benefits to this structure (and Turbo), though I would be lying if I said I wasn't mostly motivated by shortening our exceedingly long import paths. 🀷

Oooh. Thanks for taking the first stab at this! We can start with something like this.

/rill
β”œβ”€β”€ admin
β”œβ”€β”€ docs
β”œβ”€β”€ proto
β”œβ”€β”€ runtime
β”œβ”€β”€ scripts
β”œβ”€β”€ packages
β”‚   β”œβ”€β”€ ui
β”‚   β”œβ”€β”€ states
β”‚   β”œβ”€β”€ constants
β”‚   β”œβ”€β”€ utils
β”‚   β”‚   └── number-formatting
β”‚   └── icons
β”œβ”€β”€ apps
β”‚   β”œβ”€β”€ cli
β”‚   β”œβ”€β”€ web
β”‚   β”‚   β”œβ”€β”€ admin
β”‚   β”‚   β”œβ”€β”€ auth
β”‚   β”‚   β”œβ”€β”€ local
β”‚   β”‚   └── common

References https://github.com/vercel/turborepo/tree/main/examples/with-svelte https://github.com/orval-labs/orval/tree/master/samples/svelte-query/basic https://github.com/shadcn-ui/ui https://github.com/calcom/cal.com

lovincyrus avatar Oct 22 '24 20:10 lovincyrus

I like the idea of using Turbo & I can see the benefit of creating smaller packages to improve its ability to cache.

One reservation I have is that if we nest admin, auth, local directories under apps, then I feel like the Application and Platform directory structures would be asymmetrical – since admin and runtime are at the top-level, not nested under a directory like platform or services. Or would you propose a re-shuffling of those directories too?

ericpgreen2 avatar Oct 25 '24 21:10 ericpgreen2

Just for inspiration, two other projects with a Go backend and SPA frontend are:

  • https://github.com/grafana/grafana
  • https://github.com/sourcegraph/sourcegraph-public-snapshot (they went private recently, this is a snapshot)

begelundmuller avatar Oct 30 '24 17:10 begelundmuller