Skip to content

Commit 92bfbff

Browse files
Elon Muskclaude
andauthored
docs(getting-started): map every authorable defineStack collection to its directory and guide (#10357)
The project-layout tree showed seven directories — exactly the `os g <type>` generator defaults — for a stack that declares 32 authorable collections. A developer holding a report, a job, an email template or a permission set had no way to answer "where does this go" from the page that exists to teach project navigation. Two additions, both derived rather than recalled: - The layout tree now carries the union of what `examples/app-todo` and `examples/app-crm` lay out flat plus the `os g` defaults, and a second tree shows the group-by-domain variant `examples/app-showcase` actually ships. The two trees disagree about paths and agree about keys, which is the point the section already made about there being no filename-suffix magic. - A routing table: every authorable `defineStack()` key, one clause for what it declares, and the page to read next. Keys with no hand-written guide link their generated reference under /docs/references/ and nothing else. The key list is enumerated from ObjectStackDefinitionSchema's runtime shape (44 keys), not transcribed. The 12 excluded keys are named in the page with their reason. Claude-Session: https://claude.ai/code/session_01GawRwpD44VwBDVy3hs77AX Co-authored-by: Claude <noreply@anthropic.com>
1 parent 6076abf commit 92bfbff

1 file changed

Lines changed: 90 additions & 4 deletions

File tree

content/docs/getting-started/quick-start.mdx

Lines changed: 90 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,28 +123,114 @@ For the full authoring surface of each, load the matching
123123

124124
## Reading a project's layout
125125

126-
Metadata is grouped by domain under `src/`. This map lets you navigate any
127-
ObjectStack project — including one an agent just generated:
126+
Metadata lives under `src/`, one directory per collection. This map lets you
127+
navigate any ObjectStack project — including one an agent just generated:
128128

129129
```
130130
support-desk/
131131
├── objectstack.config.ts # defineStack() — the single entry point, wires it all
132132
├── src/
133133
│ ├── objects/ # Data models (required)
134-
│ ├── actions/ # Buttons, bulk operations
134+
│ ├── datasources/ # External database / API connections
135+
│ ├── hooks/ # Record lifecycle logic
136+
│ ├── data/ # Seed records
135137
│ ├── views/ # List / form / kanban lenses
138+
│ ├── pages/ # Standalone custom pages
136139
│ ├── apps/ # Navigation shells
140+
│ ├── actions/ # Buttons, bulk operations
141+
│ ├── dashboards/ # Analytics boards
142+
│ ├── reports/ # Saved analytical queries
143+
│ ├── datasets/ # Semantic-layer datasets
137144
│ ├── flows/ # Automation logic
138-
│ ├── dashboards/ # Analytics
145+
│ ├── functions/ # Named handler callables (code, not metadata)
146+
│ ├── translations/ # i18n bundles
147+
│ ├── security/ # Permission sets, positions, sharing rules, capabilities
148+
│ ├── docs/ # In-app documentation (Markdown)
139149
│ └── agents/ # AI agents
140150
└── test/ # Tests
141151
```
142152

153+
No app ships every one of those: it is the union of what `examples/app-todo` and
154+
`examples/app-crm` lay out flat, plus the directories `os g <type>` writes into.
155+
A larger app groups the same collections by domain instead —
156+
`examples/app-showcase` is the reference for that variant:
157+
158+
```
159+
app-showcase/
160+
├── objectstack.config.ts
161+
├── src/
162+
│ ├── data/ # objects, extensions, hooks, mappings, analytics, seed
163+
│ ├── ui/ # views, pages, apps, actions, dashboards, reports, datasets, themes
164+
│ ├── automation/ # flows, jobs, webhooks
165+
│ ├── security/ # permission sets, positions, sharing rules, capabilities
166+
│ ├── system/ # apis, books, connectors, datasources, emails, server, translations
167+
│ └── docs/ # In-app documentation (Markdown)
168+
└── test/
169+
```
170+
143171
Each folder has an `index.ts` barrel that re-exports its metadata; those barrels
144172
are imported into `objectstack.config.ts`. There is **no filename-suffix magic**
145173
metadata is wired in through those explicit imports, so `objectstack.config.ts` is
146174
the one place that tells you what's actually in the app.
147175

176+
Which is why the directory is a convention and the **`defineStack()` key is the
177+
contract**: the two trees above disagree about paths and agree exactly about
178+
keys. So when you are holding a piece of metadata and want to know where it
179+
goes, start from the key —
180+
[Where each piece of metadata goes](#where-each-piece-of-metadata-goes) lists
181+
every one of them.
182+
183+
## Where each piece of metadata goes
184+
185+
Every piece of metadata in an app arrives through one `defineStack()` key. This
186+
is the full authorable set, ordered data → interface → automation → integration
187+
→ access → AI — one clause each, and the page to read next:
188+
189+
| `defineStack()` key | Declares | Guide |
190+
| :--- | :--- | :--- |
191+
| `objects` | Business objects — tables, fields, validation | [Objects](/docs/data-modeling/objects) |
192+
| `objectExtensions` | Fields and config merged into an object another package owns | [Reference](/docs/references/data/object) |
193+
| `datasources` | Connections to external databases and APIs | [External Datasources](/docs/data-modeling/external-datasources) |
194+
| `datasourceMapping` | Rules routing a package, namespace or object pattern to a datasource | [External Datasources](/docs/data-modeling/external-datasources) |
195+
| `data` | Seed records loaded at bootstrap | [Seed Data](/docs/data-modeling/seed-data) |
196+
| `hooks` | Record lifecycle logic on insert / update / delete | [Hooks](/docs/automation/hooks) |
197+
| `mappings` | Field mappings for data import and export | [Reference](/docs/references/data/mapping) |
198+
| `analyticsCubes` | Semantic-layer cubes over the object graph | [Reference](/docs/references/data/analytics) |
199+
| `datasets` | Query-shaped datasets that charts and reports read from | [Analytics](/docs/data-modeling/analytics) |
200+
| `apps` | Navigation shells — which tabs a user sees | [Apps](/docs/ui/apps) |
201+
| `views` | List / form / kanban lenses over an object | [Views](/docs/ui/views) |
202+
| `pages` | Standalone custom pages | [Pages](/docs/ui/pages) |
203+
| `dashboards` | Chart and metric boards | [Dashboards](/docs/ui/dashboards) |
204+
| `reports` | Saved analytical queries with grouping and totals | [Reference](/docs/references/ui/report) |
205+
| `actions` | Buttons and bulk operations, with CEL visibility | [Actions](/docs/ui/actions) |
206+
| `themes` | Color tokens and branding | [Reference](/docs/references/ui/theme) |
207+
| `translations` | i18n bundles for labels and messages | [Translations](/docs/ui/translations) |
208+
| `docs` | In-app Markdown documentation items | [Doc Pages](/docs/ui/doc-pages) |
209+
| `books` | Ordered navigation spines over those doc items | [Reference](/docs/references/system/book) |
210+
| `flows` | Automation and approval graphs | [Flows](/docs/automation/flows) |
211+
| `jobs` | Scheduled and background jobs | [Reference](/docs/references/system/job) |
212+
| `emailTemplates` | Templates the email service resolves by name and locale | [Reference](/docs/references/system/email-template) |
213+
| `webhooks` | Outbound HTTP notifications | [Webhooks](/docs/automation/webhooks) |
214+
| `connectors` | External system connectors a flow can dispatch | [Connectors](/docs/automation/connectors) |
215+
| `apis` | Declarative REST endpoints under your own namespace | [Reference](/docs/references/api/endpoint) |
216+
| `positions` | Capability-distribution groups | [Positions](/docs/permissions/positions) |
217+
| `permissions` | Permission sets — object, field and system grants | [Permission Sets](/docs/permissions/permission-sets) |
218+
| `capabilities` | Authorization capabilities this package defines | [Reference](/docs/references/security/misc) |
219+
| `sharingRules` | Record-level sharing beyond the org-wide default | [Sharing Rules](/docs/permissions/sharing-rules) |
220+
| `agents` | AI agents — platform-internal; third parties extend through `skills` | [Agents](/docs/ai/agents) |
221+
| `skills` | Reusable AI capability bundles — the extension primitive | [Skills](/docs/ai/skills) |
222+
| `tools` | Optional AI-presentation refinement over an action or flow | [Reference](/docs/references/ai/tool) |
223+
224+
Rows linked to a **Reference** have no hand-written guide yet — the generated
225+
schema page is the authority until one lands.
226+
227+
**Not in the table, and why.** `viewItems` and `runtimeModule` are not authorable
228+
at all (`viewItems` is `z.never()`, the machine-assembled channel for
229+
runtime-assembled manifests; `runtimeModule` is written by `objectstack build`);
230+
`manifest`, `i18n`, `api`, `server`, `requires`, `tiers`, `plugins` and
231+
`devPlugins` configure the stack rather than declare metadata items; and
232+
`functions` and `onEnable` are code the runtime calls, not metadata it stores.
233+
148234
## How you verify
149235

150236
Reading the metadata is half of verification; running the app is the other half.

0 commit comments

Comments
 (0)