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