@crossdelta/platform-sdk 0.3.21 → 0.3.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +123 -17
  2. package/bin/cli.js +164 -302
  3. package/package.json +16 -5
  4. package/logo.png +0 -0
package/README.md CHANGED
@@ -14,29 +14,37 @@
14
14
  with natural language, and deploy to the cloud — all from one CLI.
15
15
  </p>
16
16
 
17
+ <p align="center">
18
+ <strong>🚀 Scaffold • 🤖 Generate • ☁️ Deploy</strong>
19
+ </p>
20
+
17
21
  <p align="center">
18
22
  <a href="https://www.npmjs.com/package/@crossdelta/platform-sdk"><img src="https://img.shields.io/npm/v/@crossdelta/platform-sdk.svg?style=flat-square" alt="npm version" /></a>
23
+ <a href="https://www.npmjs.com/package/@crossdelta/platform-sdk"><img src="https://img.shields.io/npm/dm/@crossdelta/platform-sdk?style=flat-square" alt="Downloads" /></a>
24
+ <img src="https://img.shields.io/bundlephobia/min/@crossdelta/platform-sdk?style=flat-square&label=size" alt="Package size" />
19
25
  <img src="https://img.shields.io/badge/bun-%E2%9A%A1-f9f1e1?style=flat-square" alt="Bun" />
20
26
  <img src="https://img.shields.io/badge/pulumi-ready-blueviolet?style=flat-square" alt="Pulumi" />
21
27
  <img src="https://img.shields.io/badge/DigitalOcean-App_Platform_|_DOKS-0080FF?style=flat-square" alt="DigitalOcean" />
22
28
  </p>
23
29
 
30
+ <br />
31
+
24
32
  ---
25
33
 
26
- ## 👤 Who is this for?
34
+ ## Who is this for?
27
35
 
28
36
  - You run **multiple microservices** and want a unified developer experience
29
37
  - You prefer **monorepos + Infrastructure-as-Code** as your architectural baseline
30
38
  - You're okay with **DigitalOcean as the initial cloud provider** (AWS/GCP coming soon)
31
39
 
32
- ---
33
-
34
40
  > ⚠️ **Cloud Provider Support:** Currently only **DigitalOcean** is supported:
35
41
  > - **App Platform** — Managed PaaS for simple deployments
36
42
  > - **DOKS (Kubernetes)** — Full Kubernetes control for production workloads
37
43
  >
38
44
  > **AWS and GCP support** is planned for future releases.
39
45
 
46
+ <br />
47
+
40
48
  ---
41
49
 
42
50
  ## ✨ Features
@@ -54,18 +62,24 @@
54
62
  | 🔌 **Auto Port Assignment** | Unique ports per service |
55
63
  | 🔁 **Smart Watch Mode** | Watches infra & services, regenerates env, reinstalls deps |
56
64
 
65
+ <br />
66
+
57
67
  ---
58
68
 
59
69
  ## 🚀 Quick Start
60
70
 
71
+ > 💡 **Get started in under 2 minutes**
72
+
61
73
  ### 1. Create a new workspace
62
74
 
63
75
  ```bash
76
+ # Install globally
64
77
  npm install -g @crossdelta/platform-sdk
65
78
  pf new workspace my-platform
66
79
 
67
- # Or with bunx:
68
- bunx @crossdelta/platform-sdk pf new workspace my-platform
80
+ # Or use directly with npx/bunx (no installation required)
81
+ npx @crossdelta/platform-sdk new workspace my-platform
82
+ bunx @crossdelta/platform-sdk new workspace my-platform
69
83
  ```
70
84
 
71
85
  **Options:**
@@ -77,30 +91,45 @@ bunx @crossdelta/platform-sdk pf new workspace my-platform
77
91
  | `-s, --pulumi-stack <name>` | Pulumi stack base name |
78
92
  | `--no-github` | Skip GitHub Actions workflows |
79
93
 
80
- ---
81
-
82
94
  ### 2. Generate microservices
83
95
 
96
+ **Manual scaffolding:**
84
97
  ```bash
85
98
  pf new hono-micro services/orders
86
99
  pf new nest-micro services/api-gateway
87
100
  ```
88
101
 
89
- With AI:
90
-
102
+ **AI-powered generation:**
91
103
  ```bash
92
- pf new hono-micro services/payments --ai -d "Handle payment webhooks"
104
+ # First time: configure AI provider (OpenAI or Anthropic)
93
105
  pf setup --ai
106
+
107
+ # Generate service with AI
108
+ pf new hono-micro services/payments --ai \
109
+ -d "Handle Stripe webhooks and send payment confirmations"
94
110
  ```
95
111
 
96
- ---
112
+ **✨ AI generates:**
113
+ - ✅ Complete service with event handlers & use cases
114
+ - ✅ Pulumi infrastructure configuration
115
+ - ✅ Test files with validation logic
116
+ - ✅ Complete README documentation
97
117
 
98
118
  ### 3. Start local development
99
119
 
