create-restforge-skills 0.1.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 +137 -0
- package/cli/index.js +235 -0
- package/cli/mcp.js +94 -0
- package/package.json +30 -0
- package/skills/restforge/SKILL.md +421 -0
- package/skills/restforge/references/config-schema.md +173 -0
- package/skills/restforge/references/dbschema-catalog.md +238 -0
- package/skills/restforge/references/design-to-sdf.md +618 -0
- package/skills/restforge/references/field-validation.md +173 -0
- package/skills/restforge/references/rdf-advanced.md +488 -0
- package/skills/restforge/references/udf-catalog.md +489 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: restforge
|
|
3
|
+
description: >
|
|
4
|
+
RESTForge end-to-end workflow — use for any task involving RESTForge: SDF
|
|
5
|
+
(Schema Definition File), RDF (Resource Definition File), UDF (UI Definition
|
|
6
|
+
File), dbschema, defineModel, codegen, payload, generate endpoint, generate
|
|
7
|
+
dashboard, generate frontend, migrate schema, setup project, or design-to-SDF
|
|
8
|
+
(deriving a schema from an HTML mockup, screenshot, image, or UI design). Also
|
|
9
|
+
active for the codegen_*, designer_*, setup_*, runtime_* MCP tools and the
|
|
10
|
+
@restforgejs/platform / @restforgejs/mcp-server packages. Defines the canonical
|
|
11
|
+
operation order for the backend track (setup → schema → payload → codegen →
|
|
12
|
+
runtime) and the frontend track (init → udf → validate → generate), the
|
|
13
|
+
grounding-first catalog rules, decision branches, and destructive-operation
|
|
14
|
+
guardrails. Active whenever working on a RESTForge project, not only when the
|
|
15
|
+
word "skill" is mentioned.
|
|
16
|
+
license: MIT
|
|
17
|
+
compatibility: >
|
|
18
|
+
Requires the RESTForge MCP server (@restforgejs/mcp-server) registered in the
|
|
19
|
+
client, plus a RESTForge license for codegen_*, runtime_*, and
|
|
20
|
+
setup_validate_config operations. Designer tools do not require a license.
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Mental Model
|
|
24
|
+
|
|
25
|
+
RESTForge is a deterministic, definition-first generator with two output tracks:
|
|
26
|
+
|
|
27
|
+
- **Backend track** — SDF defines the database schema; RDF defines REST API
|
|
28
|
+
endpoints. One SDF produces identical DDL; one RDF payload produces an
|
|
29
|
+
identical endpoint module on every execution.
|
|
30
|
+
- **Frontend track** — UDF defines the frontend application. One UDF payload
|
|
31
|
+
produces identical HTML/JS/CSS via `restforge-designer`, plugin-driven,
|
|
32
|
+
no build step required.
|
|
33
|
+
|
|
34
|
+
The agent interacts with the platform **exclusively through MCP tools**. The
|
|
35
|
+
agent does not write generation code itself, does not modify generated output,
|
|
36
|
+
and does not guess options outside the catalog. All valid options come from the
|
|
37
|
+
catalog returned by grounding tools.
|
|
38
|
+
|
|
39
|
+
The platform exposes its capabilities as MCP tools grouped by domain: `health_*`,
|
|
40
|
+
`setup_*`, `codegen_*`, `runtime_*`, `designer_*`, `data_*`, `key_*`,
|
|
41
|
+
`project_*`. Two facts follow from this and shape every task:
|
|
42
|
+
|
|
43
|
+
1. **The skill describes intent and order; the MCP server executes.** If the
|
|
44
|
+
RESTForge MCP server is not registered in the client, this skill cannot do
|
|
45
|
+
anything — there is nothing to call. Confirm the tools are available before
|
|
46
|
+
planning a multi-step operation.
|
|
47
|
+
2. **The catalog is the source of truth, not memory.** Field types, constraints,
|
|
48
|
+
validation rules, and plugin capabilities belong to the *installed* platform
|
|
49
|
+
version. Always ground against the catalog before proposing definition
|
|
50
|
+
content (see Grounding-First Rules, below).
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Backend Pipeline (canonical)
|
|
55
|
+
|
|
56
|
+
This is the canonical (golden) path. For state-dependent choices see Decision
|
|
57
|
+
Points; for failure handling see Guardrails and Common Errors.
|
|
58
|
+
|
|
59
|
+
The sequence below applies to a **new project from scratch**. For an existing
|
|
60
|
+
project, start from the step that matches the current state — do not re-run
|
|
61
|
+
earlier steps that already succeeded.
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
1. setup_create_folder
|
|
65
|
+
Create a new project folder at the specified location.
|
|
66
|
+
|
|
67
|
+
2. setup_install_package
|
|
68
|
+
Install @restforgejs/platform into the project folder.
|
|
69
|
+
|
|
70
|
+
3. setup_init_config
|
|
71
|
+
Write config/db-connection.env from the default template.
|
|
72
|
+
|
|
73
|
+
4. setup_write_env / setup_update_env
|
|
74
|
+
Set values: LICENSE, SERVER_ADDRESS, SERVER_PORT, DB_TYPE,
|
|
75
|
+
DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_NAME (9 required parameters).
|
|
76
|
+
Use setup_read_env to read existing values before overwriting.
|
|
77
|
+
|
|
78
|
+
5. setup_validate_config
|
|
79
|
+
── GATE ── Must pass before any codegen_* operation starts.
|
|
80
|
+
Validates database connection and license. Running codegen before this
|
|
81
|
+
gate passes produces uninformative errors.
|
|
82
|
+
|
|
83
|
+
6. codegen_get_dbschema_catalog
|
|
84
|
+
── GROUNDING ── Source of truth before defining SDF: field types,
|
|
85
|
+
constraints, shorthand syntax, relations, referential actions,
|
|
86
|
+
check operations, and the soft-delete contract.
|
|
87
|
+
→ references/dbschema-catalog.md
|
|
88
|
+
|
|
89
|
+
7a. codegen_dbschema_init (empty DB — scaffold SDF with audit columns)
|
|
90
|
+
codegen_dbschema_template (minimal template, no DB connection required)
|
|
91
|
+
7b. codegen_dbschema_introspect (existing DB — generate SDF from actual schema)
|
|
92
|
+
|
|
93
|
+
8. codegen_dbschema_validate
|
|
94
|
+
Validate SDF before any DDL is generated. Catch errors here, not at migrate.
|
|
95
|
+
|
|
96
|
+
9. codegen_dbschema_generate_ddl (optional — preview DDL without executing)
|
|
97
|
+
|
|
98
|
+
10a. codegen_dbschema_migrate (empty DB — apply DDL directly)
|
|
99
|
+
10b. codegen_dbschema_diff (existing DB — review the differences first)
|
|
100
|
+
→ codegen_dbschema_apply (apply only after confirming the drift)
|
|
101
|
+
|
|
102
|
+
11. codegen_get_field_validation_catalog
|
|
103
|
+
── GROUNDING ── before defining fieldValidation in a payload.
|
|
104
|
+
→ references/field-validation.md
|
|
105
|
+
|
|
106
|
+
12. codegen_get_query_declarative_catalog
|
|
107
|
+
── GROUNDING ── when the payload contains datatablesQuery, viewQuery,
|
|
108
|
+
viewName, exportQuery, or detailQuery.
|
|
109
|
+
|
|
110
|
+
13. codegen_generate_payload
|
|
111
|
+
Generate payload JSON from a table. Foundation for all subsequent
|
|
112
|
+
codegen operations.
|
|
113
|
+
|
|
114
|
+
14. codegen_validate_payload
|
|
115
|
+
Validate the payload before codegen. Catch errors here.
|
|
116
|
+
|
|
117
|
+
15. codegen_diff_payload (when a payload exists and the DB schema has changed)
|
|
118
|
+
→ codegen_sync_payload (sync payload to the current DB state — non-breaking)
|
|
119
|
+
→ codegen_migrate_payload (when the payload has breaking changes)
|
|
120
|
+
|
|
121
|
+
16a. codegen_create_endpoint (standard CRUD module)
|
|
122
|
+
16b. codegen_get_dashboard_catalog
|
|
123
|
+
→ codegen_create_dashboard (analytic dashboard with SQL widgets)
|
|
124
|
+
16c. codegen_create_processor (background processing)
|
|
125
|
+
16d. codegen_create_kafka_consumer (Kafka event streaming)
|
|
126
|
+
|
|
127
|
+
17. runtime_generate_launcher
|
|
128
|
+
Generate the launcher script. The agent STOPS here. The user executes
|
|
129
|
+
the launcher — the server runs independently of the agent session.
|
|
130
|
+
|
|
131
|
+
18. (user executes the launcher)
|
|
132
|
+
|
|
133
|
+
19. runtime_check_status
|
|
134
|
+
Verify the server is running and endpoints are reachable.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Two hard checkpoints in this track, both expanded under Guardrails:
|
|
138
|
+
|
|
139
|
+
- **Step 5 is a gate**, not a suggestion. No `codegen_*` call before
|
|
140
|
+
`setup_validate_config` passes.
|
|
141
|
+
- **Step 17 is where the agent stops.** The agent never starts, stops, or
|
|
142
|
+
restarts the server itself; it only generates the launcher.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Frontend Pipeline (canonical)
|
|
147
|
+
|
|
148
|
+
This is the canonical (golden) path for the frontend track. It runs
|
|
149
|
+
**independently** from the backend pipeline. The backend API must be running and
|
|
150
|
+
reachable at `apiBaseUrl` before the generated frontend is useful, but the
|
|
151
|
+
frontend can be defined and generated without the backend live.
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
1. designer_list_plugins
|
|
155
|
+
── GROUNDING ── list available output plugins before initializing.
|
|
156
|
+
Built-in: vanilla-js-basic (no auth), vanilla-js-auth (JWT auth).
|
|
157
|
+
→ references/udf-catalog.md § Plugins
|
|
158
|
+
|
|
159
|
+
2. designer_init_project
|
|
160
|
+
Scaffold a new frontend project from a plugin. Creates the project folder,
|
|
161
|
+
the initial UDF payload (payload.json), and plugin assets.
|
|
162
|
+
|
|
163
|
+
3. designer_get_udf_catalog
|
|
164
|
+
── GROUNDING ── call before defining or editing any UDF payload.
|
|
165
|
+
Returns valid field types, page anatomy, features, data-source formats,
|
|
166
|
+
and validation rules for the installed plugin version.
|
|
167
|
+
→ references/udf-catalog.md
|
|
168
|
+
|
|
169
|
+
4. [define / edit UDF payload JSON]
|
|
170
|
+
Edit payload.json: appConfig, pages[], navigation[], homepage.
|
|
171
|
+
One page entry = one CRUD page or one dashboard page.
|
|
172
|
+
|
|
173
|
+
5. designer_validate_payload
|
|
174
|
+
── GATE ── validate the UDF payload. Catches structural errors before
|
|
175
|
+
generation. Run before preview or generate, every time.
|
|
176
|
+
|
|
177
|
+
6. designer_preview_files
|
|
178
|
+
Dry-run: list files that would be generated, without writing to disk.
|
|
179
|
+
Use to verify scope before an overwrite.
|
|
180
|
+
|
|
181
|
+
7. designer_generate
|
|
182
|
+
Generate frontend HTML/JS/CSS from the UDF payload. Writes output files.
|
|
183
|
+
The agent STOPS here — the user opens the output in a browser.
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
For plugin development (custom output plugins):
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
designer_scaffold_plugin → [develop plugin templates]
|
|
190
|
+
→ designer_inspect_plugin (verify plugin metadata and capabilities)
|
|
191
|
+
→ designer_generate (test generation with the custom plugin)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Two checkpoints in this track, mirrored in Guardrails:
|
|
195
|
+
|
|
196
|
+
- **Step 5 is a gate.** Never call `designer_generate` on an unvalidated UDF
|
|
197
|
+
payload — generation on an invalid payload produces incomplete or broken output.
|
|
198
|
+
- **Step 7 is where the agent stops.** The agent generates files; it does not
|
|
199
|
+
serve, open, or deploy the frontend.
|
|
200
|
+
|
|
201
|
+
Licensing note: the Designer tools (`designer_preview_files`, `designer_generate`,
|
|
202
|
+
etc.) do **not** require a RESTForge license, unlike the `codegen_*`, `runtime_*`,
|
|
203
|
+
and `setup_validate_config` tools on the backend track.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Grounding-First Rules
|
|
208
|
+
|
|
209
|
+
Before reasoning about, proposing, or generating any **definition content** —
|
|
210
|
+
SDF fields, RDF `fieldValidation`, queries, dashboard widgets, or UDF pages —
|
|
211
|
+
call the matching grounding tool first and use only what it returns. Never write
|
|
212
|
+
definition content from memory.
|
|
213
|
+
|
|
214
|
+
| Context | Grounding tool | Reference |
|
|
215
|
+
|---|---|---|
|
|
216
|
+
| Defining or reviewing SDF | `codegen_get_dbschema_catalog` | references/dbschema-catalog.md |
|
|
217
|
+
| Deriving SDF from a UI design (HTML / image / screenshot) | `codegen_get_dbschema_catalog` | references/design-to-sdf.md |
|
|
218
|
+
| Defining `fieldValidation` in an RDF payload | `codegen_get_field_validation_catalog` | references/field-validation.md |
|
|
219
|
+
| Defining queries in an RDF payload | `codegen_get_query_declarative_catalog` | — |
|
|
220
|
+
| Defining a dashboard payload | `codegen_get_dashboard_catalog` | — |
|
|
221
|
+
| Defining UDF (frontend) | `designer_get_udf_catalog` | references/udf-catalog.md |
|
|
222
|
+
| Listing available frontend plugins | `designer_list_plugins` | references/udf-catalog.md § Plugins |
|
|
223
|
+
|
|
224
|
+
**Why this rule exists.** The catalog is the source of truth for valid options
|
|
225
|
+
in the *installed* platform version. Reasoning without it produces confident but
|
|
226
|
+
wrong output — field types that do not exist, constraints not applicable to a
|
|
227
|
+
type, or wrong semantics. Two concrete failure modes this rule prevents:
|
|
228
|
+
|
|
229
|
+
- **Inventing options.** Without grounding, an agent may write a made-up key
|
|
230
|
+
(e.g. `"toUpper": true`) that the validator rejects. The catalog gives the
|
|
231
|
+
exact key and value type.
|
|
232
|
+
- **Misreading semantics.** A constraint can mean something different from its
|
|
233
|
+
plain-English name. For example, `uppercase` on a `string` field is a
|
|
234
|
+
*normalization transform* (it forces the stored value to upper case), grouped
|
|
235
|
+
with `trim` and `lowercase` — it is **not** a validator that rejects
|
|
236
|
+
non-uppercase input. If the user wants rejection, the answer is `pattern`, not
|
|
237
|
+
`uppercase`; if they want database-level enforcement, that is an SDF check
|
|
238
|
+
constraint, not RDF `fieldValidation`. Grounding surfaces this distinction
|
|
239
|
+
before the agent commits to the wrong one.
|
|
240
|
+
|
|
241
|
+
The reference files mirror the catalog for offline reasoning, but the live
|
|
242
|
+
catalog tool is authoritative — when they disagree, trust the tool.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Decision Points
|
|
247
|
+
|
|
248
|
+
Use these to pick the correct branch when the request is state-dependent. Each
|
|
249
|
+
branch still obeys the Grounding-First Rules above.
|
|
250
|
+
|
|
251
|
+
### Schema (SDF)
|
|
252
|
+
|
|
253
|
+
- **DB does not exist** → `codegen_dbschema_init` (scaffold with audit columns)
|
|
254
|
+
or `codegen_dbschema_template` (minimal template, no DB connection required).
|
|
255
|
+
- **DB already exists** → `codegen_dbschema_introspect` to generate SDF from the
|
|
256
|
+
actual schema. Do not hand-write a schema that a real DB can describe.
|
|
257
|
+
- **Starting from a UI design** (HTML mockup, screenshot, image, Figma export)
|
|
258
|
+
→ first confirm the design is an entity to model, not a dashboard/analytics
|
|
259
|
+
screen (those map to the Dashboard RDF branch below, not to a new SDF table).
|
|
260
|
+
Then classify visible elements into stored / derived / relation / audit, draft
|
|
261
|
+
the SDF, and run `codegen_dbschema_validate`. The design shows presentation,
|
|
262
|
+
not storage — do not turn every visible label into a column.
|
|
263
|
+
→ references/design-to-sdf.md
|
|
264
|
+
- **DB exists with drift** → `codegen_dbschema_diff` to review, then
|
|
265
|
+
`codegen_dbschema_apply`. Not `codegen_dbschema_migrate` — that is for empty
|
|
266
|
+
DBs only.
|
|
267
|
+
|
|
268
|
+
### RDF Payload
|
|
269
|
+
|
|
270
|
+
- **No payload yet** → `codegen_generate_payload`.
|
|
271
|
+
- **Payload exists, edit is API-layer only** (e.g. add/adjust `fieldValidation`,
|
|
272
|
+
messages, or a query — no column added or dropped) → ground via the matching
|
|
273
|
+
catalog, edit `payload.json`, run `codegen_validate_payload`, then regenerate
|
|
274
|
+
with `codegen_create_endpoint`. No DB migration: the schema (SDF) is unchanged.
|
|
275
|
+
- **Payload exists, DB schema changed** → `codegen_diff_payload` first, then
|
|
276
|
+
`codegen_sync_payload` (non-breaking) or `codegen_migrate_payload` (breaking).
|
|
277
|
+
- **Custom query needed** → ground via `codegen_get_query_declarative_catalog`,
|
|
278
|
+
then set `datatablesQuery`, `viewQuery`, or `exportQuery` in the payload.
|
|
279
|
+
External SQL files use the `file:` prefix
|
|
280
|
+
(e.g. `"datatablesQuery": "file:sql/orders.sql"`).
|
|
281
|
+
|
|
282
|
+
> **"Add an uppercase / case constraint" is ambiguous — disambiguate first.**
|
|
283
|
+
> In RESTForge `uppercase` is an RDF `fieldValidation` *normalization transform*
|
|
284
|
+
> (forces the stored value to upper case), not a reject-if-not-uppercase
|
|
285
|
+
> validator. If the user wants rejection, use `pattern`. If the user wants the
|
|
286
|
+
> database to enforce it, that is an SDF check constraint, not RDF. Confirm which
|
|
287
|
+
> one is meant before editing — see Grounding-First Rules § Misreading semantics.
|
|
288
|
+
|
|
289
|
+
### Backend module type
|
|
290
|
+
|
|
291
|
+
- **Standard CRUD** → `codegen_create_endpoint`. One payload = one module.
|
|
292
|
+
- **Analytic dashboard** → `codegen_create_dashboard`. Payload must have
|
|
293
|
+
`widgets` (not `tableName`); page name must be prefixed `dash-`.
|
|
294
|
+
- **Background job** → `codegen_create_processor`.
|
|
295
|
+
- **Kafka event consumer** → `codegen_create_kafka_consumer`; requires
|
|
296
|
+
`KAFKA_ENABLED=true` in config.
|
|
297
|
+
- **Workflow (status transitions)** → add `workflow` and `workflowActions` to the
|
|
298
|
+
RDF payload; generates a `/change-status` endpoint automatically.
|
|
299
|
+
→ references/rdf-advanced.md § Workflow
|
|
300
|
+
- **Master-detail (composite CRUD)** → add `details[]` to the RDF payload;
|
|
301
|
+
generates `/create-composite`, `/update-composite`, `/read-composite`.
|
|
302
|
+
→ references/rdf-advanced.md § Master-Detail
|
|
303
|
+
|
|
304
|
+
### Soft-delete vs hard-delete
|
|
305
|
+
|
|
306
|
+
- Use soft-delete when deleted rows must be audited or recoverable. Declare
|
|
307
|
+
`softDelete: { enabled: true }` in SDF and add the three contract columns
|
|
308
|
+
(`is_deleted`, `deleted_at`, `deleted_by`).
|
|
309
|
+
- Soft-delete is supported on PostgreSQL only (Phase 1).
|
|
310
|
+
- Tables with composite UNIQUE constraints are incompatible with soft-delete.
|
|
311
|
+
|
|
312
|
+
### Frontend page type
|
|
313
|
+
|
|
314
|
+
- **Standard CRUD page** → `pageType: "crud"` (default) with `apiPath`,
|
|
315
|
+
`primaryKey`, `displayField`, and `fields[]`.
|
|
316
|
+
- **Dashboard page** → `pageType: "dashboard"` with `dataSources[]` and `rows[]`
|
|
317
|
+
containing widget columns.
|
|
318
|
+
→ references/udf-catalog.md § Dashboard Page
|
|
319
|
+
- **Page with approval workflow** → add `workflow.statusField` and
|
|
320
|
+
`workflowActions[]` to the page.
|
|
321
|
+
|
|
322
|
+
### Frontend plugin choice
|
|
323
|
+
|
|
324
|
+
- **No authentication required** → `vanilla-js-basic`.
|
|
325
|
+
- **JWT authentication required** → `vanilla-js-auth`.
|
|
326
|
+
- **Custom branding / behavior** → `designer_scaffold_plugin` to create a new
|
|
327
|
+
plugin from template.
|
|
328
|
+
→ references/udf-catalog.md § Plugins
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## Guardrails
|
|
333
|
+
|
|
334
|
+
These are hard rules. They override convenience and override an eager reading of
|
|
335
|
+
the user's request. When a guardrail conflicts with finishing faster, the
|
|
336
|
+
guardrail wins.
|
|
337
|
+
|
|
338
|
+
**1. Confirm before destructive operations.**
|
|
339
|
+
The following require explicit user confirmation before execution:
|
|
340
|
+
|
|
341
|
+
- `codegen_dbschema_migrate` or `codegen_dbschema_apply` that drops a table or
|
|
342
|
+
column, or alters a column in a way that loses data.
|
|
343
|
+
- `project_delete` — permanent project deletion.
|
|
344
|
+
|
|
345
|
+
For schema changes, run `codegen_dbschema_diff` first, present a summary of the
|
|
346
|
+
destructive parts (dropped tables/columns, type narrowing), and wait for
|
|
347
|
+
confirmation before calling `codegen_dbschema_apply`. Never infer approval from
|
|
348
|
+
the original request — "update the schema" is not consent to drop a column.
|
|
349
|
+
|
|
350
|
+
**2. The agent does not run the server.**
|
|
351
|
+
The agent's last step on the backend track is `runtime_generate_launcher`. The
|
|
352
|
+
user executes the launcher in their own terminal. The agent never calls shell
|
|
353
|
+
commands to start, stop, or restart the server, and never assumes the server is
|
|
354
|
+
running — verify with `runtime_check_status` instead.
|
|
355
|
+
|
|
356
|
+
**3. The `validate_config` gate is mandatory.**
|
|
357
|
+
`setup_validate_config` must pass before any `codegen_*` operation starts. Do not
|
|
358
|
+
skip it "to save a step" — running codegen against an invalid config produces
|
|
359
|
+
uninformative errors that cost more time than the gate.
|
|
360
|
+
|
|
361
|
+
**4. Validate before generating.**
|
|
362
|
+
Always run `codegen_validate_payload` before `codegen_create_*`, and
|
|
363
|
+
`designer_validate_payload` before `designer_generate`. Generation on an invalid
|
|
364
|
+
payload produces incomplete or broken output that looks like it succeeded.
|
|
365
|
+
|
|
366
|
+
**5. Stay inside the task scope.**
|
|
367
|
+
Do not modify files outside the requested task. If the change is a backend
|
|
368
|
+
payload edit, do not also "tidy up" the SDF, the runtime, or the frontend. If a
|
|
369
|
+
change genuinely requires touching another area (e.g. an RDF edit that needs a
|
|
370
|
+
new column, which is an SDF change), stop and report the cross-over, then ask
|
|
371
|
+
before expanding scope.
|
|
372
|
+
|
|
373
|
+
**6. Ground before defining — repeated here because it is a guardrail, not a
|
|
374
|
+
suggestion.** Never write SDF fields, `fieldValidation`, queries, dashboard
|
|
375
|
+
widgets, or UDF content from memory. Call the matching catalog tool first (see
|
|
376
|
+
Grounding-First Rules). Inventing an option that "should" exist is the most
|
|
377
|
+
common way to produce confidently wrong output.
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Prerequisites and Common Errors
|
|
382
|
+
|
|
383
|
+
### Environment prerequisites
|
|
384
|
+
|
|
385
|
+
- Node.js ≥ 18.
|
|
386
|
+
- A reachable database matching the configured `DB_TYPE` (PostgreSQL, MySQL,
|
|
387
|
+
Oracle, or SQLite).
|
|
388
|
+
- A valid RESTForge license for `codegen_*`, `runtime_*`, and
|
|
389
|
+
`setup_validate_config`. Designer tools do not require a license.
|
|
390
|
+
- The RESTForge MCP server registered in the client
|
|
391
|
+
(`npm install -g @restforgejs/mcp-server`, then registered as the `restforge`
|
|
392
|
+
MCP server). Without it, none of the tools below exist.
|
|
393
|
+
- Redis if using cache, distributed lock, or live sync.
|
|
394
|
+
- Kafka if using a Kafka consumer (`KAFKA_ENABLED=true`).
|
|
395
|
+
|
|
396
|
+
### Required backend config parameters
|
|
397
|
+
|
|
398
|
+
Nine of the full parameter set are mandatory before `setup_validate_config` can
|
|
399
|
+
pass:
|
|
400
|
+
|
|
401
|
+
`LICENSE`, `SERVER_ADDRESS`, `SERVER_PORT`, `DB_TYPE`, `DB_HOST`, `DB_PORT`,
|
|
402
|
+
`DB_USER`, `DB_PASSWORD`, `DB_NAME`.
|
|
403
|
+
|
|
404
|
+
→ references/config-schema.md for the full parameter list.
|
|
405
|
+
|
|
406
|
+
### Common error patterns
|
|
407
|
+
|
|
408
|
+
| Symptom | Cause | Recovery |
|
|
409
|
+
|---|---|---|
|
|
410
|
+
| Tool not found / no `codegen_*` tools available | MCP server not registered in the client | Install `@restforgejs/mcp-server`, register it as the `restforge` MCP server, restart the client |
|
|
411
|
+
| "authenticity check failed" / HTTP 401 | License not active or expired | Set `LICENSE` in `config/db-connection.env`, run `setup_validate_config` |
|
|
412
|
+
| HTTP 429 from license server | Rate limit (10 req/min/IP) | Expected since v5.1.15 — the client falls back to cache; wait or retry |
|
|
413
|
+
| DB connection failed | Wrong DB config or DB not running | Check `DB_HOST`, `DB_PORT`, `DB_USER`, `DB_PASSWORD`, `DB_NAME`; verify the DB is running |
|
|
414
|
+
| "softDelete contract violation" | Contract columns missing or wrong type | Fix the SDF declaration, run `codegen_dbschema_validate` |
|
|
415
|
+
| "Widget uses undeclared placeholder" | `:paramName` in SQL not in `params` | Add the entry to `params` in the dashboard payload |
|
|
416
|
+
| "tableName and widgets conflict" | Payload contains both | Dashboard uses `widgets`; CRUD uses `tableName` — remove the wrong one |
|
|
417
|
+
| UDF validation error on field type | Field type not supported by the active plugin | Run `designer_list_plugins` + `designer_get_udf_catalog` to verify supported types |
|
|
418
|
+
|
|
419
|
+
When an error is not in this table, do not guess a fix. Re-run the relevant
|
|
420
|
+
`*_validate_*` tool, read its message, and ground against the catalog before
|
|
421
|
+
changing the definition.
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# Reference: Config Schema (db-connection.env)
|
|
2
|
+
|
|
3
|
+
> **Offline mirror.** This file mirrors `setup_get_config_schema` from the
|
|
4
|
+
> installed RESTForge platform. The live tool is authoritative — when this file
|
|
5
|
+
> and the tool disagree, trust the tool, then update this file. Parameter set and
|
|
6
|
+
> defaults can change between platform versions.
|
|
7
|
+
|
|
8
|
+
Source: `setup_get_config_schema` — installed platform version.
|
|
9
|
+
Total: 63 parameters. Required parameters marked **\***.
|
|
10
|
+
Schema version: 1.0.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Section: License
|
|
15
|
+
|
|
16
|
+
| Parameter | Type | Default | Required |
|
|
17
|
+
|---|---|---|---|
|
|
18
|
+
| `LICENSE` | string | `XXXX-XXXX-XXXX-XXXX` | **\*** |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Section: Server
|
|
23
|
+
|
|
24
|
+
| Parameter | Type | Default | Required |
|
|
25
|
+
|---|---|---|---|
|
|
26
|
+
| `SERVER_ADDRESS` | string | `127.0.0.1` | **\*** |
|
|
27
|
+
| `SERVER_PORT` | integer | `3000` | **\*** |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Section: Live Sync (WebSocket)
|
|
32
|
+
|
|
33
|
+
LIVE_SYNC_ENABLED=true requires an API Key (`KEY=...`) for WebSocket client authentication.
|
|
34
|
+
|
|
35
|
+
| Parameter | Type | Default |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `LIVE_SYNC_ENABLED` | boolean | `false` |
|
|
38
|
+
| `LIVE_SYNC_PORT` | integer | `3033` |
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Section: Redis
|
|
43
|
+
|
|
44
|
+
| Parameter | Type | Default |
|
|
45
|
+
|---|---|---|
|
|
46
|
+
| `REDIS_HOST` | string | `localhost` |
|
|
47
|
+
| `REDIS_PORT` | integer | `6380` |
|
|
48
|
+
| `REDIS_PASSWORD` | string | `` |
|
|
49
|
+
| `REDIS_DB` | integer | `0` |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Section: Export
|
|
54
|
+
|
|
55
|
+
| Parameter | Type | Default |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `EXPORT_FILE_EXPIRY` | integer | `3600000` |
|
|
58
|
+
| `EXPORT_CHUNK_SIZE` | integer | `1000` |
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Section: Kafka
|
|
63
|
+
|
|
64
|
+
| Parameter | Type | Default | Notes |
|
|
65
|
+
|---|---|---|---|
|
|
66
|
+
| `KAFKA_ENABLED` | boolean | `false` | |
|
|
67
|
+
| `KAFKA_BROKERS` | string | `localhost:9092` | Comma-separated for multiple brokers |
|
|
68
|
+
| `KAFKA_CONNECTION_TIMEOUT` | integer | `3000` | |
|
|
69
|
+
| `KAFKA_REQUEST_TIMEOUT` | integer | `25000` | |
|
|
70
|
+
| `KAFKA_TOPIC_PATTERN` | string | `{module}.{endpoint}.events` | |
|
|
71
|
+
| `KAFKA_TENANT_ID` | string | `default` | |
|
|
72
|
+
| `KAFKA_SESSION_TIMEOUT` | integer | `30000` | |
|
|
73
|
+
| `KAFKA_HEARTBEAT_INTERVAL` | integer | `3000` | |
|
|
74
|
+
| `KAFKA_MAX_BYTES_PER_PARTITION` | integer | `1048576` | |
|
|
75
|
+
| `KAFKA_AUTO_COMMIT` | boolean | `false` | |
|
|
76
|
+
| `KAFKA_AUTO_COMMIT_INTERVAL` | integer | `5000` | |
|
|
77
|
+
| `KAFKA_RETRY_ATTEMPTS` | integer | `3` | |
|
|
78
|
+
| `KAFKA_RETRY_DELAY` | integer | `1000` | |
|
|
79
|
+
| `KAFKA_RETRY_MAX_DELAY` | integer | `30000` | |
|
|
80
|
+
| `KAFKA_SSL` | boolean | `false` | |
|
|
81
|
+
| `KAFKA_LOG_LEVEL` | string | `info` | |
|
|
82
|
+
|
|
83
|
+
SASL Authentication (optional, uncomment when broker requires authentication):
|
|
84
|
+
`KAFKA_SASL_MECHANISM` (plain/scram-sha-256/scram-sha-512), `KAFKA_SASL_USERNAME`,
|
|
85
|
+
`KAFKA_SASL_PASSWORD`.
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Section: Database
|
|
90
|
+
|
|
91
|
+
| Parameter | Type | Default | Required |
|
|
92
|
+
|---|---|---|---|
|
|
93
|
+
| `DB_TYPE` | string | `postgresql` | **\*** — postgresql, mysql, oracle, sqlite |
|
|
94
|
+
| `DB_HOST` | string | `127.0.0.1` | **\*** |
|
|
95
|
+
| `DB_PORT` | integer | `5432` | **\*** |
|
|
96
|
+
| `DB_USER` | string | `postgres` | **\*** |
|
|
97
|
+
| `DB_PASSWORD` | string | `your_password_here` | **\*** |
|
|
98
|
+
| `DB_NAME` | string | `your_database_name` | **\*** |
|
|
99
|
+
|
|
100
|
+
For SQLite: set `DB_TYPE=sqlite` and `DB_NAME=./data/myapp.db`.
|
|
101
|
+
`DB_HOST`, `DB_PORT`, `DB_USER`, `DB_PASSWORD` are ignored for SQLite.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Section: Logging
|
|
106
|
+
|
|
107
|
+
| Parameter | Type | Default |
|
|
108
|
+
|---|---|---|
|
|
109
|
+
| `LOG_LEVEL` | string | `debug` |
|
|
110
|
+
| `LOG_TO_FILE` | boolean | `true` |
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
## Section: SQL Logging
|
|
115
|
+
|
|
116
|
+
| Parameter | Type | Default |
|
|
117
|
+
|---|---|---|
|
|
118
|
+
| `SQL_LOG_ENABLED` | boolean | `false` |
|
|
119
|
+
| `SQL_LOG_LEVEL` | string | `debug` |
|
|
120
|
+
| `SQL_LOG_PARAMS` | boolean | `false` |
|
|
121
|
+
| `SQL_LOG_SLOW_THRESHOLD` | integer | `1000` |
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Section: Cache
|
|
126
|
+
|
|
127
|
+
| Parameter | Type | Default |
|
|
128
|
+
|---|---|---|
|
|
129
|
+
| `CACHE_ENABLED` | boolean | `false` |
|
|
130
|
+
| `CACHE_TTL` | integer | `300` |
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Section: Job Scheduler
|
|
135
|
+
|
|
136
|
+
| Parameter | Type | Default |
|
|
137
|
+
|---|---|---|
|
|
138
|
+
| `JOB_ENABLED` | boolean | `false` |
|
|
139
|
+
| `JOB_CONCURRENCY` | integer | `5` |
|
|
140
|
+
| `JOB_RETENTION_HOURS` | integer | `72` |
|
|
141
|
+
| `JOB_FAILED_RETENTION_HOURS` | integer | `168` |
|
|
142
|
+
| `JOB_SHUTDOWN_TIMEOUT` | integer | `10000` |
|
|
143
|
+
| `JOB_STALLED_INTERVAL` | integer | `30000` |
|
|
144
|
+
| `JOB_MAX_STALLED_COUNT` | integer | `2` |
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Section: Distributed Lock
|
|
149
|
+
|
|
150
|
+
| Parameter | Type | Default |
|
|
151
|
+
|---|---|---|
|
|
152
|
+
| `LOCK_DISTRIBUTED_ENABLED` | boolean | `false` |
|
|
153
|
+
| `LOCK_DISTRIBUTED_TTL` | integer | `10` |
|
|
154
|
+
| `LOCK_RESOURCE_MAX_TTL` | integer | `600` |
|
|
155
|
+
| `LOCK_DISTRIBUTED_RETRY` | integer | `3` |
|
|
156
|
+
| `LOCK_DISTRIBUTED_RETRY_DELAY` | integer | `100` |
|
|
157
|
+
| `LOCK_DISTRIBUTED_STRATEGY` | string | `reject` |
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Section: ID Generator
|
|
162
|
+
|
|
163
|
+
| Parameter | Type | Default |
|
|
164
|
+
|---|---|---|
|
|
165
|
+
| `IDGEN_ENABLED` | boolean | `false` |
|
|
166
|
+
| `IDGEN_IDEM_TTL` | integer | `600` |
|
|
167
|
+
| `IDGEN_COUNTER_TTL_MONTHLY` | integer | `2764800` |
|
|
168
|
+
| `IDGEN_COUNTER_TTL_DAILY` | integer | `172800` |
|
|
169
|
+
| `IDGEN_DEFAULT_MAX_RETRY` | integer | `10` |
|
|
170
|
+
| `IDGEN_DEFAULT_PIN_DIGITS` | integer | `6` |
|
|
171
|
+
| `IDGEN_DEFAULT_SERIAL_PATTERN` | string | `XXXX-XXXX-XXXX-XXXX` |
|
|
172
|
+
| `IDGEN_DEFAULT_CODE_PATTERN` | string | `9999-9999` |
|
|
173
|
+
| `IDGEN_ALLOW_RESET` | boolean | `false` |
|