@crossdelta/platform-sdk 0.3.20 β†’ 0.3.22

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 +128 -159
  2. package/bin/cli.js +164 -302
  3. package/package.json +16 -5
  4. package/logo.png +0 -0
package/README.md CHANGED
@@ -9,29 +9,41 @@
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <strong>Agentic CLI for event-driven microservice platforms</strong>
12
+ <strong>Your AI-powered platform engineer.</strong><br />
13
+ Scaffold complete Turborepo workspaces, generate production-ready microservices<br />
14
+ with natural language, and deploy to the cloud β€” all from one CLI.
15
+ </p>
16
+
17
+ <p align="center">
18
+ <strong>πŸš€ Scaffold β€’ πŸ€– Generate β€’ ☁️ Deploy</strong>
13
19
  </p>
14
20
 
15
21
  <p align="center">
16
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" />
17
25
  <img src="https://img.shields.io/badge/bun-%E2%9A%A1-f9f1e1?style=flat-square" alt="Bun" />
18
26
  <img src="https://img.shields.io/badge/pulumi-ready-blueviolet?style=flat-square" alt="Pulumi" />
19
27
  <img src="https://img.shields.io/badge/DigitalOcean-App_Platform_|_DOKS-0080FF?style=flat-square" alt="DigitalOcean" />
20
28
  </p>
21
29
 
22
- <p align="center">
23
- Your AI-powered platform engineer. Scaffold complete Turborepo workspaces,<br />
24
- generate production-ready microservices with natural language,<br />
25
- and deploy to the cloud β€” all from one CLI.
26
- </p>
30
+ <br />
27
31
 
28
32
  ---
29
33
 
34
+ ## Who is this for?
35
+
36
+ - You run **multiple microservices** and want a unified developer experience
37
+ - You prefer **monorepos + Infrastructure-as-Code** as your architectural baseline
38
+ - You're okay with **DigitalOcean as the initial cloud provider** (AWS/GCP coming soon)
39
+
30
40
  > ⚠️ **Cloud Provider Support:** Currently only **DigitalOcean** is supported:
31
41
  > - **App Platform** β€” Managed PaaS for simple deployments
32
42
  > - **DOKS (Kubernetes)** β€” Full Kubernetes control for production workloads
33
43
  >
34
- > AWS and GCP support is planned for future releases.
44
+ > **AWS and GCP support** is planned for future releases.
45
+
46
+ <br />
35
47
 
36
48
  ---
37
49
 
@@ -43,152 +55,156 @@
43
55
  | πŸ€– **AI-Powered Generation** | Generate services with AI using `--ai` flag (OpenAI/Anthropic) |
44
56
  | πŸ₯Ÿ **Bun-first DX** | Ultra-fast dev workflow with fallback to npm/yarn/pnpm |
45
57
  | πŸ—οΈ **Turborepo Monorepo** | Parallel builds, caching, and unified dev scripts |
