Skip to content

Commit 44c9dba

Browse files
committed
Update CLI tools and plugin writing documentation for improved project creation syntax
1 parent ece3fe7 commit 44c9dba

2 files changed

Lines changed: 58 additions & 83 deletions

File tree

content/docs/developers/cli-tools.mdx

Lines changed: 55 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -78,35 +78,28 @@ npx objectstack --version
7878
### Create a New Project
7979

8080
```bash
81-
# Interactive mode
82-
objectstack init
81+
# General syntax
82+
objectstack create <type> <name>
8383

84-
# Or specify project name
85-
objectstack init my-app
84+
# Create a new example application (Todo list)
85+
objectstack create example my-todo-app
8686

87-
# With template
88-
objectstack init my-app --template=crm
87+
# Create a new plugin
88+
objectstack create plugin my-plugin
8989
```
9090

91-
**Available Templates:**
91+
**Available Types:**
9292

93-
- `blank` - Minimal setup (default)
94-
- `crm` - Customer relationship management
95-
- `ecommerce` - E-commerce platform
96-
- `saas` - Multi-tenant SaaS starter
97-
- `helpdesk` - Ticketing system
93+
- `example` - A functional example application
94+
- `plugin` - Reusable plugin structure
9895

9996
**Project Structure:**
10097

10198
```
102-
my-app/
99+
my-todo-app/
103100
├── src/
104-
│ ├── objects/ # Object definitions
105-
│ ├── views/ # UI views
106-
│ ├── flows/ # Business logic flows
107-
│ ├── plugins/ # Custom plugins
101+
│ ├── domains/ # Domain logic (Objects)
108102
│ └── index.ts # Entry point
109-
├── tests/
110103
├── objectstack.config.ts # Project configuration
111104
├── package.json
112105
└── tsconfig.json
@@ -118,76 +111,58 @@ my-app/
118111

119112
### objectstack.config.ts
120113

121-
```typescript
122-
import { defineConfig } from '@objectstack/cli';
114+
ObjectStack uses a **Zero-Config** approach for development. You only need to define your Objects and Apps. The runtime, database, and server are auto-configured for you.
123115

124-
export default defineConfig({
125-
// ============================================================================
126-
// Project Metadata
127-
// ============================================================================
128-
129-
name: 'my_app',
130-
version: '1.0.0',
131-
description: 'My ObjectStack Application',
132-
133-
// ============================================================================
134-
// Build Settings
135-
// ============================================================================
136-
137-
build: {
138-
outDir: './dist',
139-
sourcemap: true,
140-
minify: true,
141-
target: 'node18',
142-
},
143-
144-
// ============================================================================
145-
// Database Configuration
146-
// ============================================================================
147-
148-
datasources: {
149-
default: {
150-
driver: 'postgres',
151-
host: process.env.DB_HOST || 'localhost',
152-
port: parseInt(process.env.DB_PORT || '5432'),
153-
database: process.env.DB_NAME || 'myapp',
154-
user: process.env.DB_USER || 'postgres',
155-
password: process.env.DB_PASSWORD,
156-
},
116+
```typescript
117+
import { defineStack } from '@objectstack/spec';
118+
import { Task } from './src/objects/task';
119+
120+
export default defineStack({
121+
// Metadata
122+
manifest: {
123+
name: 'my_app',
124+
version: '1.0.0',
125+
description: 'My ObjectStack Application',
157126
},
158127

159-
// ============================================================================
160-
// Plugin Configuration
161-
// ============================================================================
162-
163-
plugins: [
164-
'@objectstack/plugin-auth',
165-
'@objectstack/plugin-email',
166-
'./src/plugins/custom-integration',
128+
// Data Layer (ObjectQL)
129+
objects: [
130+
Task
167131
],
168132

169-
// ============================================================================
170-
// Development Server
171-
// ============================================================================
172-
173-
dev: {
174-
port: 3000,
175-
host: '0.0.0.0',
176-
watch: true,
177-
hotReload: true,
178-
},
179-
180-
// ============================================================================
181-
// Deployment
182-
// ============================================================================
183-
184-
deploy: {
185-
target: 'cloud', // 'cloud' | 'self-hosted' | 'docker'
186-
region: 'us-east-1',
187-
},
133+
// UI Layer (Apps & Visualizations)
134+
apps: [
135+
// Define your apps here
136+
]
188137
});
189138
```
190139

140+
When you run `objectstack dev`, the CLI automatically:
141+
1. **Injects ObjectQL Engine** if objects are detected.
142+
2. **Injects Memory Driver** if no other driver is configured (Development Mode).
143+
3. **Injects Http Server** to serve the API.
144+
145+
---
146+
147+
## 💻 Development Commands
148+
149+
### Start Development Server
150+
151+
```bash
152+
# Start the dev server with hot reload
153+
objectstack dev
154+
155+
# Watch specific package in a monorepo
156+
objectstack dev @my/app
157+
```
158+
159+
### Check Environment Health
160+
161+
```bash
162+
# Verify Node.js, pnpm, and dependencies
163+
objectstack doctor
164+
```
165+
191166
---
192167

193168
## 📝 Code Generation

content/docs/developers/writing-plugins.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ Before building a plugin, ensure you have:
7070
### Step 1: Create a Plugin Project
7171

7272
```bash
73-
# Using the official generator
74-
npm create @objectstack/plugin my-crm-plugin
73+
# Using the CLI generator
74+
objectstack create plugin my-crm-plugin
7575

7676
cd my-crm-plugin
77-
npm install
77+
pnpm install
7878
```
7979

8080
This generates a project structure:

0 commit comments

Comments
 (0)