Skip to content
joinery / docs

Naming and folder conventions

806 words ยท updated 6 hours agodocs/concepts/conventions.md

๐Ÿ“ Naming and folder conventions

Where each kind of file lives and what it's called, across projects. A rule only one project follows stays in that project's README.

Target names

Plugin-inferred targets are namespaced. Every project's package.json scripts publish the stable names over them, and everything that runs a project calls only the stable names.

Stable nameDelegates toCalled by
lintnx eslint:lint, from @nx/eslint/pluginpnpm lint, CI, pre-push
typechecktsc --noEmit, or nuxt typecheck in a Nuxt app; never the tsc:typecheck or vite:typecheck the plugins inferpnpm typecheck, CI, pre-push
testvitest . --watch=falsepnpm test, CI, pre-push
buildWhatever the project actually deploys: nx nuxt:build, or nx build-static in developer-portalpnpm build, CI

nx.json names every inferred target and hangs caching on the stable names, so hooks, CI and pnpm check never need to know which tool a project uses.

GitHub workflows

RuleWhy
name: is <Category> / <Subject>, or one word for a repo-wide workflow (CI, Release, Security).github/workflows/ can't hold folders and the Actions sidebar sorts by name, so the category is the only grouping; GitHub appends / <job> to a check, so the slash reads as one path
Categories: Deploy for a site going live, PR for what runs on a pull requestRead off the sidebar, they say when the workflow runs
The subject names the project, never the host: Deploy / Huella Legal, not Netlify deploymentA move to another host shouldn't rename the workflow
The file is the name slugged: Deploy / Huella Legal โ†’ deploy-huella-legal.ymlpnpm invariants:check fails a mismatch

Package manifests

RuleWhy
Every project is "private": trueNothing is published: the Release workflow runs nx release --skip-publish. nx release still versions and tags a private package from its commits, as @joinery/configs shows, so the flag only stops an npm publish from working by accident
The directory name is the package name, @joinery/<dirname>The new-package skill has the rest of the manifest
Release tags are @joinery/<name>@<version>nx release derives the next version from the last one, per versioning

Nuxt apps

Kind of fileConventionWhy
PageNamed in English after its route (authors/[slug].vue for author), with the URL in definePageMeta's path in whatever language the site speaksLinks go by route name, which is English, so the file reads the same in the tree and in a link, and moving a URL is one edit in one page rather than a rename
Page bodyThe template lists sections. A section with markup of its own and a name a person would use ("the hero", "the principles") is a component in components/<page>/ of the page's layer (home/Hero.vue โ†’ HomeHero) and owns its band, container and padding. A layout wrapper around one component stays inline. The script holds route meta, data and SEO; derived state lives in the section that shows it. vue/max-lines-per-block caps a page at 60 template and 50 script linesA page should read as its own outline. Extracting by name rather than by size keeps single-use wrappers like CategoriesWrapper out
View-model typeshared/types/<Name>.ts when app/ and server/ both use it, else that side's types/; PascalCase, one exported type per file. A constant a type derives from (typeof KINDS[number]) goes in shared/constants.tsThe file tree is the type index, and an import names exactly what it uses
Type a route answers withIn shared/types/, never exported from the route fileAn app/ file importing it from server/api/ makes the browser bundle depend on a server route
Component in a layerNever a bare name at the layer's app/components/ root. A component there carries its layer's name, singular or plural (NewsletterBand, WorkflowStageCards), or sits in a folder naming what it belongs to and drops that prefix from the file (article/Byline.vue registers ArticleByline). Nuxt Content's content/ overrides keep the names Nuxt Content looks for (ProseA)A bare name says nothing about who owns it, and Nuxt collapses a repeated prefix where Storybook doesn't, so article/ArticleByline.vue would register under two names
Imports between and within layersPer app: the developer-portal README and the huella-legal READMEEach app resolves them differently, so neither rule generalises

infrastructure/scripts is not a Nuxt app and keeps each type beside the function that produces it, per 0004.