Skip to content

Commit cf05485

Browse files
committed
2 parents 3e847b5 + 9a1a79b commit cf05485

80 files changed

Lines changed: 2416 additions & 1688 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/console/.env.example

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Environment Variables
2+
# Copy this file to .env.local and customize
3+
4+
# Runtime Mode
5+
# Options: 'msw' (default) | 'server'
6+
# - msw: Use Mock Service Worker with in-browser ObjectStack kernel
7+
# - server: Connect to a real ObjectStack server
8+
VITE_RUNTIME_MODE=msw
9+
10+
# ObjectStack Server URL (used when VITE_RUNTIME_MODE=server)
11+
# VITE_SERVER_URL=http://localhost:5000/api/v1

apps/console/README.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# ObjectStack Console
2+
3+
The official **ObjectStack Platform Console** - a metadata-driven admin interface for managing data and configuration.
4+
5+
## 🎯 Overview
6+
7+
ObjectStack Console provides a modern, responsive admin interface that:
8+
9+
- **Auto-generates UI** from your metadata definitions
10+
- **CRUD Operations** with built-in validation
11+
- **Dynamic Navigation** based on registered objects
12+
- **Real-time Updates** with optimistic UI patterns
13+
- **Dark Mode Support** via shadcn/ui theming
14+
15+
## 🏗️ Architecture
16+
17+
The console supports two runtime modes:
18+
19+
### MSW Mode (Default)
20+
21+
Runs the ObjectStack Runtime directly in the browser using MSW (Mock Service Worker), enabling full offline development.
22+
23+
```mermaid
24+
graph TD
25+
Console["Console App"] -->|REST API| Network["Browser Network"]
26+
Network -->|Intercepted by| SW["Service Worker (MSW)"]
27+
SW -->|Delegates to| Kernel["ObjectStack Kernel"]
28+
Kernel -->|Uses| Driver["In-Memory Driver"]
29+
Kernel -.->|Reads| Config["objectstack.config.ts"]
30+
```
31+
32+
### Server Mode
33+
34+
Connects to a real ObjectStack server for production use or integration testing.
35+
36+
```mermaid
37+
graph TD
38+
Console["Console App"] -->|REST API| Server["ObjectStack Server"]
39+
Server -->|Processes| Kernel["ObjectStack Kernel"]
40+
Kernel -->|Uses| Driver["Database Driver"]
41+
```
42+
43+
## 🚀 Quick Start
44+
45+
```bash
46+
# Install dependencies
47+
pnpm install
48+
49+
# Start development server (MSW mode)
50+
pnpm dev
51+
52+
# Start in server mode (connects to real backend)
53+
VITE_RUNTIME_MODE=server VITE_SERVER_URL=http://localhost:5000/api/v1 pnpm dev
54+
```
55+
56+
The console will be available at `http://localhost:3000`.
57+
58+
## ⚙️ Environment Variables
59+
60+
| Variable | Default | Description |
61+
|----------|---------|-------------|
62+
| `VITE_RUNTIME_MODE` | `msw` | Runtime mode: `msw` or `server` |
63+
| `VITE_SERVER_URL` | `http://localhost:5000/api/v1` | Server URL (server mode only) |
64+
65+
Copy `.env.example` to `.env.local` to customize:
66+
67+
## 📁 Project Structure
68+
69+
```
70+
apps/console/
71+
├── src/
72+
│ ├── App.tsx # Main application component
73+
│ ├── main.tsx # Entry point with MSW bootstrap
74+
│ ├── index.css # Tailwind CSS configuration
75+
│ ├── components/
76+
│ │ ├── app-sidebar.tsx # Dynamic navigation sidebar
77+
│ │ ├── site-header.tsx # Page header with breadcrumbs
78+
│ │ ├── ObjectDataTable.tsx # Auto-generated data tables
79+
│ │ ├── ObjectDataForm.tsx # Auto-generated forms
80+
│ │ └── ui/ # shadcn/ui components
81+
│ ├── hooks/ # Custom React hooks
82+
│ ├── lib/ # Utilities
83+
│ └── mocks/ # MSW configuration
84+
├── objectstack.config.ts # Metadata definitions
85+
└── package.json
86+
```
87+
88+
## 🎨 UI Components
89+
90+
Built with [shadcn/ui](https://ui.shadcn.com/) and Tailwind CSS v4:
91+
92+
- **Sidebar** - Collapsible navigation with object list
93+
- **DataTable** - Sortable, filterable data grid
94+
- **DataForm** - Dynamic form generation from field metadata
95+
- **Toast** - Notification system for user feedback
96+
97+
## 🔧 Configuration
98+
99+
The console reads metadata from `objectstack.config.ts`:
100+
101+
```typescript
102+
import { defineStack } from '@objectstack/spec';
103+
import { ObjectSchema, Field } from '@objectstack/spec/data';
104+
105+
export const Account = ObjectSchema.create({
106+
name: 'account',
107+
label: 'Account',
108+
fields: {
109+
name: Field.text({ label: 'Name', required: true }),
110+
industry: Field.select({
111+
label: 'Industry',
112+
options: ['Technology', 'Finance', 'Healthcare']
113+
}),
114+
}
115+
});
116+
117+
export default defineStack({
118+
objects: [Account]
119+
});
120+
```
121+
122+
## 📦 Dependencies
123+
124+
- **React 18** - UI framework
125+
- **Vite** - Build tool
126+
- **Tailwind CSS v4** - Styling
127+
- **shadcn/ui** - Component library
128+
- **MSW** - API mocking for development
129+
- **@objectstack/client** - API client
130+
- **@objectstack/runtime** - In-browser kernel
131+
132+
## 🛠️ Development
133+
134+
```bash
135+
# Type checking
136+
pnpm typecheck
137+
138+
# Run tests
139+
pnpm test
140+
141+
# Build for production
142+
pnpm build
143+
144+
# Preview production build
145+
pnpm preview
146+
```
147+
148+
## 📄 License
149+
150+
MIT - See [LICENSE](../../LICENSE) for details.
File renamed without changes.
File renamed without changes.
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "@example/app-react-crud",
2+
"name": "@objectstack/console",
33
"version": "0.9.14",
4-
"description": "Complete MSW integration example with React CRUD components using ObjectStack Client",
4+
"description": "ObjectStack Platform Console - A metadata-driven admin interface for managing data and configuration",
55
"private": true,
66
"type": "module",
77
"scripts": {
@@ -23,11 +23,18 @@
2323
"@objectstack/plugin-msw": "workspace:*",
2424
"@objectstack/runtime": "workspace:*",
2525
"@objectstack/spec": "workspace:*",
26+
"@radix-ui/react-avatar": "^1.1.11",
27+
"@radix-ui/react-checkbox": "^1.3.3",
2628
"@radix-ui/react-dialog": "^1.1.15",
29+
"@radix-ui/react-dropdown-menu": "^2.1.16",
2730
"@radix-ui/react-label": "^2.1.8",
31+
"@radix-ui/react-progress": "^1.1.8",
2832
"@radix-ui/react-scroll-area": "^1.2.10",
33+
"@radix-ui/react-select": "^2.2.6",
2934
"@radix-ui/react-separator": "^1.1.8",
3035
"@radix-ui/react-slot": "^1.2.4",
36+
"@radix-ui/react-switch": "^1.2.6",
37+
"@radix-ui/react-tabs": "^1.1.13",
3138
"@radix-ui/react-toast": "^1.2.15",
3239
"@radix-ui/react-tooltip": "^1.2.8",
3340
"class-variance-authority": "^0.7.1",
File renamed without changes.

0 commit comments

Comments
 (0)