@crossdelta/platform-sdk 0.7.22 → 0.8.0

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.
package/README.md CHANGED
@@ -11,7 +11,12 @@
11
11
  <p align="center">
12
12
  <strong>Opinionated platform toolkit for event-driven microservices.</strong><br />
13
13
  Scaffold <a href="https://turbo.build/repo">Turborepo</a> workspaces, generate services from natural language,<br />
14
- and deploy via <a href="https://www.pulumi.com">Pulumi</a> — DigitalOcean-first, provider-agnostic by design.
14
+ and deploy via <a href="https://www.pulumi.com">Pulumi</a> — DigitalOcean-first for speed and simplicity, providers replaceable by design.
15
+ </p>
16
+
17
+ <p align="center">
18
+ <em>Platform SDK (<code>pf</code>) is a platform opinion, not a generator.<br />
19
+ It encodes architectural decisions so teams don't have to rediscover them.</em>
15
20
  </p>
16
21
 
17
22
  <p align="center">
@@ -26,11 +31,23 @@
26
31
  </p>
27
32
 
28
33
  <p align="center">
29
- <em><code>pf</code> enforces conventions that keep application code and cloud infrastructure in lockstep — from local development to production.</em>
34
+ <img src="https://img.shields.io/badge/Hono-E36002?style=flat-square&logo=hono&logoColor=white" alt="Hono" />
35
+ <img src="https://img.shields.io/badge/NestJS-E0234E?style=flat-square&logo=nestjs&logoColor=white" alt="NestJS" />
36
+ <img src="https://img.shields.io/badge/NATS-27AAE1?style=flat-square&logo=natsdotio&logoColor=white" alt="NATS" />
30
37
  </p>
31
38
 
32
39
  ---
33
40
 
41
+ ## Who is this for?
42
+
43
+ - **Teams building event-driven backends** — NATS, CloudEvents, type-safe contracts
44
+ - **Startups & internal platforms** that want long-term consistency over short-term speed
45
+ - **Engineers tired of infra & app drift** — ports, env vars, deployments always in sync
46
+
47
+ You can start without understanding all the pieces. The depth reveals itself as you grow.
48
+
49
+ ---
50
+
34
51
  ## Installation
35
52
 
36
53
  ```bash
@@ -73,6 +90,32 @@ pf dev
73
90
 
74
91
  ---
75
92
 
93
+ ## Day 1 with pf
94
+
95
+ **5 minutes to your first event-driven system:**
96
+
97
+ ```bash
98
+ # 1. Create a new platform
99
+ pf new workspace my-platform -y && cd my-platform
100
+
101
+ # 2. Add two services
102
+ pf new hono-micro services/orders
103
+ pf new hono-micro services/notifications
104
+
105
+ # 3. Wire an event between them
106
+ pf event add orders.created --service services/notifications
107
+
108
+ # 4. Start everything
109
+ pf dev
110
+
111
+ # 5. Publish a test event — watch notifications react
112
+ pf event publish orders.created
113
+ ```
114
+
115
+ That's it. Two services, one event contract, auto-discovered handlers, no manual wiring.
116
+
117
+ ---
118
+
76
119
  ## 🧭 How You Work With pf (Happy Paths)
77
120
 
78
121
  ### Start a new platform
@@ -87,11 +130,17 @@ This scaffolds a complete Turborepo monorepo with NATS, Pulumi infrastructure, G
87
130
 
88
131
  ### Add a new microservice
89
132
 
133
+ **Hono** (lightweight, Bun-optimized):
90
134
  ```bash
91
135
  pf new hono-micro services/orders
92
136
  ```
93
137
 
94
- Or use AI generation:
138
+ **NestJS** (full-featured, decorator-based):
139
+ ```bash
140
+ pf new nest-micro services/orders
141
+ ```
142
+
143
+ Or use AI generation with either:
95
144
 
96
145
  ```bash
97
146
  pf new hono-micro services/orders --ai -d "Handle order creation and publish order events"
