create-asaje-go-vue 0.2.10 → 0.3.1
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 +284 -3
- package/bin/create-asaje-go-vue.js +1760 -145
- package/package.json +7 -1
package/README.md
CHANGED
|
@@ -4,6 +4,21 @@ CLI package for scaffolding and running the Asaje Go + Vue boilerplate.
|
|
|
4
4
|
|
|
5
5
|
## Commands
|
|
6
6
|
|
|
7
|
+
### Railway command reference
|
|
8
|
+
|
|
9
|
+
| Command | Purpose |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `asaje sync-project-config [directory]` | Scan the project, detect managed services, and rewrite `asaje.config.json` / `asaje.railway.json` |
|
|
12
|
+
| `asaje setup-railway [directory]` | Provision infrastructure, create missing Railway services, wire variables, and deploy |
|
|
13
|
+
| `asaje update-railway [directory]` | Reconcile an existing Railway project after changing `asaje.config.json` |
|
|
14
|
+
| `asaje sync-railway-env [directory]` | Reapply Railway variables without reprovisioning infra |
|
|
15
|
+
| `asaje print-railway-config [directory]` | Print resolved Railway config for one environment |
|
|
16
|
+
| `asaje export-railway-config [directory]` | Export resolved Railway config to a JSON snapshot |
|
|
17
|
+
| `asaje import-railway-config [directory]` | Apply variables from a previously exported Railway snapshot |
|
|
18
|
+
| `asaje diff-railway-config [directory]` | Compare two Railway environments or snapshots |
|
|
19
|
+
| `asaje deploy-railway [directory]` | Redeploy managed app services from the current source tree |
|
|
20
|
+
| `asaje destroy-railway [directory]` | Delete the linked Railway environment or project |
|
|
21
|
+
|
|
7
22
|
### Create a project
|
|
8
23
|
|
|
9
24
|
```bash
|
|
@@ -52,20 +67,70 @@ npx -p create-asaje-go-vue@latest asaje update ./my-app --yes
|
|
|
52
67
|
npx -p create-asaje-go-vue@latest asaje update ./my-app --include admin/src/stores/session.ts,admin/src/services/http/session.ts
|
|
53
68
|
```
|
|
54
69
|
|
|
70
|
+
### Scan the project and regenerate local config manifests
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npx -p create-asaje-go-vue@latest asaje sync-project-config ./my-app --dry-run
|
|
74
|
+
npx -p create-asaje-go-vue@latest asaje sync-project-config ./my-app --yes
|
|
75
|
+
```
|
|
76
|
+
|
|
55
77
|
### Provision Railway resources
|
|
56
78
|
|
|
57
79
|
```bash
|
|
58
80
|
npx -p create-asaje-go-vue@latest asaje setup-railway ./my-app
|
|
59
81
|
npx -p create-asaje-go-vue@latest asaje setup-railway ./my-app --dry-run
|
|
82
|
+
npx -p create-asaje-go-vue@latest asaje update-railway ./my-app --yes
|
|
60
83
|
```
|
|
61
84
|
|
|
62
85
|
### Sync Railway app variables
|
|
63
86
|
|
|
64
87
|
```bash
|
|
65
88
|
npx -p create-asaje-go-vue@latest asaje sync-railway-env ./my-app
|
|
89
|
+
npx -p create-asaje-go-vue@latest asaje sync-railway-env ./my-app --diff --dry-run
|
|
66
90
|
npx -p create-asaje-go-vue@latest asaje sync-railway-env ./my-app --dry-run
|
|
67
91
|
```
|
|
68
92
|
|
|
93
|
+
### Print resolved Railway config
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
npx -p create-asaje-go-vue@latest asaje print-railway-config ./my-app
|
|
97
|
+
npx -p create-asaje-go-vue@latest asaje print-railway-config ./my-app --environment production
|
|
98
|
+
npx -p create-asaje-go-vue@latest asaje print-railway-config ./my-app --environment production --json
|
|
99
|
+
npx -p create-asaje-go-vue@latest asaje print-railway-config ./my-app --environment production --show-secrets
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Export resolved Railway config snapshot
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
npx -p create-asaje-go-vue@latest asaje export-railway-config ./my-app
|
|
106
|
+
npx -p create-asaje-go-vue@latest asaje export-railway-config ./my-app --environment production
|
|
107
|
+
npx -p create-asaje-go-vue@latest asaje export-railway-config ./my-app --environment production --output ./snapshots/railway.production.json
|
|
108
|
+
npx -p create-asaje-go-vue@latest asaje export-railway-config ./my-app --environment production --show-secrets
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Import a Railway config snapshot
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npx -p create-asaje-go-vue@latest asaje import-railway-config ./my-app --file ./snapshots/railway.production.json --yes
|
|
115
|
+
npx -p create-asaje-go-vue@latest asaje import-railway-config ./my-app --file ./snapshots/railway.production.json --diff --dry-run
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Diff Railway configs or snapshots
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
npx -p create-asaje-go-vue@latest asaje diff-railway-config ./my-app --environment production --compare-environment staging
|
|
122
|
+
npx -p create-asaje-go-vue@latest asaje diff-railway-config ./my-app --environment production --compare-file ./snapshots/railway.production.json
|
|
123
|
+
npx -p create-asaje-go-vue@latest asaje diff-railway-config ./my-app --file ./snapshots/railway.staging.json --compare-file ./snapshots/railway.production.json --json
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Redeploy Railway app services
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
npx -p create-asaje-go-vue@latest asaje deploy-railway ./my-app
|
|
130
|
+
npx -p create-asaje-go-vue@latest asaje deploy-railway ./my-app --service api
|
|
131
|
+
npx -p create-asaje-go-vue@latest asaje deploy-railway ./my-app --services api,admin --dry-run
|
|
132
|
+
```
|
|
133
|
+
|
|
69
134
|
### Destroy Railway resources
|
|
70
135
|
|
|
71
136
|
```bash
|
|
@@ -114,28 +179,235 @@ npx -p create-asaje-go-vue@latest asaje destroy-railway ./my-app --scope project
|
|
|
114
179
|
- supports `--dry-run` to preview which files would be updated
|
|
115
180
|
- updates `asaje.config.json` with the template repository and branch used for the update
|
|
116
181
|
|
|
182
|
+
## What `asaje sync-project-config` does
|
|
183
|
+
|
|
184
|
+
- scans the project tree for service-local `Dockerfile` files
|
|
185
|
+
- infers Railway managed services from the detected directories
|
|
186
|
+
- preserves existing service metadata when possible, while updating directories and Dockerfile paths from the scan
|
|
187
|
+
- rewrites `asaje.config.json` with the merged `railway.services` list
|
|
188
|
+
- rewrites `asaje.railway.json` so local service names line up with the current managed service list
|
|
189
|
+
- supports `--dry-run` to preview the rewrite without changing local files
|
|
190
|
+
|
|
117
191
|
## What `asaje setup-railway` does
|
|
118
192
|
|
|
119
193
|
- validates the target project structure
|
|
120
194
|
- checks that the Railway CLI is installed and authenticated
|
|
121
195
|
- reads the linked Railway project context
|
|
122
196
|
- provisions PostgreSQL, RabbitMQ, and S3-compatible object storage on Railway
|
|
123
|
-
- creates missing Railway app services for
|
|
124
|
-
-
|
|
197
|
+
- creates missing Railway app services for the configured app service list
|
|
198
|
+
- defaults to `api`, `realtime-gateway`, and `admin` when no custom Railway service config is present
|
|
199
|
+
- applies Railway variables from `asaje.config.json` when configured
|
|
200
|
+
- keeps the legacy automatic variable wiring for `api`, `realtime-gateway`, and `admin` unless `railway.variablesMode` is set to `replace`
|
|
125
201
|
- triggers the first Railway deployment for each app service using the service-local `Dockerfile` and `railway.json`
|
|
126
202
|
- generates missing app secrets such as `JWT_SECRET` and `SWAGGER_PASSWORD`, while reusing existing Railway values when present
|
|
127
203
|
- supports `--dry-run` to preview provisioning and variable changes without applying them
|
|
128
204
|
- writes an `asaje.railway.json` manifest in the target project for future runs, including discovered Railway app service names
|
|
129
205
|
|
|
206
|
+
## What `asaje update-railway` does
|
|
207
|
+
|
|
208
|
+
- runs the same reconciliation flow as `setup-railway`
|
|
209
|
+
- is intended to be rerun after changing `railway.services`, `railway.variables`, or `railway.environments` in `asaje.config.json`
|
|
210
|
+
- provisions any newly configured services/resources that are still missing
|
|
211
|
+
- reapplies variables and redeploys the configured app services
|
|
212
|
+
- is safe to use repeatedly as an idempotent Railway reconciliation command
|
|
213
|
+
|
|
130
214
|
## What `asaje sync-railway-env` does
|
|
131
215
|
|
|
132
216
|
- validates the target project structure
|
|
133
217
|
- checks that the Railway CLI is installed and authenticated
|
|
134
218
|
- reads the linked Railway project context
|
|
135
219
|
- discovers existing Railway app and infra services
|
|
136
|
-
- syncs
|
|
220
|
+
- syncs configured Railway variables without provisioning infra resources
|
|
221
|
+
- keeps the legacy automatic variable wiring for `api`, `realtime-gateway`, and `admin` unless `railway.variablesMode` is set to `replace`
|
|
222
|
+
- supports `--diff` to show what would be added or changed compared with the current Railway variables
|
|
137
223
|
- supports `--dry-run` to preview variable changes without applying them
|
|
138
224
|
|
|
225
|
+
## What `asaje print-railway-config` does
|
|
226
|
+
|
|
227
|
+
- validates the target project structure locally
|
|
228
|
+
- resolves the managed Railway services from `asaje.config.json`
|
|
229
|
+
- resolves the selected logical deployment environment and its Railway environment mapping
|
|
230
|
+
- computes the final variable set per managed service after all merges and overrides
|
|
231
|
+
- supports `--json` for machine-readable output
|
|
232
|
+
- redacts secret-looking values in the printed output by default
|
|
233
|
+
- supports `--show-secrets` when you explicitly want the raw values in the output
|
|
234
|
+
|
|
235
|
+
## What `asaje export-railway-config` does
|
|
236
|
+
|
|
237
|
+
- builds the same resolved config payload as `print-railway-config`
|
|
238
|
+
- writes it to a JSON file for snapshotting, auditing, or sharing between environments
|
|
239
|
+
- defaults the filename to `.railway-config.<environment>.json` in the project root when `--output` is omitted
|
|
240
|
+
- redacts secret-looking values by default
|
|
241
|
+
- supports `--show-secrets` when you explicitly want the raw values in the exported file
|
|
242
|
+
|
|
243
|
+
## What `asaje import-railway-config` does
|
|
244
|
+
|
|
245
|
+
- reads a JSON snapshot produced by `export-railway-config` or `print-railway-config --json`
|
|
246
|
+
- applies the snapshot variables to the current project's Railway services by service key
|
|
247
|
+
- supports `--diff` to compare current Railway values with the snapshot before applying
|
|
248
|
+
- supports `--dry-run` to preview the import without changing Railway
|
|
249
|
+
- rejects snapshots that still contain `[redacted]` placeholders, so secret imports require `--show-secrets` at export time
|
|
250
|
+
|
|
251
|
+
## What `asaje diff-railway-config` does
|
|
252
|
+
|
|
253
|
+
- compares two resolved Railway configurations
|
|
254
|
+
- supports comparing current project environments with `--environment` and `--compare-environment`
|
|
255
|
+
- supports comparing against exported snapshots with `--file` and `--compare-file`
|
|
256
|
+
- shows service-level metadata changes and variable-level additions, removals, and modifications
|
|
257
|
+
- supports `--json` for machine-readable diff output
|
|
258
|
+
|
|
259
|
+
## What `asaje deploy-railway` does
|
|
260
|
+
|
|
261
|
+
- validates the target project structure
|
|
262
|
+
- checks that the Railway CLI is installed and authenticated
|
|
263
|
+
- reads the linked Railway project context
|
|
264
|
+
- discovers the existing Railway app services from the linked project or `asaje.railway.json`
|
|
265
|
+
- triggers fresh Railway builds/deployments for the configured app service list from the current local source tree
|
|
266
|
+
- defaults to `api`, `realtime-gateway`, and `admin` when no custom Railway service config is present
|
|
267
|
+
- supports `--service` and `--services` to redeploy only selected app services
|
|
268
|
+
- supports `--dry-run` to preview which services would be redeployed
|
|
269
|
+
|
|
270
|
+
## Railway Configuration
|
|
271
|
+
|
|
272
|
+
You can fully describe the managed Railway app services, variables, and deployment environments in `asaje.config.json`.
|
|
273
|
+
|
|
274
|
+
If the `railway` block is omitted, the CLI keeps the default built-in services and the previous automatic variable behavior.
|
|
275
|
+
|
|
276
|
+
```json
|
|
277
|
+
{
|
|
278
|
+
"projectName": "My App",
|
|
279
|
+
"projectSlug": "my-app",
|
|
280
|
+
"railway": {
|
|
281
|
+
"variablesMode": "merge",
|
|
282
|
+
"services": [
|
|
283
|
+
{
|
|
284
|
+
"key": "api",
|
|
285
|
+
"directory": "api",
|
|
286
|
+
"dockerfile": "api/Dockerfile"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"key": "admin",
|
|
290
|
+
"directory": "admin",
|
|
291
|
+
"dockerfile": "admin/Dockerfile"
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
"key": "realtime",
|
|
295
|
+
"directory": "realtime-gateway",
|
|
296
|
+
"baseName": "realtime-gateway",
|
|
297
|
+
"aliases": ["realtime-gateway"],
|
|
298
|
+
"dockerfile": "realtime-gateway/Dockerfile"
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"key": "worker",
|
|
302
|
+
"directory": "worker-api",
|
|
303
|
+
"baseName": "worker",
|
|
304
|
+
"dockerfile": "worker-api/Dockerfile"
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
"key": "marketing",
|
|
308
|
+
"directory": "marketing",
|
|
309
|
+
"baseName": "marketing",
|
|
310
|
+
"serviceName": "my-app-marketing"
|
|
311
|
+
}
|
|
312
|
+
],
|
|
313
|
+
"variables": {
|
|
314
|
+
"shared": {
|
|
315
|
+
"LOG_LEVEL": "info"
|
|
316
|
+
},
|
|
317
|
+
"services": {
|
|
318
|
+
"api": {
|
|
319
|
+
"APP_ENV": "local"
|
|
320
|
+
},
|
|
321
|
+
"admin": {
|
|
322
|
+
"VITE_APP_NAME": "My App"
|
|
323
|
+
},
|
|
324
|
+
"worker": {
|
|
325
|
+
"WORKER_CONCURRENCY": "4"
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
},
|
|
329
|
+
"environments": {
|
|
330
|
+
"staging": {
|
|
331
|
+
"railwayEnvironment": "staging",
|
|
332
|
+
"variables": {
|
|
333
|
+
"shared": {
|
|
334
|
+
"APP_STAGE": "staging"
|
|
335
|
+
},
|
|
336
|
+
"services": {
|
|
337
|
+
"api": {
|
|
338
|
+
"CORS_ALLOWED_ORIGINS": "https://staging-admin.example.com"
|
|
339
|
+
},
|
|
340
|
+
"admin": {
|
|
341
|
+
"VITE_API_BASE_URL": "https://${{ api.RAILWAY_PUBLIC_DOMAIN }}/api/v1",
|
|
342
|
+
"VITE_REALTIME_BASE_URL": "https://${{ realtime-gateway.RAILWAY_PUBLIC_DOMAIN }}"
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
"production": {
|
|
348
|
+
"railwayEnvironment": "production",
|
|
349
|
+
"variables": {
|
|
350
|
+
"shared": {
|
|
351
|
+
"APP_STAGE": "production"
|
|
352
|
+
},
|
|
353
|
+
"services": {
|
|
354
|
+
"api": {
|
|
355
|
+
"CORS_ALLOWED_ORIGINS": "https://admin.example.com"
|
|
356
|
+
},
|
|
357
|
+
"admin": {
|
|
358
|
+
"VITE_APP_NAME": "My App"
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
Supported top-level Railway fields:
|
|
369
|
+
|
|
370
|
+
- `variablesMode`: `merge` by default; use `replace` to disable the legacy automatic variables and rely only on `railway.variables`
|
|
371
|
+
- `services`: managed Railway application services deployed by `setup-railway` and `deploy-railway`
|
|
372
|
+
- `variables.shared`: variables applied to every managed service
|
|
373
|
+
- `variables.services.<key>`: variables applied only to one managed service
|
|
374
|
+
- `environments.<name>.railwayEnvironment`: optional mapping from a logical config key like `production` to the real Railway environment name or id
|
|
375
|
+
- `environments.<name>.variables.shared`: shared variables only for that deployment environment
|
|
376
|
+
- `environments.<name>.variables.services.<key>`: service-specific overrides only for that deployment environment
|
|
377
|
+
|
|
378
|
+
Supported fields per service in `railway.services`:
|
|
379
|
+
|
|
380
|
+
- `key`: unique internal identifier used in the manifest and CLI selection flags
|
|
381
|
+
- `directory`: project-relative directory deployed with `railway up <directory> --path-as-root`
|
|
382
|
+
- `baseName`: optional suffix used to build the default Railway service name as `<projectSlug>-<baseName>`
|
|
383
|
+
- `serviceName`: optional explicit Railway service name override
|
|
384
|
+
- `aliases`: optional extra names that help the CLI match an already-existing Railway service
|
|
385
|
+
- `seedImage`: optional bootstrap image used only when `setup-railway` needs to create the Railway service before the first deploy
|
|
386
|
+
- `dockerfile`: optional project-relative Dockerfile path validated by the CLI for documentation/safety; Railway still builds from the declared `directory`
|
|
387
|
+
|
|
388
|
+
How variable merging works:
|
|
389
|
+
|
|
390
|
+
- `railway.variables.shared`
|
|
391
|
+
- then `railway.variables.services.<key>`
|
|
392
|
+
- then `railway.environments.<name>.variables.shared`
|
|
393
|
+
- then `railway.environments.<name>.variables.services.<key>`
|
|
394
|
+
|
|
395
|
+
Environment-aware usage:
|
|
396
|
+
|
|
397
|
+
- `--environment production` can point to either the logical config key or the real Railway environment name/id
|
|
398
|
+
- if `--environment` is omitted, the CLI uses the linked Railway environment
|
|
399
|
+
- if `railway.environments.default` exists and defines `railwayEnvironment`, it becomes the default target when `--environment` is omitted
|
|
400
|
+
|
|
401
|
+
Notes:
|
|
402
|
+
|
|
403
|
+
- the service directory should contain the `Dockerfile` Railway will build from
|
|
404
|
+
- custom services are provisioned and deployed by `setup-railway` and `deploy-railway`
|
|
405
|
+
- `sync-railway-env` can now apply declarative variables to any managed service key, including custom services
|
|
406
|
+
- with `variablesMode: "merge"`, the core services `api`, `realtime-gateway`, and `admin` still receive the legacy generated defaults unless you override them
|
|
407
|
+
- with `variablesMode: "replace"`, only the variables declared in `asaje.config.json` are applied
|
|
408
|
+
- after changing the Railway config, run `asaje update-railway ./my-app --yes` to reconcile the linked Railway project with the new configuration
|
|
409
|
+
- you can target a custom service with `asaje deploy-railway ./my-app --service worker`
|
|
410
|
+
|
|
139
411
|
## What `asaje destroy-railway` does
|
|
140
412
|
|
|
141
413
|
- validates the target project structure
|
|
@@ -158,8 +430,17 @@ node ./bin/asaje.js publish .
|
|
|
158
430
|
node ./bin/asaje.js update ../my-app --dry-run
|
|
159
431
|
node ./bin/asaje.js update ../my-app --include admin/src/stores/session.ts --yes
|
|
160
432
|
node ./bin/asaje.js setup-railway ../my-app --yes
|
|
433
|
+
node ./bin/asaje.js update-railway ../my-app --yes
|
|
161
434
|
node ./bin/asaje.js setup-railway ../my-app --yes --dry-run
|
|
162
435
|
node ./bin/asaje.js sync-railway-env ../my-app --yes
|
|
436
|
+
node ./bin/asaje.js sync-railway-env ../my-app --yes --diff --dry-run
|
|
437
|
+
node ./bin/asaje.js print-railway-config ../my-app --environment production
|
|
438
|
+
node ./bin/asaje.js print-railway-config ../my-app --environment production --show-secrets
|
|
439
|
+
node ./bin/asaje.js export-railway-config ../my-app --environment production
|
|
440
|
+
node ./bin/asaje.js import-railway-config ../my-app --file ../snapshots/railway.production.json --yes
|
|
441
|
+
node ./bin/asaje.js diff-railway-config ../my-app --environment production --compare-environment staging
|
|
442
|
+
node ./bin/asaje.js deploy-railway ../my-app --yes
|
|
443
|
+
node ./bin/asaje.js deploy-railway ../my-app --services api,admin --yes
|
|
163
444
|
node ./bin/asaje.js destroy-railway ../my-app --scope environment --yes
|
|
164
445
|
```
|
|
165
446
|
|