Skip to content

Commit 0159168

Browse files
authored
Merge pull request #392 from objectstack-ai/copilot/start-examples-api-service
2 parents 99ba9bd + b45edb9 commit 0159168

5 files changed

Lines changed: 50 additions & 6 deletions

File tree

README.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,32 @@ Since this package is not yet published to NPM, here is how to play with the sou
7878

7979
## Examples
8080

81-
- [examples/crm](examples/crm) - CRM metadata app with a custom server.
82-
- [examples/kitchen-sink](examples/kitchen-sink) - Component catalog metadata app.
83-
- [examples/objectstack-server](examples/objectstack-server) - Run a metadata app with @objectstack/cli.
81+
ObjectStack examples that demonstrate different features and use cases:
82+
83+
- **[examples/crm](examples/crm)** - Full-featured CRM application with dashboards, multiple views (Grid, Kanban, Map, Gantt), and custom server implementation.
84+
- **[examples/todo](examples/todo)** - Simple task management app demonstrating basic ObjectStack configuration and field types.
85+
- **[examples/kitchen-sink](examples/kitchen-sink)** - Comprehensive component catalog showing all available field types, dashboard widgets, and view types.
86+
- **[examples/msw-todo](examples/msw-todo)** - Frontend-first development example using MSW (Mock Service Worker) to run ObjectStack in the browser.
87+
88+
### Running Examples as API Servers
89+
90+
All examples (except msw-todo) can be run as API servers using `@objectstack/cli`:
91+
92+
```bash
93+
# From the monorepo root
94+
pnpm run serve:crm # Start CRM example on http://localhost:3000
95+
pnpm run serve:todo # Start Todo example on http://localhost:3000
96+
pnpm run serve:kitchen-sink # Start Kitchen Sink example on http://localhost:3000
97+
98+
# Or from individual example directories
99+
cd examples/crm
100+
pnpm run serve
101+
```
102+
103+
Each server provides:
104+
- GraphQL API endpoint: `http://localhost:3000/graphql`
105+
- REST API endpoints based on object definitions
106+
- Sample data loaded from the configuration manifest
84107

85108
## 📦 For React Developers
86109

examples/kitchen-sink/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"./objectstack.config": "./objectstack.config.ts"
1111
},
1212
"scripts": {
13+
"serve": "objectstack serve objectstack.config.ts",
1314
"build": "objectstack compile objectstack.config.ts dist/objectstack.json"
1415
},
1516
"dependencies": {

examples/todo/README.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,33 @@ examples/todo/
4646

4747
## 💡 Usage
4848

49-
This package is part of the `examples` workspace. To build and verify:
49+
This package is part of the `examples` workspace. You can build it, run it as an API server, or just use it for reference.
50+
51+
### Running as API Server
52+
53+
```bash
54+
# From the monorepo root
55+
pnpm run serve:todo
56+
57+
# Or from this directory
58+
pnpm run serve
59+
```
60+
61+
The server will start on `http://localhost:3000` providing:
62+
- GraphQL API endpoint: `http://localhost:3000/graphql`
63+
- REST API endpoints based on the object definitions
64+
65+
### Building the Example
5066

5167
```bash
5268
# Install dependencies (from monorepo root)
5369
pnpm install
5470

5571
# Build the example
56-
pnpm --filter @objectstack/example-todo build
72+
pnpm --filter @object-ui/example-todo build
5773

5874
# Run type checking
59-
pnpm --filter @objectstack/example-todo typecheck
75+
pnpm --filter @object-ui/example-todo typecheck
6076
```
6177

6278
## 📖 Learning Path

examples/todo/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"./objectstack.config": "./objectstack.config.ts"
99
},
1010
"scripts": {
11+
"serve": "objectstack serve objectstack.config.ts",
1112
"build": "objectstack compile objectstack.config.ts dist/objectstack.json"
1213
},
1314
"dependencies": {

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
],
1818
"scripts": {
1919
"dev:crm": "pnpm --filter @object-ui/example-crm start",
20+
"serve:crm": "pnpm --filter @object-ui/example-crm serve",
21+
"serve:todo": "pnpm --filter @object-ui/example-todo serve",
22+
"serve:kitchen-sink": "pnpm --filter @object-ui/example-kitchen-sink serve",
2023
"build": "turbo run build --filter=!@object-ui/site",
2124
"build:all": "turbo run build",
2225
"test": "vitest run",

0 commit comments

Comments
 (0)