@mydaogs/shared-docs
v0.9.2
Published
Cross-cutting engineering docs for the kit: rules, architecture decisions, and patterns that belong to no single package
Readme
@mydaogs/shared-docs
Cross-cutting engineering docs for the kit: rules, architecture decisions, and patterns that belong to no single package
Docs that describe one package ship with that package instead — see the table below. Nothing is duplicated: every doc has exactly one home
What this is
The engineering half of a working docs tree, extracted so a new project starts with the rules, architecture decisions, and feature blueprints already written. Only material that survives a change of product is included. Anything describing a specific domain, deploy target, or business flow stays in the originating project
Stack assumed
- pnpm + Turborepo monorepo
- Next.js App Router with Cache Components, React Compiler, Turbopack
- Prisma + MongoDB
- TanStack Query, react-hook-form, Zod, next-intl
- wagmi + viem + Reown AppKit
- Foundry for contracts
- Upstash Redis for shared cache invalidation
- Better Auth for sessions and RBAC
Docs that depend on a stack choice say so. Drop the file if you swap that choice out
Placeholder convention
Paths and identifiers use placeholders. Replace them once, repo-wide, when adopting
| Placeholder | Means |
| --- | --- |
| <monorepo>/ | pnpm + Turborepo workspace root |
| <contracts>/ | Foundry workspace root |
| apps/app | primary browser-facing product app |
| apps/backend | backend API app (auth, data, cron, webhooks) |
| apps/web | marketing or content site |
| apps/cms | headless CMS app |
| apps/local-indexer | local onchain poller |
| APP_TAGS | the project's cache-tag registry |
| Entity / ENTITY | a primary domain record and its permission entity |
| OWNER_ROLE / OPERATOR_ROLE | an organization-owner role and a delegated member role |
| localChain / testnetChain / mainnetChain | the three concrete chains the project targets |
| <project> | the project slug used in per-environment resource names |
| <provider> | the onchain webhook provider (webhooks/<provider>/) |
| BACKEND_CONTRACT_VERSION | the project's wire-contract version constant |
Package names (@shared/ui, @shared/db, @shared/backend-contract, @shared/kv, @shared/cache-handler, @shared/utils) are kept verbatim — they are already generic and are worth keeping stable across projects
What lives here
rules/README.md- hard rules for working in the repodecisions/README.md- architecture decisions and system structurefeatures/README.md- reusable architecture blueprintsunits/README.md- reusable code unit tracking (components, hooks, utils, types)docs-readme-template.md- thedocs/README.mdentry point, since nothing upstream can write itinit-docs- scaffolds the tree into an empty repository and generates the ownership recordcheck-docs-adoption- CI check thatdocs/is at the repository root and is the only docs tree, and that the adopted tree still has an entry point, an index per folder, an ownership record, and no surviving path placeholdercheck-docs-links- CI check that every relative markdown link under a docs tree resolves
All three are bin entries, so a repo-root package.json calls them by name with nothing else installed
The four folder indexes list every doc the kit carries, including the ones that ship with a package. An entry marked → @mydaogs/<package> is read at that package's root
What lives with its package
| Package | Docs it owns |
| --- | --- |
| @mydaogs/core | bigint serialization rules |
| @mydaogs/contract | backend API contract, response envelope, business errors |
| @mydaogs/cache-handler | distributed cache handler decision |
| @mydaogs/query-client | identity-scoped cache reset hook |
| @mydaogs/web3 | network config, env config split |
| @mydaogs/web3-tx | durable pending-tx sync, pending transactions |
| @mydaogs/web3-client | contract write wrapper, query invalidation |
| @mydaogs/indexer | event processing pipeline |
If a doc describes one package's behaviour, it belongs in that package and is enforced there by check:doc-ownership. This package is for what does not fit that test: patterns a consuming app implements, which name app directories and framework conventions by necessity
Recommended reading order
decisions/tech-stack.mddecisions/monorepo.mddecisions/backend.mddecisions/frontend.mddecisions/data-flow.mdrules/README.mdunits/README.md
Adopting this kit
From an empty repository:
git init
pnpm init
pnpm add -D @mydaogs/shared-docs
pnpm exec init-docsinit-docs scaffolds the whole tree: the four folders, the docs/README.md
entry point, product/ and runbooks/ stubs, the four project-authored
decision stubs, the two check:docs* scripts, and — the part worth automating —
the ownership record in each carried folder, generated from the files it
actually copied at the version actually installed
It refuses to run anywhere but a repository root, because docs/ inside a
workspace is the one mistake no later check can recover. It is idempotent:
a re-run fills what is missing and reports what it left alone
What it cannot do is decide the project's own content:
- Replace the placeholders from the table above, repo-wide
- Delete any doc whose stack choice the project does not adopt, and its index entry
- Fill the
units/inventories — they ship as empty templates on purpose - Answer the four
decisions/stubs - Run
pnpm check:docs, which enumerates exactly what is still outstanding
Then wire both checks into CI, triggered on docs/** — see
rules/docs-rules.md
The generated ownership record is what keeps the copy honest. Once the
placeholders are replaced a copied doc reads as the project's own, and nothing
tells a reader that a fuller version exists upstream, or that a fix belongs
upstream rather than locally. It goes in the folder README.md rather than as a
banner on each file — that is where readers are told to start, and a per-file
banner restates the same fact once per file and goes stale one file at a time
What is deliberately absent
- Product vision, glossary, user types, domain workflows
- Runbooks — deployment, CI, and database procedures are per-project by nature
- Diagrams — the tier structure is worth copying, the contents are not
- Legal drafts and retention matrices — these need counsel per jurisdiction and product
STORY-*feature docs — user stories are the definition of project-specific