domma-cms 0.25.14 → 0.25.16

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.
Files changed (45) hide show
  1. package/admin/js/app.js +2 -2
  2. package/admin/js/templates/api-reference.html +68 -1233
  3. package/admin/js/templates/docs/api-actions.html +146 -0
  4. package/admin/js/templates/docs/api-authentication.html +202 -0
  5. package/admin/js/templates/docs/api-collections.html +347 -0
  6. package/admin/js/templates/docs/api-layouts.html +123 -0
  7. package/admin/js/templates/docs/api-media.html +158 -0
  8. package/admin/js/templates/docs/api-navigation.html +99 -0
  9. package/admin/js/templates/docs/api-pages.html +214 -0
  10. package/admin/js/templates/docs/api-plugins.html +136 -0
  11. package/admin/js/templates/docs/api-settings.html +148 -0
  12. package/admin/js/templates/docs/api-users.html +189 -0
  13. package/admin/js/templates/docs/api-views.html +142 -0
  14. package/admin/js/templates/docs/components-howto.html +175 -0
  15. package/admin/js/templates/docs/components-reference.html +259 -0
  16. package/admin/js/templates/docs/components-rules.html +167 -0
  17. package/admin/js/templates/docs/components-walkthrough.html +167 -0
  18. package/admin/js/templates/docs/tutorial-crud.html +344 -0
  19. package/admin/js/templates/docs/tutorial-forms.html +93 -0
  20. package/admin/js/templates/docs/tutorial-plugin.html +234 -0
  21. package/admin/js/templates/docs/usage-actions.html +122 -0
  22. package/admin/js/templates/docs/usage-cta-shortcode.html +124 -0
  23. package/admin/js/templates/docs/usage-dconfig.html +148 -0
  24. package/admin/js/templates/docs/usage-media.html +25 -0
  25. package/admin/js/templates/docs/usage-navigation.html +31 -0
  26. package/admin/js/templates/docs/usage-pages.html +68 -0
  27. package/admin/js/templates/docs/usage-plugins.html +36 -0
  28. package/admin/js/templates/docs/usage-shortcodes.html +810 -0
  29. package/admin/js/templates/docs/usage-site-settings.html +52 -0
  30. package/admin/js/templates/docs/usage-users-roles.html +84 -0
  31. package/admin/js/templates/docs/usage-views.html +105 -0
  32. package/admin/js/templates/documentation.html +60 -1522
  33. package/admin/js/templates/tutorials.html +46 -659
  34. package/admin/js/views/api-reference.js +1 -1
  35. package/admin/js/views/doc-pages.js +1 -0
  36. package/admin/js/views/documentation.js +1 -1
  37. package/admin/js/views/index.js +1 -1
  38. package/admin/js/views/tutorials.js +1 -1
  39. package/config/menus/admin-sidebar.json +76 -6
  40. package/package.json +1 -1
  41. package/public/js/site.js +1 -1
  42. package/server/server.js +3 -1
  43. package/server/services/menus.js +18 -0
  44. package/server/services/renderer.js +2 -0
  45. package/server/services/sidebar-migration.js +145 -3
