@crossdelta/platform-sdk 0.2.30 β 0.2.31
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 +131 -83
- package/bin/cli.js +118 -118
- package/bin/templates/workspace/infra/scripts/generate-env.ts.hbs +83 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,140 +1,188 @@
|
|
|
1
|
-
# @crossdelta/platform-sdk
|
|
2
1
|
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
# @crossdelta/platform-sdk
|
|
3
|
+
**Bun-first CLI toolkit for building event-driven microservice platforms.**
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
Spin up a complete Turborepo workspace with [Pulumi](https://www.pulumi.com/) infrastructure, ready-to-run [Hono](https://hono.dev/) / [NestJS](https://nestjs.com/) microservices, automatic env generation, and a unified development workflow β all from a single CLI.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
> Stop wiring Turborepo, Pulumi, ports, env files & service scripts by hand.
|
|
8
|
+
> Build a production-ready microservice platform in under a minute.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
---
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
- π₯ **[Bun](https://bun.sh)-first** - Optimized for Bun runtime with npm/yarn/pnpm fallback
|
|
14
|
-
- ποΈ **[Turborepo](https://turbo.build) Workspaces** - Monorepo setup with parallel builds and caching
|
|
15
|
-
- π§ **Microservice Templates** - [Hono](https://hono.dev) (lightweight) & [NestJS](https://nestjs.com) (enterprise-grade)
|
|
16
|
-
- π¦ **[Pulumi](https://www.pulumi.com) Ready** - Infrastructure-as-Code out of the box
|
|
17
|
-
- π **Auto Port Assignment** - Unique ports per service, no manual configuration
|
|
18
|
-
- π **Env Generation** - `.env.local` auto-generated from `infra/services/*.ts` configs
|
|
12
|
+
## β¨ Features
|
|
19
13
|
|
|
20
|
-
|
|
14
|
+
- β‘ **Instant Scaffolding** β Create fully wired platform workspaces with best practices baked in
|
|
15
|
+
- π₯ **Bun-first DX** β Ultra-fast dev workflow with fallback to npm/yarn/pnpm
|
|
16
|
+
- ποΈ **Turborepo Monorepo** β Parallel builds, caching, and unified dev scripts
|
|
17
|
+
- π§ **Service Generators** β [Hono](https://hono.dev/) (lightweight) and [NestJS](https://nestjs.com/) (enterprise-grade) templates
|
|
18
|
+
- π¦ **Pulumi-Ready Infra** β Infrastructure-as-Code via [Pulumi](https://www.pulumi.com/)
|
|
19
|
+
- π **Automatic `.env.local` Generation** β Derived from `infra/services/*.ts`
|
|
20
|
+
- π **Auto Port Assignment** β Unique ports per service, zero manual config
|
|
21
|
+
- π **Smart Watch Mode** β Watches infra & services, regenerates env, reinstalls deps when needed
|
|
21
22
|
|
|
22
|
-
|
|
23
|
-
npm install -g @crossdelta/platform-sdk
|
|
23
|
+
---
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
bun add -g @crossdelta/platform-sdk
|
|
27
|
-
```
|
|
25
|
+
## π Quick Start
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
### 1. Create a new workspace
|
|
30
28
|
|
|
31
29
|
```bash
|
|
32
|
-
# Create a new workspace with infrastructure
|
|
33
30
|
npx @crossdelta/platform-sdk new workspace my-platform
|
|
34
31
|
cd my-platform
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
> π‘ `pf` is the CLI binary shipped with this package.
|
|
35
|
+
> It automatically works through `npx` β no global install required.
|
|
36
|
+
|
|
37
|
+
---
|
|
35
38
|
|
|
36
|
-
|
|
39
|
+
### 2. Generate microservices
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Hono microservice
|
|
37
43
|
pf new hono-micro services/orders
|
|
38
44
|
|
|
39
|
-
#
|
|
45
|
+
# NestJS microservice
|
|
40
46
|
pf new nest-micro services/api-gateway
|
|
47
|
+
```
|
|
41
48
|
|
|
42
|
-
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### 3. Start local development
|
|
52
|
+
|
|
53
|
+
```bash
|
|
43
54
|
pf dev
|
|
44
55
|
```
|
|
45
56
|
|
|
46
|
-
|
|
57
|
+
What happens:
|
|
47
58
|
|
|
48
|
-
|
|
59
|
+
- `.env.local` is generated from all `infra/services/*.ts` configs
|
|
60
|
+
- Services are started in parallel via Turborepo
|
|
61
|
+
- Watching:
|
|
62
|
+
- `infra/services/` β regenerate env + restart
|
|
63
|
+
- `services/` and `apps/` β detect new/deleted packages and reinstall deps
|
|
49
64
|
|
|
50
|
-
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## π§ Example: Automatic env generation
|
|
68
|
+
|
|
69
|
+
```ts
|
|
70
|
+
// infra/services/orders.ts
|
|
71
|
+
import type { ServiceConfig } from '@crossdelta/infrastructure'
|
|
72
|
+
|
|
73
|
+
export const orders: ServiceConfig = {
|
|
74
|
+
name: 'orders',
|
|
75
|
+
httpPort: 4001,
|
|
76
|
+
env: {
|
|
77
|
+
ORDERS_DB_URL: 'postgres://...',
|
|
78
|
+
NATS_URL: 'nats://localhost:4222',
|
|
79
|
+
},
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Running:
|
|
51
84
|
|
|
52
85
|
```bash
|
|
53
|
-
pf dev
|
|
54
|
-
pf dev --no-watch # Start without watching for changes
|
|
86
|
+
pf dev
|
|
55
87
|
```
|
|
56
88
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
**Configuration via `package.json`:**
|
|
65
|
-
```json
|
|
66
|
-
{
|
|
67
|
-
"pf": {
|
|
68
|
-
"dev": {
|
|
69
|
-
"watchDirs": ["infra/services"],
|
|
70
|
-
"watchPackages": ["services", "apps"]
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
89
|
+
Creates:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
.env.local
|
|
93
|
+
ORDERS_DB_URL=postgres://...
|
|
94
|
+
NATS_URL=nats://localhost:4222
|
|
95
|
+
ORDERS_PORT=4001
|
|
74
96
|
```
|
|
75
97
|
|
|
76
|
-
|
|
98
|
+
And automatically reloads services on change.
|
|
77
99
|
|
|
78
|
-
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## π Commands
|
|
103
|
+
|
|
104
|
+
### `pf dev`
|
|
105
|
+
Start the development environment with optional watch mode.
|
|
79
106
|
|
|
80
107
|
```bash
|
|
81
|
-
pf
|
|
82
|
-
pf
|
|
108
|
+
pf dev # Start with watch mode
|
|
109
|
+
pf dev --no-watch # Disable watching
|
|
83
110
|
```
|
|
84
111
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
βββ Pulumi.yaml
|
|
94
|
-
βββ Pulumi.dev.yaml
|
|
95
|
-
βββ services/
|
|
96
|
-
βββ example.ts # Example service config
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### `pf new workspace <name>`
|
|
115
|
+
Scaffold a complete platform workspace with Pulumi infrastructure.
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
pf new workspace my-platform
|
|
119
|
+
pf new workspace my-platform -y # Skip prompts
|
|
97
120
|
```
|
|
98
121
|
|
|
99
|
-
|
|
122
|
+
---
|
|
100
123
|
|
|
101
|
-
|
|
124
|
+
### `pf new hono-micro <path>`
|
|
125
|
+
Generate a lightweight Hono microservice.
|
|
102
126
|
|
|
103
127
|
```bash
|
|
104
128
|
pf new hono-micro services/orders
|
|
105
129
|
```
|
|
106
130
|
|
|
107
|
-
|
|
131
|
+
---
|
|
108
132
|
|
|
109
|
-
|
|
133
|
+
### `pf new nest-micro <path>`
|
|
134
|
+
Generate a NestJS microservice with enterprise-ready setup.
|
|
110
135
|
|
|
111
136
|
```bash
|
|
112
137
|
pf new nest-micro services/api-gateway
|
|
113
138
|
```
|
|
114
139
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## π¦ Installation (optional)
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
npm install -g @crossdelta/platform-sdk
|
|
146
|
+
# or
|
|
147
|
+
bun add -g @crossdelta/platform-sdk
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
---
|
|
120
151
|
|
|
121
|
-
##
|
|
152
|
+
## π When to use this
|
|
122
153
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
154
|
+
- You want a **Bun-first microservice platform** with minimal boilerplate
|
|
155
|
+
- You prefer **Turborepo + Pulumi** as your architectural baseline
|
|
156
|
+
- You want fast **Hono/NestJS service scaffolding**
|
|
157
|
+
- You need a **unified dev workflow** for multiple services
|
|
158
|
+
- You plan to deploy to **DigitalOcean, GCP, AWS**
|
|
128
159
|
|
|
129
|
-
|
|
160
|
+
---
|
|
130
161
|
|
|
131
|
-
|
|
162
|
+
## β When NOT to use this
|
|
163
|
+
|
|
164
|
+
- You need a hosted PaaS (Render, Fly.io, Netlify, etc.)
|
|
165
|
+
- You are not using a monorepo
|
|
166
|
+
- You donβt use Infrastructure-as-Code
|
|
167
|
+
- You prefer fully unopinionated setups
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## π Requirements
|
|
172
|
+
|
|
173
|
+
- Node.js β₯ 21
|
|
132
174
|
- Bun (recommended) or npm/yarn/pnpm
|
|
175
|
+
- Pulumi CLI (optional, required for infra)
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## π Related
|
|
133
180
|
|
|
134
|
-
|
|
181
|
+
- **[@crossdelta/infrastructure](https://www.npmjs.com/package/@crossdelta/infrastructure)** β Shared helpers & types for Pulumi + DigitalOcean
|
|
182
|
+
- **[@crossdelta/cloudevents](https://www.npmjs.com/package/@crossdelta/cloudevents)** β CloudEvents + NATS toolkit for event-driven microservices
|
|
135
183
|
|
|
136
|
-
|
|
184
|
+
---
|
|
137
185
|
|
|
138
|
-
## License
|
|
186
|
+
## π License
|
|
139
187
|
|
|
140
|
-
MIT Β©
|
|
188
|
+
MIT Β© Crossdelta
|