46
- | πŸ”§ **Service Generators** | [Hono](https://hono.dev/) (lightweight) and [NestJS](https://nestjs.com/) (enterprise-grade) templates |
47
- | πŸ“¦ **Pulumi-Ready Infra** | Infrastructure-as-Code for DigitalOcean (App Platform or DOKS) |
58
+ | πŸ”§ **Service Generators** | Hono (lightweight) and NestJS (enterprise-grade) templates |
59
+ | πŸ“¦ **Pulumi-Ready Infra** | Infrastructure-as-Code for DigitalOcean |
48
60
  | πŸš€ **GitHub Actions CI/CD** | Pre-configured workflows for build, test, deploy, and npm publish |
49
61
  | 🌍 **Auto `.env.local`** | Environment variables derived from `infra/services/*.ts` |
50
- | πŸ”Œ **Auto Port Assignment** | Unique ports per service, zero manual config |
62
+ | πŸ”Œ **Auto Port Assignment** | Unique ports per service |
51
63
  | πŸ” **Smart Watch Mode** | Watches infra & services, regenerates env, reinstalls deps |
52
64
 
65
+ <br />
66
+
53
67
  ---
54
68
 
55
69
  ## πŸš€ Quick Start
56
70
 
71
+ > πŸ’‘ **Get started in under 2 minutes**
72
+
57
73
  ### 1. Create a new workspace
58
74
 
59
75
  ```bash
60
- # Install globally (recommended)
76
+ # Install globally
61
77
  npm install -g @crossdelta/platform-sdk
62
78
  pf new workspace my-platform
63
79
 
64
- # Or use bunx (no install needed)
65
- bunx @crossdelta/platform-sdk pf new workspace my-platform
66
- ```
67
-
68
- **With options:**
69
- ```bash
70
- pf new workspace my-platform -y # Skip prompts
71
- pf new workspace my-platform -o my-github-org # Set GitHub owner
72
- pf new workspace my-platform --no-github # Without CI/CD
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
73
83
  ```
74
84
 
75
85
  **Options:**
76
86
 
77
87
  | Flag | Description |
78
88
  |------|-------------|
79
- | `-y, --yes` | Skip prompts, use defaults |
89
+ | `-y, --yes` | Skip prompts |
80
90
  | `-o, --github-owner <owner>` | GitHub org/user for GHCR registry |
81
- | `-s, --pulumi-stack <name>` | Pulumi stack base name (org/project) |
91
+ | `-s, --pulumi-stack <name>` | Pulumi stack base name |
82
92
  | `--no-github` | Skip GitHub Actions workflows |
83
93
 
84
- > πŸ’‘ **Two ways to use the CLI:**
85
- > - **Global install** (recommended): `npm install -g @crossdelta/platform-sdk` β†’ use `pf` command
86
- > - **Bunx** (no install): `bunx @crossdelta/platform-sdk pf <command>`
87
-
88
- ---
89
-
90
94
  ### 2. Generate microservices
91
95
 
96
+ **Manual scaffolding:**
92
97
  ```bash
93
- pf new hono-micro services/orders # Lightweight Hono service
94
- pf new nest-micro services/api-gateway # Enterprise NestJS service
98
+ pf new hono-micro services/orders
99
+ pf new nest-micro services/api-gateway
95
100
  ```
96
101
 
97
- Both generators:
98
- - Auto-assign unique ports
99
- - Create Pulumi service config in `infra/services/`
100
- - Add Dockerfile for containerized deployment
101
- - Wire up health checks
102
-
103
- #### πŸ€– AI-Powered Generation
104
-
105
- Generate services with AI assistance:
106
-
102
+ **AI-powered generation:**
107
103
  ```bash
108
- # One-liner with description
109
- pf new hono-micro services/payments --ai -d "Handle payment webhooks and process transactions"
110
-
111
- # Interactive mode (prompts for description)
112
- pf new hono-micro services/notifications --ai
113
- ```
114
-
115
- First-time setup:
104
+ # First time: configure AI provider (OpenAI or Anthropic)
105
+ pf setup --ai
116
106
 
117
- ```bash
118
- pf setup --ai # Configure OpenAI or Anthropic API key
107
+ # Generate service with AI
108
+ pf new hono-micro services/payments --ai \
109
+ -d "Handle Stripe webhooks and send payment confirmations"
119
110
  ```
120
111
 
121
- The AI reads your project's `copilot-instructions.md` and generates code following your conventions.
122
-
123
- ---
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
124
117
 
125
118
  ### 3. Start local development
126
119
 
127
120
  ```bash
121
+ cd my-platform
128
122
  pf dev
129
123
  ```
130
124
 
131
- What happens:
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
132
130
 
133
- 1. `.env.local` is generated from all `infra/services/*.ts` configs
134
- 2. Services are started in parallel via Turborepo
135
- 3. **Watching:**
136
- - `infra/services/` β†’ regenerate env + restart
137
- - `services/` and `apps/` β†’ detect new/deleted packages and reinstall deps
131
+ <br />
138
132
 
139
133
  ---
140
134
 
141
- ## πŸ“ Generated Workspace Structure
135
+ ## πŸ“ Workspace Structure
142
136
 
143
137
  ```
144
138
  my-platform/
145
139
  β”œβ”€β”€ .github/
146
140
  β”‚ β”œβ”€β”€ workflows/
147
- β”‚ β”‚ β”œβ”€β”€ lint-and-tests.yml # PR checks
148
- β”‚ β”‚ β”œβ”€β”€ build-and-deploy.yml # Build & deploy on push to main
149
- β”‚ β”‚ └── publish-packages.yml # Publish npm packages
150
141
  β”‚ └── actions/
151
- β”‚ β”œβ”€β”€ setup-bun-install/ # Cached Bun setup
152
- β”‚ β”œβ”€β”€ generate-scope-matrix/ # Dynamic service detection
153
- β”‚ β”œβ”€β”€ check-image-tag-exists/ # Skip unchanged builds
154
- β”‚ └── ... # More reusable actions
155
142
  β”œβ”€β”€ infra/
156
- β”‚ β”œβ”€β”€ index.ts # Pulumi entry point
157
- β”‚ β”œβ”€β”€ services/ # Service configs (auto-discovered)
158
- β”‚ β”œβ”€β”€ Pulumi.yaml # Project config
159
- β”‚ └── Pulumi.dev.yaml # Dev stack config
160
- β”œβ”€β”€ services/ # Microservices
161
- β”œβ”€β”€ apps/ # Frontend apps
162
- β”œβ”€β”€ packages/ # Shared packages
163
- β”œβ”€β”€ package.json # Root workspace config
164
- β”œβ”€β”€ turbo.json # Turborepo config
165
- └── biome.json # Linting config
143
+ β”‚ β”œβ”€β”€ index.ts
144
+ β”‚ β”œβ”€β”€ services/
145
+ β”‚ β”œβ”€β”€ Pulumi.yaml
146
+ β”‚ └── Pulumi.dev.yaml
147
+ β”œβ”€β”€ services/
148
+ β”œβ”€β”€ apps/
149
+ β”œβ”€β”€ packages/
150
+ β”œβ”€β”€ package.json
151
+ β”œβ”€β”€ turbo.json
152
+ └── biome.json
166
153
  ```
167
154
 
155
+ <br />
156
+
168
157
  ---
169
158
 
170
159
  ## πŸ›  CLI Commands
171
160
 
161
+ <details>
162
+ <summary><strong>πŸ“– View Full Command Reference</strong></summary>
163
+
164
+ <br />
165
+
166
+ ### Workspace Commands
167
+
172
168
  | Command | Description |
173
169
  |---------|-------------|
174
- | `pf new` | Interactive mode - choose project type and options |
175
- | `pf new workspace <name>` | Scaffold a complete platform workspace |
176
- | `pf new hono-micro <path>` | Generate a lightweight Hono microservice |
177
- | `pf new nest-micro <path>` | Generate a NestJS microservice |
178
- | `pf new hono-micro <path> --ai -d "..."` | Generate with AI assistance |
179
- | `pf setup --ai` | Configure AI provider (OpenAI/Anthropic) |
180
- | `pf dev` | Start dev environment with watch mode |
181
- | `pf dev --no-watch` | Start without file watching |
182
- | `pf generate <schematic> <name>` | Generate code using schematics |
170
+ | `pf new` | Interactive creation wizard |
171
+ | `pf new workspace <name>` | Scaffold a complete platform monorepo |
172
+ | `pf setup --ai` | Configure AI provider (OpenAI or Anthropic) |
173
+ | `pf dev [options]` | Start development environment with hot reload |
183
174
 
184
- ---
175
+ ### Service Commands
176
+
177
+ | Command | Description |
178
+ |---------|-------------|
179
+ | `pf new hono-micro <path>` | Generate a Hono microservice (lightweight) |
180
+ | `pf new nest-micro <path>` | Generate a NestJS microservice (enterprise-grade) |
181
+ | `pf new hono-micro <path> --ai` | Generate service with AI (requires `pf setup --ai`) |
182
+
183
+ ### Code Generation
184
+
185
+ | Command | Description |
186
+ |---------|-------------|
187
+ | `pf generate event-handler <name>` | Generate an event handler |
188
+ | `pf generate use-case <name>` | Generate a use case |
189
+ | `pf event:list` | List all available event mocks |
190
+ | `pf event:send <name>` | Send a test event to NATS |
191
+
192
+ ### Utility Commands
193
+
194
+ | Command | Description |
195
+ |---------|-------------|
196
+ | `pf --version` | Show version information |
197
+ | `pf --help` | Show help for any command |
198
+
199
+ </details>
200
+
201
+ <br />
185
202
 
186
- ## πŸ”§ Configuration
203
+ ---
187
204
 
188
- ### Service Config Example
205
+ ## πŸ”§ Configuration Example
189
206
 
190
207
  ```ts
191
- // infra/services/orders.ts
192
208
  import type { K8sServiceConfig } from '@crossdelta/infrastructure'
193
209
 
194
210
  export const config: K8sServiceConfig = {
@@ -196,10 +212,6 @@ export const config: K8sServiceConfig = {
196
212
  containerPort: 4001,
197
213
  replicas: 1,
198
214
  healthCheck: { port: 4001 },
199
- resources: {
200
- requests: { cpu: '50m', memory: '64Mi' },
201
- limits: { cpu: '150m', memory: '128Mi' },
202
- },
203
215
  env: {
204
216
  DATABASE_URL: databaseUrl,
205
217
  NATS_URL: natsUrl,
@@ -207,93 +219,50 @@ export const config: K8sServiceConfig = {
207
219
  }
208
220
  ```
209
221
 
210
- Running `pf dev` generates:
211
-
212
- ```env
213
- # .env.local
214
- DATABASE_URL=postgres://...
215
- NATS_URL=nats://localhost:4222
216
- ORDERS_PORT=4001
217
- ```
222
+ <br />
218
223
 
219
224
  ---
220
225
 
221
- ## 🚒 Deployment (DigitalOcean)
222
-
223
- ### Prerequisites
224
-
225
- 1. **Pulumi Account** – [Sign up free](https://app.pulumi.com/signup)
226
- 2. **DigitalOcean Account** – [Create account](https://cloud.digitalocean.com/registrations/new)
227
- 3. **GitHub Repository** – For CI/CD workflows
228
-
229
- ### GitHub Secrets
230
-
231
- | Secret | Description |
232
- |--------|-------------|
233
- | `PULUMI_ACCESS_TOKEN` | Pulumi Cloud access token |
234
- | `DIGITALOCEAN_TOKEN` | DigitalOcean API token |
235
- | `NPM_TOKEN` | (optional) For private npm packages |
236
-
237
- ### Deploy
226
+ ## 🚒 Deployment
238
227
 
239
228
  ```bash
240
229
  pulumi login
241
230
  pulumi up --stack dev
242
231
  ```
243
232
 
244
- ---
233
+ GitHub Secrets:
245
234
 
246
- ## When to use this
235
+ - `PULUMI_ACCESS_TOKEN`
236
+ - `DIGITALOCEAN_TOKEN`
237
+ - `NPM_TOKEN` (optional)
247
238
 
248
- - βœ… **Bun-first microservice platform** with minimal boilerplate
249
- - βœ… **Turborepo + Pulumi** as architectural baseline
250
- - βœ… Fast **Hono/NestJS service scaffolding**
251
- - βœ… **Unified dev workflow** for multiple services
252
- - βœ… Deploy to **DigitalOcean App Platform**
253
- - βœ… **GitHub Actions** for CI/CD
254
-
255
- ---
256
-
257
- ## ❌ When NOT to use this
258
-
259
- - ❌ You need AWS, GCP, or other cloud providers (coming soon)
260
- - ❌ You need a hosted PaaS (Render, Fly.io, Netlify)
261
- - ❌ You are not using a monorepo
262
- - ❌ You don't use Infrastructure-as-Code
239
+ <br />
263
240
 
264
241
  ---
265
242
 
266
243
  ## πŸ“š Requirements
267
244
 
268
- | Requirement | Version |
269
- |-------------|---------|
270
- | Node.js | β‰₯ 21 |
271
- | Bun | Latest (recommended) |
272
- | Pulumi CLI | Latest |
273
- | Docker | For local Supabase/NATS |
274
-
275
- ---
245
+ - Node.js β‰₯ 21
246
+ - Bun (latest)
247
+ - Pulumi CLI
248
+ - Docker (for local Supabase/NATS)
276
249
 
277
- ## πŸ”— Related Packages
278
-
279
- | Package | Description |
280
- |---------|-------------|
281
- | [@crossdelta/infrastructure](https://www.npmjs.com/package/@crossdelta/infrastructure) | Pulumi helpers for DigitalOcean |
282
- | [@crossdelta/cloudevents](https://www.npmjs.com/package/@crossdelta/cloudevents) | CloudEvents + NATS toolkit |
283
- | [@crossdelta/telemetry](https://www.npmjs.com/package/@crossdelta/telemetry) | Zero-config OpenTelemetry |
250
+ <br />
284
251
 
285
252
  ---
286
253
 
287
- ## πŸ—ΊοΈ Roadmap
254
+ ## οΏ½ Community & Support
255
+
256
+ - πŸ“– [Full Documentation](https://github.com/orderboss/platform/tree/main/packages/platform-sdk/docs)
257
+ - πŸ› [Report Issues](https://github.com/orderboss/platform/issues)
258
+ - πŸ’‘ [Feature Requests](https://github.com/orderboss/platform/discussions)
259
+ - πŸ“¦ [npm Package](https://www.npmjs.com/package/@crossdelta/platform-sdk)
260
+ - ⭐ [Star on GitHub](https://github.com/orderboss/platform)
288
261
 
289
- - [x] AI-powered service generation (OpenAI/Anthropic)
290
- - [ ] AWS ECS/Fargate provider
291
- - [ ] GCP Cloud Run provider
292
- - [ ] Kubernetes (generic) provider
293
- - [ ] `pf migrate` command for database migrations
262
+ <br />
294
263
 
295
264
  ---
296
265
 
297
- ## πŸ“„ License
266
+ ## οΏ½πŸ“„ License
298
267
 
299
- MIT Β© [Crossdelta](https://github.com/crossdelta)
268
+ MIT Β© Crossdelta