Skip to content

Commit 1888f81

Browse files
authored
Merge pull request #1405 from objectstack-ai/claude/metadata-example-platform-c6JIy
2 parents 07c35d8 + e136ada commit 1888f81

37 files changed

Lines changed: 2117 additions & 0 deletions

examples/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Welcome to the ObjectStack examples catalog! This directory contains carefully c
1212
|-------|----------|-------------|
1313
| 🟢 **Beginner** | [App Todo](#app-todo), [Plugin BI](#plugin-bi) | Start here - simple, focused examples |
1414
| 🟡 **Intermediate** | [HotCRM](https://github.com/objectstack-ai/hotcrm) | Real-world enterprise application (separate repo) |
15+
| 🟣 **Reference** | [App Showcase](./app-showcase/) | Kitchen-sink — **every** metadata type, view type, and chart type, plus a coverage test |
1516
| 🔴 **Advanced** | [Server](../apps/objectos/) | Server hosting & plugin orchestration |
1617

1718
### By Protocol Category
@@ -78,6 +79,33 @@ pnpm typecheck
7879

7980
---
8081

82+
### App Showcase
83+
**Path:** [`examples/app-showcase/`](./app-showcase/)
84+
**Level:** 🟣 Reference
85+
**Protocols:** Data, UI, System, Automation, AI, Auth
86+
87+
A **kitchen-sink** workspace built for demonstration, debugging, and
88+
coverage-driven verification. It pairs a realistic project-delivery domain
89+
with synthetic "gallery" objects that exhaust protocol variants, and ties them
90+
together with a coverage manifest that the test suite checks against the
91+
protocol's own Zod enums.
92+
93+
**What's included:**
94+
- **All 49 field types** (`src/objects/field-zoo.object.ts`) + every relationship kind (lookup, master-detail, self-referencing tree, many-to-many junction)
95+
- **All 8 list-view types** on one object (grid, kanban, gallery, calendar, timeline, gantt, map, chart) + all 5 form types
96+
- **All 38 chart types** in one dashboard + all 4 report types (tabular/summary/matrix/joined)
97+
- The action **type × location** matrix and a component-gallery page
98+
- Capability chains: security (RBAC + FLS + RLS + sharing + policy), automation (flow → approval → webhook → job → email), and AI (agent + tool + skill)
99+
- A **coverage test** that introspects the spec enums and fails when a new variant is left uncovered
100+
101+
```bash
102+
cd examples/app-showcase
103+
pnpm verify # typecheck + coverage test
104+
pnpm dev # → http://localhost:3000/_studio
105+
```
106+
107+
---
108+
81109
### App CRM (external)
82110
**Repo:** [github.com/objectstack-ai/hotcrm](https://github.com/objectstack-ai/hotcrm)
83111
**Level:** 🟡 Intermediate

examples/app-showcase/README.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# ObjectStack Showcase (`@objectstack/example-showcase`)
2+
3+
> A kitchen-sink workspace that exercises **every metadata type, every view
4+
> type, every chart type**, and the major **end-to-end capability chains**
5+
> built for three audiences at once: **demonstration**, **debugging**, and
6+
> **verification**.
7+
8+
Most example apps are intentionally minimal. This one is deliberately
9+
*exhaustive*. It pairs a coherent business domain (project delivery) with a
10+
set of synthetic "gallery" objects whose only job is to cover protocol
11+
variants, and ties the two together with a **coverage manifest** that the test
12+
suite checks against the protocol's own Zod enums.
13+
14+
## Why it exists
15+
16+
Demonstration and verification pull in opposite directions:
17+
18+
- **Demo** wants a believable, connected app — but a realistic app never
19+
naturally uses all 49 field types, all 8 view types, or all 38 chart types.
20+
- **Verify** wants every variant present and *asserted* — which a single
21+
realistic domain can't provide.
22+
23+
So the showcase splits into two tracks:
24+
25+
| Track | Purpose | Where |
26+
| :--- | :--- | :--- |
27+
| **Realistic backbone** | A connected delivery domain with seeded data, so every view renders something real. | `Account → Project → Task`, `Team`, `Category` |
28+
| **Gallery / specimens** | Synthetic objects & views that exhaust protocol variants. | `Field Zoo`, the Task view gallery, the Chart Gallery |
29+
30+
## Quick start
31+
32+
```bash
33+
pnpm install
34+
pnpm --filter @objectstack/spec build # if not already built
35+
36+
# Demonstration — open Studio and click through the gallery
37+
pnpm dev # → http://localhost:3000/_studio
38+
39+
# Verification — typecheck + coverage test
40+
pnpm verify
41+
```
42+
43+
## What it covers
44+
45+
### Data layer (ObjectQL)
46+
- **All 49 field types**`src/objects/field-zoo.object.ts` carries one field
47+
of every `FieldType`, with the remainder appearing naturally on the backbone
48+
objects.
49+
- **Every relationship kind**`lookup` (project → account, category → self),
50+
`master_detail` (task → project), self-referencing **hierarchy/tree**
51+
(`Category.parent`), and **many-to-many** via the
52+
`showcase_project_membership` junction.
53+
- **Formulas, validations, and a status state machine** on `Project` and
54+
`Task`.
55+
56+
### View layer (ObjectUI)
57+
- **All 8 list-view types** on a single object (`src/views/task.view.ts`):
58+
grid, kanban, gallery, calendar, timeline, gantt, map, chart. The Task object's
59+
fields are chosen so one object can back every type.
60+
- **All 5 form-view types**: simple, tabbed, wizard, split, drawer.
61+
- **The full chart taxonomy**`src/dashboards/chart-gallery.dashboard.ts`
62+
has one widget per chart family (all 38 `ChartType`s).
63+
- **All 4 report types**: tabular, summary, matrix, joined
64+
(`src/reports/index.ts`).
65+
- **The action matrix** — every `ActionType` (script/url/flow/modal/api/form)
66+
across every `ActionLocation`.
67+
- **A component-gallery page** placing the standard page components.
68+
69+
### Capability chains (the "complex abilities")
70+
- **Security** (`src/security/index.ts`): a role hierarchy + a permission set
71+
that layers object CRUD, **field-level security (FLS)**, and
72+
**row-level security (RLS)**, plus criteria- and owner-based **sharing rules**
73+
and an org **policy**.
74+
- **Automation**: a record-triggered flow → a screen-flow wizard → a multi-step
75+
**approval** → an outbound **webhook** → a scheduled **job** → an **email**
76+
template.
77+
- **AI**: an **agent** wired to a **tool** and a **skill**.
78+
- **i18n / theming / portals**: `en` + `zh-CN` translations, light + dark
79+
themes, and an external client portal.
80+
81+
## The coverage manifest — how "confirm" works
82+
83+
`src/coverage.ts` declares what the showcase is supposed to cover and provides
84+
the collectors the test uses. `test/coverage.test.ts` then **introspects the
85+
protocol's own enums** (`FieldType`, `ChartTypeSchema`, `ReportType`,
86+
`ActionType`, `ACTION_LOCATIONS`) and asserts every member appears at least
87+
once across the registered metadata.
88+
89+
Because the expected sets come from the **spec** — not a hand-maintained list —
90+
the test fails automatically when the platform gains a new field type, chart
91+
type, or report type that the showcase hasn't demonstrated yet. That keeps this
92+
example a **living conformance fixture**, not a static snapshot. (`defineStack`
93+
itself also runs full schema + cross-reference validation when the config is
94+
imported, so `pnpm test` proves the whole stack loads cleanly.)
95+
96+
## Directory layout
97+
98+
```
99+
app-showcase/
100+
├── objectstack.config.ts # defineStack — registers everything
101+
├── src/
102+
│ ├── coverage.ts # coverage manifest + collectors (the soul)
103+
│ ├── objects/ # field-zoo + backbone + junction + tree
104+
│ ├── views/ # all 8 list types + all 5 form types
105+
│ ├── dashboards/ # chart gallery (all 38 chart types)
106+
│ ├── reports/ # tabular / summary / matrix / joined
107+
│ ├── actions/ # type × location matrix
108+
│ ├── pages/ # component gallery
109+
│ ├── apps/ # navigation linking every surface
110+
│ ├── security/ # roles + FLS + RLS + sharing + policy
111+
│ ├── flows/ approvals/ webhooks/ jobs/ emails/ # automation chain
112+
│ ├── agents/ # agent + tool + skill
113+
│ ├── themes/ translations/ datasources/ portals/
114+
│ └── data/ # seed data sized to feed every view
115+
└── test/
116+
├── coverage.test.ts # introspects spec enums, asserts coverage
117+
└── seed.test.ts # stack-loads + breadth smoke test
118+
```
119+
120+
## Extending it
121+
122+
When you add a new variant to the platform, the coverage test will go red and
123+
point at the gap. Add a field/view/widget that uses it, reference it in
124+
`COVERAGE`, and the test goes green again.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
// Copyright (c) 2025 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
import { defineStack } from '@objectstack/spec';
4+
5+
import * as objects from './src/objects/index.js';
6+
import { TaskViews, ProjectViews } from './src/views/index.js';
7+
import { ShowcaseApp } from './src/apps/index.js';
8+
import { ChartGalleryDashboard } from './src/dashboards/index.js';
9+
import { allReports } from './src/reports/index.js';
10+
import { allActions } from './src/actions/index.js';
11+
import { ComponentGalleryPage } from './src/pages/index.js';
12+
import { allFlows } from './src/flows/index.js';
13+
import { allApprovals } from './src/approvals/index.js';
14+
import { allWebhooks } from './src/webhooks/index.js';
15+
import { allJobs } from './src/jobs/index.js';
16+
import { allEmails } from './src/emails/index.js';
17+
import { ShowcaseAssistantAgent, ProjectOpsSkill } from './src/agents/index.js';
18+
import {
19+
allRoles,
20+
allPermissionSets,
21+
allSharingRules,
22+
allPolicies,
23+
} from './src/security/index.js';
24+
import { allThemes } from './src/themes/index.js';
25+
import { ShowcaseTranslationBundle } from './src/translations/index.js';
26+
import { allDatasources } from './src/datasources/index.js';
27+
import { allPortals } from './src/portals/index.js';
28+
import { ShowcaseSeedData } from './src/data/index.js';
29+
30+
/**
31+
* Showcase — a kitchen-sink workspace that exercises every metadata type,
32+
* every view type, every chart type, and the major end-to-end capability
33+
* chains. It is built for three audiences at once:
34+
*
35+
* • Demonstration — a coherent project-delivery domain with seeded data
36+
* so every view renders something real.
37+
* • Debugging — open in Studio (`pnpm dev` → http://localhost:3000/_studio)
38+
* and click through the gallery navigation.
39+
* • Verification — `pnpm verify` runs typecheck + the coverage test, which
40+
* introspects the protocol's own enums and fails if any field/chart/
41+
* report type is left uncovered.
42+
*/
43+
export default defineStack({
44+
manifest: {
45+
id: 'com.example.showcase',
46+
namespace: 'showcase',
47+
version: '0.1.0',
48+
type: 'app',
49+
name: 'ObjectStack Showcase',
50+
description: 'Kitchen-sink workspace covering all metadata types, all view types, and the major capability chains.',
51+
},
52+
53+
requires: ['ui', 'automation'],
54+
55+
// Infrastructure
56+
datasources: allDatasources,
57+
datasourceMapping: [
58+
{ namespace: 'showcase', datasource: 'showcase_primary' },
59+
{ default: true, datasource: 'showcase_primary' },
60+
],
61+
62+
// i18n
63+
translations: [ShowcaseTranslationBundle],
64+
i18n: {
65+
defaultLocale: 'en',
66+
supportedLocales: ['en', 'zh-CN'],
67+
fallbackLocale: 'en',
68+
messageFormat: 'simple',
69+
lazyLoad: false,
70+
cache: true,
71+
},
72+
73+
// Data
74+
objects: Object.values(objects),
75+
76+
// UI
77+
apps: [ShowcaseApp],
78+
portals: allPortals,
79+
views: [TaskViews, ProjectViews],
80+
pages: [ComponentGalleryPage],
81+
dashboards: [ChartGalleryDashboard],
82+
reports: allReports,
83+
actions: allActions,
84+
themes: allThemes,
85+
86+
// Logic
87+
flows: allFlows,
88+
approvals: allApprovals,
89+
jobs: allJobs,
90+
emailTemplates: allEmails,
91+
webhooks: allWebhooks,
92+
93+
// Security
94+
roles: allRoles,
95+
permissions: allPermissionSets,
96+
sharingRules: allSharingRules,
97+
policies: allPolicies,
98+
99+
// AI
100+
agents: [ShowcaseAssistantAgent],
101+
skills: [ProjectOpsSkill],
102+
103+
// Seed data
104+
data: ShowcaseSeedData,
105+
});

examples/app-showcase/package.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"name": "@objectstack/example-showcase",
3+
"version": "0.1.0",
4+
"description": "Kitchen-sink showcase workspace — exercises every metadata type, every view type, every chart type, and the major end-to-end capability chains (security, automation, AI). Built for demonstration, debugging, and coverage-driven verification.",
5+
"license": "Apache-2.0",
6+
"private": true,
7+
"main": "./objectstack.config.ts",
8+
"types": "./objectstack.config.ts",
9+
"exports": {
10+
".": "./objectstack.config.ts",
11+
"./objectstack.config": "./objectstack.config.ts",
12+
"./coverage": "./src/coverage.ts"
13+
},
14+
"scripts": {
15+
"dev": "objectstack dev",
16+
"start": "objectstack start",
17+
"build": "objectstack build",
18+
"typecheck": "tsc --noEmit",
19+
"test": "vitest run",
20+
"verify": "pnpm typecheck && pnpm test"
21+
},
22+
"dependencies": {
23+
"@objectstack/runtime": "workspace:*",
24+
"@objectstack/spec": "workspace:*"
25+
},
26+
"devDependencies": {
27+
"@objectstack/cli": "workspace:*",
28+
"typescript": "^6.0.3",
29+
"vitest": "^4.1.7"
30+
}
31+
}

0 commit comments

Comments
 (0)