@@ -125,6 +174,11 @@ AI is a productivity layer — all generated code follows the same conventions a
125
174
  | `pf test` | Run tests across the monorepo |
126
175
  | `pf lint` | Lint and format with Biome |
127
176
  | `pf build` | Build all packages and services |
177
+ | `pf new hono-micro <path>` | Create Hono microservice (lightweight) |
178
+ | `pf new nest-micro <path>` | Create NestJS microservice (full-featured) |
179
+ | `pf event add <type> --service <path>` | Add contract, mock, handler + wire stream |
180
+ | `pf event list` | List available events and their consumers |
181
+ | `pf event publish <type>` | Publish mock event to NATS |
128
182
  | `pf pulumi up` | Deploy infrastructure (runs in `infra/`) |
129
183
 
130
184
  `pf` proxies to Turborepo from any subdirectory.
@@ -192,7 +246,7 @@ See [@crossdelta/infrastructure](https://www.npmjs.com/package/@crossdelta/infra
192
246
 
193
247
  **Solution:** Services auto-generate `infra/services/*.ts`, ports/env derived automatically, event handlers type-safe and auto-discovered.
194
248
 
195
- In short: docker-compose starts services — `pf` prevents systems from drifting apart over time.
249
+ **In short: docker-compose starts services — `pf` prevents systems from drifting apart over time.**
196
250
 
197
251
  ---
198
252
 
@@ -203,11 +257,11 @@ In short: docker-compose starts services — `pf` prevents systems from drifting
203
257
  - Turborepo scaffolder with Pulumi IaC and NATS messaging built-in
204
258
  - AI-assisted code generator from natural language descriptions
205
259
  - Unified dev workflow — one command to run everything
206
- - DigitalOcean-first deployment target
260
+ - DigitalOcean-first for speed and simplicity — providers replaceable by design
207
261
 
208
262
  **❌ pf is not:**
209
263
  - Generic microservice generator — makes architectural choices for you
210
- - Multi-cloud (not yet) — DigitalOcean first, extensible architecture
264
+ - Multi-cloud out of the box — DigitalOcean first, extensible to other providers
211
265
  - Runtime manager — scaffolds code, you deploy with Pulumi
212
266
 
213
267
  **Note:** `pf` runs nothing implicitly. No hidden daemons, no automatic deployments. You control when code runs and infrastructure deploys.
@@ -249,6 +303,26 @@ my-platform/
249
303
 
250
304
  ### Event-Driven Pattern
251
305
 
306
+ **Add events with one command:**
307
+ ```bash
308
+ # Creates contract, mock, handler, and wires the stream automatically
309
+ pf event add orders.created --service services/notifications
310
+ ```
311
+
312
+ This generates:
313
+ - `packages/contracts/src/events/orders-created.ts` (contract)
314
+ - `packages/contracts/src/events/orders-created.mock.json` (test data)
315
+ - `services/notifications/src/events/orders-created.event.ts` (handler)
316
+ - Adds stream to service `index.ts` if needed
317
+
318
+ **Test events locally:**
319
+ ```bash
320
+ pf event list # Show available events
321
+ pf event publish orders.created # Publish mock event to NATS
322
+ ```
323
+
324
+ **Manual pattern (if you prefer):**
325
+
252
326
  **1. Define contract:**
253
327
  ```typescript
254
328
  // packages/contracts/src/events/orders-created.ts
@@ -313,6 +387,7 @@ pulumi login && pulumi up --stack dev
313
387
  | `PULUMI_ACCESS_TOKEN` | [Pulumi Cloud token](https://app.pulumi.com/account/tokens) |
314
388
  | `DIGITALOCEAN_TOKEN` | [DO API token](https://cloud.digitalocean.com/account/api/tokens) |
315
389
  | `GHCR_TOKEN` | GitHub Container Registry PAT |
390
+ | `NPM_TOKEN` | [npm access token](https://www.npmjs.com/settings/~/tokens) (only for `publish-packages.yml`) |
316
391
 
317
392
  </details>
318
393