@@ -0,0 +1,344 @@
1
+ <div class="view-header">
2
+ <h1><span data-icon="document"></span> Building a CRUD App</h1>
3
+ <a href="#/tutorials" class="btn btn-ghost btn-sm"><span data-icon="arrow-left"></span> All tutorials</a>
4
+ </div>
5
+
6
+ <div class="row">
7
+ <div class="col-12">
8
+ <div class="docs-body" id="tutorial-crud">
9
+
10
+ <p class="lead">
11
+ A "CRUD app" — Create, Read, Update, Delete — is the shape of almost every business
12
+ tool you'll ever build. Onboarding, bookings, contacts, tickets, orders, RSVPs,
13
+ classified ads. Domma CMS gives you everything to build one without writing
14
+ JavaScript, but the trick is understanding <em>why</em> the pieces compose the way
15
+ they do. That's what this tutorial is for.
16
+ </p>
17
+
18
+ <hr>
19
+
20
+ <h2>The mental model</h2>
21
+
22
+ <p>Before we build anything, the picture you want in your head:</p>
23
+
24
+ <p>A CRUD app is just <strong>somewhere to put data</strong>, <strong>a way for people to give it to you</strong>,
25
+ <strong>buttons that change it once it's there</strong>, and <strong>a page that shows it back</strong>.
26
+ Domma CMS gives each of those a name:</p>
27
+
28
+ <ul>
29
+ <li><strong>Collection</strong> — the data store. Think "spreadsheet": rows are records, columns are fields with types.</li>
30
+ <li><strong>Form</strong> — how new records get added. It writes to a Collection on submit.</li>
31
+ <li><strong>Action</strong> — a server-side button that changes existing records. "Approve", "Withdraw", "Send invoice".</li>
32
+ <li><strong>Page</strong> — a Markdown page with <em>shortcodes</em> that render forms and lists from your collections.</li>
33
+ </ul>
34
+
35
+ <p>These are deliberately separate. A single Collection might be written to by three different Forms
36
+ (one for staff, one for the public, one for an import job) and read by four different Pages (a
37
+ dashboard, a public listing, a per-user "my entries" view, a printable report). Keeping them
38
+ separate is what lets the same data drive multiple experiences.</p>
39
+
40
+ <div class="alert alert-info">
41
+ <strong>Why not a database?</strong> Collections store as flat JSON files on disk by default —
42
+ no database to install, no SQL to learn, no migrations. When you outgrow that, switch
43
+ individual collections to MongoDB without changing any of your pages or forms. The
44
+ compatibility layer is the point.
45
+ </div>
46
+
47
+ <hr>
48
+
49
+ <h2>Step 1 — Create the Collection (your data store)</h2>
50
+
51
+ <p>Open <a href="#/collections">Collections</a> → <strong>New collection</strong>. You'll give it a
52
+ slug (the URL-safe name we use in shortcodes), a title, and a list of fields.</p>
53
+
54
+ <p><strong>The slug matters more than you'd think.</strong> It's what every Form, Action, and shortcode
55
+ uses to refer to this collection — so pick a noun and stick with it. <code>jobs</code>,
56
+ <code>applications</code>, <code>contacts</code>, <code>events</code>. Don't pluralise inconsistently
57
+ and don't include the word "data" or "collection" in the slug — that's redundant.</p>
58
+
59
+ <p><strong>Fields are where the design lives.</strong> Each field has a <em>type</em>, and the type isn't
60
+ just for show — it drives every downstream behaviour:</p>
61
+
62
+ <ul>
63
+ <li><code>text</code> renders a text input on forms and is searchable in the Browser</li>
64
+ <li><code>number</code> renders a number input, gets a min/max range filter automatically</li>
65
+ <li><code>select</code> with options becomes a dropdown both on forms AND in the filter rail</li>
66
+ <li><code>multiselect</code> becomes a checkbox group AND a filterable tag chip set</li>
67
+ <li><code>date</code> renders a date picker AND gets a from/to range filter</li>
68
+ <li><code>file</code> renders a file upload with mime/size validation</li>
69
+ <li><code>reference</code> stores a link to another collection's entry — auto-renders as a populated dropdown</li>
70
+ </ul>
71
+
72
+ <p>Pick the right type at design time and you get the right form input, the right filter UI, and the
73
+ right validation, all for free. Pick <code>text</code> for everything and you have to recreate all
74
+ that yourself.</p>
75
+
76
+ <p><strong>Tip:</strong> always include a <code>status</code> field as a <code>select</code> with values
77
+ like <em>pending</em>, <em>reviewing</em>, <em>approved</em>, <em>rejected</em>. This is what makes
78
+ state-machine transitions possible later. You don't need it until you do, but adding it later means
79
+ back-filling every existing record. Add it on day one.</p>
80
+
81
+ <hr>
82
+
83
+ <h2>Step 2 — Read the data (display it on a page)</h2>
84
+
85
+ <p>You don't need code to list a Collection on a public page. Drop this in any Markdown page:</p>
86
+
87
+ <pre class="code-block"><code>[collection slug="jobs" display="cards" columns="3"
88
+ title-field="title" sort="postedAt" order="desc"
89
+ fields="company,location,salary,type" /]</code></pre>
90
+
91
+ <p>That single shortcode gives you a server-rendered, cached, SEO-friendly grid of cards. The server
92
+ reads the collection at request time, filters it, sorts it, and produces static HTML — every
93
+ visitor gets the same instant render. The page is cached per role, so a million visitors viewing
94
+ a public page hit the cache and never touch the data store.</p>
95
+
96
+ <p><strong>Five display modes are built in:</strong></p>
97
+
98
+ <ul>
99
+ <li><code>display="table"</code> — sortable, paginated, with a search box</li>
100
+ <li><code>display="cards"</code> — visual grid (default 3 columns; configurable)</li>
101
+ <li><code>display="list"</code> — vertical stack with title + meta</li>
102
+ <li><code>display="accordion"</code> — expandable rows, title visible, body hidden until clicked</li>
103
+ <li><code>display="timeline"</code> — chronological with dates and statuses</li>
104
+ </ul>
105
+
106
+ <p>All five display the same data; you pick the right shape for the page. A directory might use
107
+ <code>cards</code>; an admin overview might use <code>table</code>; a history page might use
108
+ <code>timeline</code>.</p>
109
+
110
+ <h3>Make it interactive — flip on the Browser</h3>
111
+
112
+ <p>Adding any of <code>searchable</code>, <code>filterable</code>, or <code>sortable</code> upgrades the
113
+ static list to a full <strong>Collection Browser</strong>:</p>
114
+
115
+ <pre class="code-block"><code>[collection slug="jobs" display="cards" columns="3"
116
+ searchable
117
+ filterable="location,type,salary,tags"
118
+ sortable
119
+ page-size="9"
120
+ empty="No matching jobs." /]</code></pre>
121
+
122
+ <p>Now the page has a search box, a filter rail down the left side, a sort dropdown, and pagination —
123
+ all generated automatically from the schema you wrote in Step 1. The Browser is the moment your
124
+ app starts to feel like an app rather than a brochure.</p>
125
+
126
+ <p><strong>Why the filter rail is automatic:</strong> remember each field has a type? The Browser
127
+ reads those types and builds the appropriate control. <code>location</code> (text) becomes a
128
+ dropdown of distinct values harvested from the data. <code>salary</code> (number) becomes a
129
+ min/max range with a slider. <code>tags</code> (multiselect) becomes toggleable chips with counts.
130
+ You authored zero filter logic.</p>
131
+
132
+ <hr>
133
+
134
+ <h2>Step 3 — Create new records (the Form)</h2>
135
+
136
+ <p>Open <a href="#/forms">Forms</a> → <strong>New form</strong>. The slug here is the form's identity —
137
+ what you embed on a page with <code>[form name="..." /]</code>.</p>
138
+
139
+ <p>Form fields can mirror the collection fields exactly, or they can be a subset. <strong>You almost
140
+ always want a subset.</strong> Fields like <code>status</code> shouldn't appear on a public-facing
141
+ submission form — the form should set status to <em>"pending"</em> automatically. Fields like
142
+ <code>internalNotes</code> shouldn't be visible to the submitter at all. The form is your
143
+ audience-facing slice of the collection; design it for who's filling it in.</p>
144
+
145
+ <p>Wire the form to the collection in <strong>Actions → Collection</strong>: enable it and pick the
146
+ target collection slug. Every submission becomes one new entry in that collection. Done.</p>
147
+
148
+ <h3>Identity capture (the small thing that makes everything work)</h3>
149
+
150
+ <p>When a signed-in user submits a form, the CMS automatically stamps the new entry with their user
151
+ id (in the entry's <code>meta.createdBy</code>) AND passes their identity into any actions the
152
+ form fires. That's how the "My applications" view later works without any extra config: you ask
153
+ for "entries created by the current user" and the platform already has that data.</p>
154
+
155
+ <p>Anonymous submissions still work — <code>createdBy</code> is null and the action receives an empty
156
+ user. So one form can serve both anonymous contact-us submissions AND authenticated apply-for-this-job
157
+ submissions; the difference shows up in what the action templates can resolve.</p>
158
+
159
+ <hr>
160
+
161
+ <h2>Step 4 — Change records over time (the Action)</h2>
162
+
163
+ <p>This is where most no-code platforms top out. An Action is a server-side button: visitors click it
164
+ on a page, the server runs a sequence of steps against the entry they clicked on, and the page
165
+ refreshes.</p>
166
+
167
+ <p>Steps include: <code>updateField</code> (set one field to a new value), <code>deleteEntry</code>
168
+ (remove the entry), <code>createInCollection</code> (write a related entry to another collection
169
+ — this is how "apply for this job" creates an application without losing the job), <code>email</code>
170
+ (send a notification using the entry's fields as template variables), and <code>webhook</code>
171
+ (POST to an external service).</p>
172
+
173
+ <h3>The transition is the magic word</h3>
174
+
175
+ <p>Actions can declare a <strong>transition</strong> — "this action moves the entry's status from
176
+ <em>pending</em> to <em>reviewing</em>". That single addition unlocks two huge things:</p>
177
+
178
+ <ol>
179
+ <li><strong>Server-side guard.</strong> Try to run "withdraw" on an already-rejected application
180
+ and the server refuses with HTTP 409. The illegal move can't happen, even if someone copies
181
+ and edits the URL.
182
+ </li>
183
+ <li><strong>Per-row UI.</strong> Add <code>transitions</code> to a <code>[collection]</code> block
184
+ and each row sprouts buttons for exactly the transitions legally available given that row's
185
+ current status AND the viewer's role. A candidate sees "Withdraw" on their pending application;
186
+ an admin sees "Move to reviewing"; a candidate viewing a rejected application sees nothing
187
+ to click. No client-side conditionals; the rules live entirely in the action definitions.
188
+ </li>
189
+ </ol>
190
+
191
+ <pre class="code-block"><code>{
192
+ "slug": "withdraw-application",
193
+ "title": "Withdraw",
194
+ "collection": "applications",
195
+ "transition": { "field": "status", "from": ["submitted", "reviewing"], "to": "withdrawn" },
196
+ "access": { "roles": ["candidate"], "rowLevel": { "mode": "owner" } },
197
+ "steps": [
198
+ { "type": "updateField", "config": { "field": "status", "value": "withdrawn" } }
199
+ ]
200
+ }</code></pre>
201
+
202
+ <p>Read that JSON like a sentence: <em>"Anyone with the candidate role can withdraw their own
203
+ application as long as it's currently submitted or reviewing."</em> The platform enforces every
204
+ clause: <code>access.roles</code> for the role check, <code>rowLevel.mode: 'owner'</code> so
205
+ candidates can only touch their own entries, <code>transition.from</code> for the status guard.
206
+ Together they're the whole authorisation policy for this one button.</p>
207
+
208
+ <hr>
209
+
210
+ <h2>Step 5 — Who sees what (Visibility + scope)</h2>
211
+
212
+ <p>Pages have a <code>visibility</code> frontmatter field that decides who can load the page at all.
213
+ It accepts a single role (<em>"editor and everyone above"</em>) or an array of roles
214
+ (<em>"candidates OR employers"</em>). Roles are hierarchical — higher-privilege roles inherit
215
+ access to lower-privilege gated pages without you adding them explicitly.</p>
216
+
217
+ <p>For per-user data <em>within</em> a page that mixed-role users share — like a "My applications"
218
+ block on a dashboard that both candidates and employers visit — use <code>scope="mine"</code>:</p>
219
+
220
+ <pre class="code-block"><code>[collection slug="applications" scope="mine"
221
+ display="cards" title-field="jobId"
222
+ fields="jobId,status,submittedAt"
223
+ empty="You haven't applied yet." /]</code></pre>
224
+
225
+ <p>The page itself stays cached per role; the per-user block renders client-side via a small hydration
226
+ request that injects <code>createdBy = current-user-id</code> server-side (the client can never
227
+ tamper with which user's data they see). Anonymous visitors see a sign-in prompt where the block
228
+ would render.</p>
229
+
230
+ <p>For cross-collection scoping — <em>"recruiter sees only applications for jobs they posted"</em> —
231
+ use the <code>reference</code> row-access mode in your action's <code>access.rowLevel</code>. The
232
+ platform resolves the reference to check ownership on the target. <a
233
+ href="/docs/configuration.md" target="_blank">Full row-access reference</a> covers all three
234
+ modes (<code>owner</code>, <code>field</code>, <code>reference</code>) with worked examples.</p>
235
+
236
+ <hr>
237
+
238
+ <h2>Step 6 — Files, references, and "feels like a real app"</h2>
239
+
240
+ <p>Three field types deserve their own mention because they're where Domma stops looking like a CMS
241
+ and starts looking like a development platform:</p>
242
+
243
+ <p><strong>File fields</strong> (<code>type: "file"</code>) render a native file picker that uploads
244
+ to <code>/content/media/</code> with mime + size validation, then stores a reference object
245
+ <code>{url, name, size, mime}</code> on the entry. Image mimes auto-display as thumbnails on the
246
+ page; PDFs and docs become "download" links. The form switches to multipart submission
247
+ automatically the moment any file input has a selection — no extra config.</p>
248
+
249
+ <p><strong>Reference fields</strong> (<code>type: "reference"</code>) store the id of another
250
+ collection's entry. The form picker becomes a populated dropdown of the target collection's
251
+ entries (showing the <code>displayField</code>); the page display resolves to the readable label
252
+ everywhere; with a <code>linkTemplate</code> the label becomes a clickable link to the target's
253
+ detail page. Validation refuses to save an entry pointing at a non-existent target. Dangling
254
+ references (target deleted later) render as "<em>id</em> (missing)" instead of crashing the page.</p>
255
+
256
+ <p><strong>Status fields</strong> with <code>options</code> + paired <code>transition</code>-bearing
257
+ actions = a workflow. We covered this in Step 4 but it deserves repeating: the combination of a
258
+ typed status field, a few actions with <code>transition.from</code>, and the <code>transitions</code>
259
+ attribute on a <code>[collection]</code> shortcode gives you a real state machine that's enforced
260
+ everywhere (UI, API, audit) with no JavaScript.</p>
261
+
262
+ <hr>
263
+
264
+ <h2>Step 7 — The Browser tour (advanced reading UI)</h2>
265
+
266
+ <p>We touched on the Browser in Step 2. Here's the rest of what it does for free once you turn it
267
+ on with <code>searchable filterable=... sortable</code>:</p>
268
+
269
+ <ul>
270
+ <li><strong>Faceted filter counts</strong> — every filter chip shows the count of entries that
271
+ would match if that option were toggled with current other filters. Standard ecommerce-style
272
+ faceted browsing.</li>
273
+ <li><strong>Empty state with "Clear filters"</strong> — when the user narrows to zero results,
274
+ one click resets and gets them un-stuck.</li>
275
+ <li><strong>Saved searches</strong> — dropdown in the header lets users name and recall their
276
+ favourite filter combinations.</li>
277
+ <li><strong>CSV export</strong> — add <code>exportable</code> and a button generates a CSV of the
278
+ current filtered set.</li>
279
+ <li><strong>Mobile filter drawer</strong> — narrow viewports get a "Filters (n)" button that
280
+ slides the rail in from the left as an overlay.</li>
281
+ <li><strong>URL state sync</strong> — every change writes to the URL query string, so deep-links
282
+ and the browser back button work.</li>
283
+ <li><strong>Relevance sort during search</strong> — when the search box has a term, results
284
+ re-order by match count with a 3× boost on matches in the title field.</li>
285
+ <li><strong>Keyboard shortcuts</strong> — <code>/</code> focuses search, <code>←</code>/<code>→</code>
286
+ pages.</li>
287
+ <li><strong>Infinite scroll</strong> — <code>pagination="scroll"</code> replaces the pager with
288
+ a sentinel that loads more on scroll.</li>
289
+ <li><strong>Server-mode for huge datasets</strong> — <code>mode="server"</code> makes every
290
+ change round-trip to the API; the storage adapter (Mongo or File) handles the query;
291
+ authoring stays identical.</li>
292
+ </ul>
293
+
294
+ <p>None of this requires any JavaScript on your part. You add attribute names to a shortcode.</p>
295
+
296
+ <hr>
297
+
298
+ <h2>Pulling it together — the worked example</h2>
299
+
300
+ <p>A <strong>job board</strong> uses every primitive in this tutorial:</p>
301
+
302
+ <ol>
303
+ <li>Two collections: <code>jobs</code> (employer posts roles) and <code>applications</code> (candidates apply)</li>
304
+ <li><code>applications</code> has a <code>reference</code> field <code>jobId</code> pointing at <code>jobs</code></li>
305
+ <li><code>applications</code> has a <code>file</code> field <code>resume</code> for the candidate's PDF</li>
306
+ <li>A public <code>[collection slug="jobs"]</code> on <code>/jobs</code> with the Browser turned on</li>
307
+ <li>An apply form that writes to <code>applications</code> + an action that emails HR</li>
308
+ <li>A dashboard at <code>/dashboard</code> with <code>visibility: [candidate, employer]</code> and
309
+ two <code>[collection scope="mine"]</code> blocks (one per role)</li>
310
+ <li>Transition actions: <em>start-review</em>, <em>invite-to-interview</em>, <em>make-offer</em>,
311
+ <em>reject</em>, <em>withdraw</em> — each with its own role + state guards</li>
312
+ <li>The candidate dashboard adds <code>transitions</code> and each row gets the right buttons
313
+ for its current status</li>
314
+ <li>Recruiters get <code>access.rowLevel: { mode: 'reference', field: 'jobId', targetCollection: 'jobs' }</code>
315
+ on their transition actions so they only ever see applications for jobs they posted</li>
316
+ </ol>
317
+
318
+ <p>That's a complete recruitment platform built in pure JSON + Markdown. The full annotated build
319
+ lives at <a href="/docs/recruitment-recipe.md" target="_blank">docs/recruitment-recipe.md</a>.</p>
320
+
321
+ <hr>
322
+
323
+ <h2>Skip ahead — scaffold a working CRUD system in one click</h2>
324
+
325
+ <p>Reading is one thing; having a real working subsystem to poke at is another. The CMS ships with
326
+ starter <em>recipes</em> that scaffold a complete Collection + Form + Actions in a single
327
+ operation. Try one now:</p>
328
+
329
+ <div id="tutorial-scaffolder-mount" style="margin-top:1rem;"></div>
330
+
331
+ <p class="text-muted" style="margin-top:1rem;font-size:.9rem;">
332
+ Recipes are JSON files under <code>server/services/recipes/</code> — copy one as a starting
333
+ point for your own. The <a href="/docs/scaffolding.md" target="_blank">scaffolding docs</a>
334
+ cover the recipe format in full.
335
+ </p>
336
+
337
+ <hr>
338
+ <p class="text-muted" style="font-size:.9rem;">
339
+ Next: <a href="#/tutorials/plugin">Writing a Plugin →</a>
340
+ </p>
341
+
342
+ </div>
343
+ </div>
344
+ </div>
@@ -0,0 +1,93 @@
1
+ <div class="view-header">
2
+ <h1><span data-icon="document"></span> Form Follow-Up</h1>
3
+ <a href="#/tutorials" class="btn btn-ghost btn-sm"><span data-icon="arrow-left"></span> All tutorials</a>
4
+ </div>
5
+
6
+ <div class="row">
7
+ <div class="col-12">
8
+ <div class="docs-body">
9
+
10
+ <p>Every form in Domma CMS can trigger up to four things after a submission is stored:</p>
11
+ <ol>
12
+ <li>Send an <strong>email notification</strong> to one or more recipients</li>
13
+ <li>POST to a <strong>webhook URL</strong></li>
14
+ <li>Execute a <strong>CMS Action</strong> (Pro)</li>
15
+ <li>Redirect the visitor to a <strong>success page</strong> (or show an inline message)</li>
16
+ </ol>
17
+ <p>These are configured per-form in the admin. Open any form in <a href="#/forms">Forms</a> and go to
18
+ the <strong>Settings</strong> and <strong>Actions</strong> tabs.</p>
19
+
20
+ <hr>
21
+
22
+ <h3>1. Email notification</h3>
23
+ <p>Go to the <strong>Actions</strong> tab of your form and enable <em>Send email on submit</em>. Enter
24
+ one or more comma-separated recipient addresses. This uses the SMTP settings configured in
25
+ <a href="#/settings">Site Settings → Email / SMTP</a>.</p>
26
+
27
+ <pre class="code-block"><code>Recipients: admin@example.com, team@example.com
28
+ Subject Prefix: [Contact Form]</code></pre>
29
+
30
+ <h3>2. Webhook</h3>
31
+ <p>Enable <em>POST to webhook on submit</em> and enter a URL. Domma will POST the following JSON body:</p>
32
+ <pre class="code-block"><code>{
33
+ "form": "enquiries",
34
+ "data": {
35
+ "full_name": "Jane Smith",
36
+ "email": "jane@example.com",
37
+ "message": "Hello!"
38
+ }
39
+ }</code></pre>
40
+ <p>Use this to integrate with Zapier, Make, Slack, or any HTTP endpoint.</p>
41
+
42
+ <h3>3. CMS Action (Pro)</h3>
43
+ <p>Actions are reusable workflow steps defined in <a href="#/actions">Actions</a>. A single action can
44
+ chain multiple steps: update a field, move an entry to another collection, send an email, call a
45
+ webhook, or delete an entry.</p>
46
+ <p>To wire an Action to a form:</p>
47
+ <ol>
48
+ <li>Create an Action in <a href="#/actions">Actions</a> targeting the same collection as your form.</li>
49
+ <li>Open the form in <a href="#/forms">Forms</a> → <strong>Actions</strong> tab → <strong>CMS
50
+ Action</strong> card.
51
+ </li>
52
+ <li>Select the Action from the dropdown and save.</li>
53
+ </ol>
54
+ <p>The Action runs server-side, after the entry is saved. If it fails (e.g. MongoDB is not
55
+ configured), the submission is still stored — the action failure is non-fatal and logged as a
56
+ warning.</p>
57
+
58
+ <h3>4. Success message vs. redirect</h3>
59
+ <p>After a successful submission the visitor sees one of two things:</p>
60
+ <ul>
61
+ <li><strong>Inline success message</strong> — the form is replaced by the text set in
62
+ <em>Settings → Success Message</em>. Good for simple acknowledgements.
63
+ </li>
64
+ <li><strong>Page redirect</strong> — the visitor is sent to the URL set in
65
+ <em>Settings → Success Redirect URL</em>. Good for registration flows, checkouts, or when you
66
+ want a full thank-you page with additional content. <strong>Takes priority</strong> if both are
67
+ set.
68
+ </li>
69
+ </ul>
70
+ <p>Example: set <em>Success Redirect URL</em> to <code>/thank-you</code> and create a
71
+ <code>thank-you.md</code> page in the CMS with any content you like.</p>
72
+
73
+ <h3>Execution order</h3>
74
+ <p>On every submission, the pipeline runs in this fixed order:</p>
75
+ <ol>
76
+ <li>Validate fields + honeypot + rate limit</li>
77
+ <li>Store entry to collection</li>
78
+ <li>Send email (if enabled)</li>
79
+ <li>Call webhook (if enabled)</li>
80
+ <li>Execute CMS Action (if set)</li>
81
+ <li>Return success response → client redirects or shows message</li>
82
+ </ol>
83
+ <p>Steps 3–5 are non-fatal: a failure in any of them is logged as a warning but does not prevent the
84
+ submission from being stored or the success response from being returned.</p>
85
+
86
+ <hr>
87
+ <p class="text-muted" style="font-size:.9rem;">
88
+ <a href="#/tutorials">← Back to all tutorials</a>
89
+ </p>
90
+
91
+ </div>
92
+ </div>
93
+ </div>