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