100
120
  ```bash
121
+ cd my-platform
101
122
  pf dev
102
123
  ```
103
124
 
125
+ This will:
126
+ - 🔄 Auto-generate `.env.local` from infrastructure config
127
+ - 🚀 Start all services in watch mode
128
+ - 🔌 Auto-assign unique ports per service
129
+ - 📦 Install dependencies when `package.json` changes
130
+
131
+ <br />
132
+
104
133
  ---
105
134
 
106
135
  ## 📁 Workspace Structure
@@ -123,18 +152,90 @@ my-platform/
123
152
  └── biome.json
124
153
  ```
125
154
 
155
+ <br />
156
+
157
+ ---
158
+
159
+ ## ⚡ Event-Driven Architecture
160
+
161
+ Built on **CloudEvents** and **NATS JetStream** using **[`@crossdelta/cloudevents`](https://github.com/orderboss/platform/tree/main/packages/cloudevents)**:
162
+
163
+ - 🎯 **Type-safe event handlers** with Zod schemas
164
+ - 🔄 **Auto-discovery** of event handlers (`*.event.ts` files)
165
+ - 📦 **Publisher/Consumer patterns** out of the box
166
+ - 🚀 **Production-ready** NATS JetStream integration
167
+
168
+ **Publish events:**
169
+ ```typescript
170
+ import { publish } from '@crossdelta/cloudevents'
171
+
172
+ await publish('orders.created', { orderId: 'ord_123', total: 99.99 })
173
+ ```
174
+
175
+ **Consume events (auto-discovered):**
176
+ ```typescript
177
+ // services/notifications/src/handlers/order-created.event.ts
178
+ import { handleEvent } from '@crossdelta/cloudevents'
179
+ import { z } from 'zod'
180
+
181
+ const OrderCreatedSchema = z.object({
182
+ type: z.literal('orders.created'),
183
+ orderId: z.string(),
184
+ total: z.number(),
185
+ })
186
+
187
+ export default handleEvent(OrderCreatedSchema, async (data) => {
188
+ await sendNotification(data)
189
+ })
190
+ ```
191
+
192
+ <br />
193
+
126
194
  ---
127
195
 
128
196
  ## 🛠 CLI Commands
129
197
 
198
+ <details>
199
+ <summary><strong>📖 View Full Command Reference</strong></summary>
200
+
201
+ <br />
202
+
203
+ ### Workspace Commands
204
+
205
+ | Command | Description |
206
+ |---------|-------------|
207
+ | `pf new` | Interactive creation wizard |
208
+ | `pf new workspace <name>` | Scaffold a complete platform monorepo |
209
+ | `pf setup --ai` | Configure AI provider (OpenAI or Anthropic) |
210
+ | `pf dev [options]` | Start development environment with hot reload |
211
+
212
+ ### Service Commands
213
+
214
+ | Command | Description |
215
+ |---------|-------------|
216
+ | `pf new hono-micro <path>` | Generate a Hono microservice (lightweight) |
217
+ | `pf new nest-micro <path>` | Generate a NestJS microservice (enterprise-grade) |
218
+ | `pf new hono-micro <path> --ai` | Generate service with AI (requires `pf setup --ai`) |
219
+
220
+ ### Code Generation
221
+
222
+ | Command | Description |
223
+ |---------|-------------|
224
+ | `pf generate event-handler <name>` | Generate an event handler |
225
+ | `pf generate use-case <name>` | Generate a use case |
226
+ | `pf event:list` | List all available event mocks |
227
+ | `pf event:send <name>` | Send a test event to NATS |
228
+
229
+ ### Utility Commands
230
+
130
231
  | Command | Description |
131
232
  |---------|-------------|
132
- | `pf new` | Interactive creation |
133
- | `pf new workspace <name>` | Scaffold a complete platform |
134
- | `pf new hono-micro <path>` | Generate a Hono microservice |
135
- | `pf new nest-micro <path>` | Generate a NestJS microservice |
136
- | `pf setup --ai` | Configure AI provider |
137
- | `pf dev` | Start dev environment |
233
+ | `pf --version` | Show version information |
234
+ | `pf --help` | Show help for any command |
235
+
236
+ </details>
237
+
238
+ <br />
138
239
 
139
240
  ---
140
241
 
@@ -155,6 +256,8 @@ export const config: K8sServiceConfig = {
155
256
  }
156
257
  ```
157
258
 
259
+ <br />
260
+
158
261
  ---
159
262
 
160
263
  ## 🚢 Deployment
@@ -170,6 +273,8 @@ GitHub Secrets:
170
273
  - `DIGITALOCEAN_TOKEN`
171
274
  - `NPM_TOKEN` (optional)
172
275
 
276
+ <br />
277
+
173
278
  ---
174
279
 
175
280
  ## 📚 Requirements
@@ -179,6 +284,7 @@ GitHub Secrets:
179
284
  - Pulumi CLI
180
285
  - Docker (for local Supabase/NATS)
181
286
 
287
+
182
288
  ---
183
289
 
184
290
  ## 📄 License