@plures/praxis 0.2.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.
Files changed (263) hide show
  1. package/FRAMEWORK.md +420 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1310 -0
  4. package/dist/adapters/cli.d.ts +43 -0
  5. package/dist/adapters/cli.d.ts.map +1 -0
  6. package/dist/adapters/cli.js +126 -0
  7. package/dist/adapters/cli.js.map +1 -0
  8. package/dist/cli/commands/auth.d.ts +26 -0
  9. package/dist/cli/commands/auth.d.ts.map +1 -0
  10. package/dist/cli/commands/auth.js +233 -0
  11. package/dist/cli/commands/auth.js.map +1 -0
  12. package/dist/cli/commands/cloud.d.ts +27 -0
  13. package/dist/cli/commands/cloud.d.ts.map +1 -0
  14. package/dist/cli/commands/cloud.js +232 -0
  15. package/dist/cli/commands/cloud.js.map +1 -0
  16. package/dist/cli/commands/generate.d.ts +25 -0
  17. package/dist/cli/commands/generate.d.ts.map +1 -0
  18. package/dist/cli/commands/generate.js +168 -0
  19. package/dist/cli/commands/generate.js.map +1 -0
  20. package/dist/cli/index.d.ts +8 -0
  21. package/dist/cli/index.d.ts.map +1 -0
  22. package/dist/cli/index.js +179 -0
  23. package/dist/cli/index.js.map +1 -0
  24. package/dist/cloud/auth.d.ts +51 -0
  25. package/dist/cloud/auth.d.ts.map +1 -0
  26. package/dist/cloud/auth.js +194 -0
  27. package/dist/cloud/auth.js.map +1 -0
  28. package/dist/cloud/billing.d.ts +184 -0
  29. package/dist/cloud/billing.d.ts.map +1 -0
  30. package/dist/cloud/billing.js +179 -0
  31. package/dist/cloud/billing.js.map +1 -0
  32. package/dist/cloud/client.d.ts +39 -0
  33. package/dist/cloud/client.d.ts.map +1 -0
  34. package/dist/cloud/client.js +176 -0
  35. package/dist/cloud/client.js.map +1 -0
  36. package/dist/cloud/index.d.ts +44 -0
  37. package/dist/cloud/index.d.ts.map +1 -0
  38. package/dist/cloud/index.js +44 -0
  39. package/dist/cloud/index.js.map +1 -0
  40. package/dist/cloud/marketplace.d.ts +166 -0
  41. package/dist/cloud/marketplace.d.ts.map +1 -0
  42. package/dist/cloud/marketplace.js +159 -0
  43. package/dist/cloud/marketplace.js.map +1 -0
  44. package/dist/cloud/provisioning.d.ts +110 -0
  45. package/dist/cloud/provisioning.d.ts.map +1 -0
  46. package/dist/cloud/provisioning.js +148 -0
  47. package/dist/cloud/provisioning.js.map +1 -0
  48. package/dist/cloud/relay/endpoints.d.ts +62 -0
  49. package/dist/cloud/relay/endpoints.d.ts.map +1 -0
  50. package/dist/cloud/relay/endpoints.js +217 -0
  51. package/dist/cloud/relay/endpoints.js.map +1 -0
  52. package/dist/cloud/relay/health/index.d.ts +5 -0
  53. package/dist/cloud/relay/health/index.d.ts.map +1 -0
  54. package/dist/cloud/relay/health/index.js +9 -0
  55. package/dist/cloud/relay/health/index.js.map +1 -0
  56. package/dist/cloud/relay/stats/index.d.ts +5 -0
  57. package/dist/cloud/relay/stats/index.d.ts.map +1 -0
  58. package/dist/cloud/relay/stats/index.js +9 -0
  59. package/dist/cloud/relay/stats/index.js.map +1 -0
  60. package/dist/cloud/relay/sync/index.d.ts +5 -0
  61. package/dist/cloud/relay/sync/index.d.ts.map +1 -0
  62. package/dist/cloud/relay/sync/index.js +9 -0
  63. package/dist/cloud/relay/sync/index.js.map +1 -0
  64. package/dist/cloud/relay/usage/index.d.ts +5 -0
  65. package/dist/cloud/relay/usage/index.d.ts.map +1 -0
  66. package/dist/cloud/relay/usage/index.js +9 -0
  67. package/dist/cloud/relay/usage/index.js.map +1 -0
  68. package/dist/cloud/sponsors.d.ts +81 -0
  69. package/dist/cloud/sponsors.d.ts.map +1 -0
  70. package/dist/cloud/sponsors.js +130 -0
  71. package/dist/cloud/sponsors.js.map +1 -0
  72. package/dist/cloud/types.d.ts +169 -0
  73. package/dist/cloud/types.d.ts.map +1 -0
  74. package/dist/cloud/types.js +7 -0
  75. package/dist/cloud/types.js.map +1 -0
  76. package/dist/components/index.d.ts +43 -0
  77. package/dist/components/index.d.ts.map +1 -0
  78. package/dist/components/index.js +17 -0
  79. package/dist/components/index.js.map +1 -0
  80. package/dist/core/actors.d.ts +95 -0
  81. package/dist/core/actors.d.ts.map +1 -0
  82. package/dist/core/actors.js +158 -0
  83. package/dist/core/actors.js.map +1 -0
  84. package/dist/core/component/generator.d.ts +122 -0
  85. package/dist/core/component/generator.d.ts.map +1 -0
  86. package/dist/core/component/generator.js +307 -0
  87. package/dist/core/component/generator.js.map +1 -0
  88. package/dist/core/engine.d.ts +92 -0
  89. package/dist/core/engine.d.ts.map +1 -0
  90. package/dist/core/engine.js +199 -0
  91. package/dist/core/engine.js.map +1 -0
  92. package/dist/core/introspection.d.ts +141 -0
  93. package/dist/core/introspection.d.ts.map +1 -0
  94. package/dist/core/introspection.js +208 -0
  95. package/dist/core/introspection.js.map +1 -0
  96. package/dist/core/logic/generator.d.ts +76 -0
  97. package/dist/core/logic/generator.d.ts.map +1 -0
  98. package/dist/core/logic/generator.js +339 -0
  99. package/dist/core/logic/generator.js.map +1 -0
  100. package/dist/core/pluresdb/generator.d.ts +58 -0
  101. package/dist/core/pluresdb/generator.d.ts.map +1 -0
  102. package/dist/core/pluresdb/generator.js +162 -0
  103. package/dist/core/pluresdb/generator.js.map +1 -0
  104. package/dist/core/protocol.d.ts +121 -0
  105. package/dist/core/protocol.d.ts.map +1 -0
  106. package/dist/core/protocol.js +46 -0
  107. package/dist/core/protocol.js.map +1 -0
  108. package/dist/core/rules.d.ts +120 -0
  109. package/dist/core/rules.d.ts.map +1 -0
  110. package/dist/core/rules.js +81 -0
  111. package/dist/core/rules.js.map +1 -0
  112. package/dist/core/schema/loader.d.ts +47 -0
  113. package/dist/core/schema/loader.d.ts.map +1 -0
  114. package/dist/core/schema/loader.js +189 -0
  115. package/dist/core/schema/loader.js.map +1 -0
  116. package/dist/core/schema/normalize.d.ts +72 -0
  117. package/dist/core/schema/normalize.d.ts.map +1 -0
  118. package/dist/core/schema/normalize.js +190 -0
  119. package/dist/core/schema/normalize.js.map +1 -0
  120. package/dist/core/schema/types.d.ts +370 -0
  121. package/dist/core/schema/types.d.ts.map +1 -0
  122. package/dist/core/schema/types.js +161 -0
  123. package/dist/core/schema/types.js.map +1 -0
  124. package/dist/dsl/index.d.ts +152 -0
  125. package/dist/dsl/index.d.ts.map +1 -0
  126. package/dist/dsl/index.js +132 -0
  127. package/dist/dsl/index.js.map +1 -0
  128. package/dist/dsl.d.ts +124 -0
  129. package/dist/dsl.d.ts.map +1 -0
  130. package/dist/dsl.js +130 -0
  131. package/dist/dsl.js.map +1 -0
  132. package/dist/examples/advanced-todo/index.d.ts +55 -0
  133. package/dist/examples/advanced-todo/index.d.ts.map +1 -0
  134. package/dist/examples/advanced-todo/index.js +222 -0
  135. package/dist/examples/advanced-todo/index.js.map +1 -0
  136. package/dist/examples/auth-basic/index.d.ts +17 -0
  137. package/dist/examples/auth-basic/index.d.ts.map +1 -0
  138. package/dist/examples/auth-basic/index.js +122 -0
  139. package/dist/examples/auth-basic/index.js.map +1 -0
  140. package/dist/examples/cart/index.d.ts +19 -0
  141. package/dist/examples/cart/index.d.ts.map +1 -0
  142. package/dist/examples/cart/index.js +202 -0
  143. package/dist/examples/cart/index.js.map +1 -0
  144. package/dist/examples/hero-ecommerce/index.d.ts +39 -0
  145. package/dist/examples/hero-ecommerce/index.d.ts.map +1 -0
  146. package/dist/examples/hero-ecommerce/index.js +506 -0
  147. package/dist/examples/hero-ecommerce/index.js.map +1 -0
  148. package/dist/examples/svelte-counter/index.d.ts +31 -0
  149. package/dist/examples/svelte-counter/index.d.ts.map +1 -0
  150. package/dist/examples/svelte-counter/index.js +123 -0
  151. package/dist/examples/svelte-counter/index.js.map +1 -0
  152. package/dist/flows.d.ts +125 -0
  153. package/dist/flows.d.ts.map +1 -0
  154. package/dist/flows.js +160 -0
  155. package/dist/flows.js.map +1 -0
  156. package/dist/index.d.ts +67 -0
  157. package/dist/index.d.ts.map +1 -0
  158. package/dist/index.js +59 -0
  159. package/dist/index.js.map +1 -0
  160. package/dist/integrations/pluresdb.d.ts +56 -0
  161. package/dist/integrations/pluresdb.d.ts.map +1 -0
  162. package/dist/integrations/pluresdb.js +46 -0
  163. package/dist/integrations/pluresdb.js.map +1 -0
  164. package/dist/integrations/svelte.d.ts +306 -0
  165. package/dist/integrations/svelte.d.ts.map +1 -0
  166. package/dist/integrations/svelte.js +447 -0
  167. package/dist/integrations/svelte.js.map +1 -0
  168. package/dist/registry.d.ts +94 -0
  169. package/dist/registry.d.ts.map +1 -0
  170. package/dist/registry.js +181 -0
  171. package/dist/registry.js.map +1 -0
  172. package/dist/runtime/terminal-adapter.d.ts +105 -0
  173. package/dist/runtime/terminal-adapter.d.ts.map +1 -0
  174. package/dist/runtime/terminal-adapter.js +113 -0
  175. package/dist/runtime/terminal-adapter.js.map +1 -0
  176. package/dist/step.d.ts +34 -0
  177. package/dist/step.d.ts.map +1 -0
  178. package/dist/step.js +111 -0
  179. package/dist/step.js.map +1 -0
  180. package/dist/types.d.ts +63 -0
  181. package/dist/types.d.ts.map +1 -0
  182. package/dist/types.js +6 -0
  183. package/dist/types.js.map +1 -0
  184. package/docs/MONETIZATION.md +394 -0
  185. package/docs/TERMINAL_NODE.md +588 -0
  186. package/docs/guides/canvas.md +389 -0
  187. package/docs/guides/getting-started.md +347 -0
  188. package/docs/guides/history-state-pattern.md +618 -0
  189. package/docs/guides/orchestration.md +617 -0
  190. package/docs/guides/parallel-state-pattern.md +767 -0
  191. package/docs/guides/svelte-integration.md +691 -0
  192. package/package.json +96 -0
  193. package/src/__tests__/actors.test.ts +270 -0
  194. package/src/__tests__/billing.test.ts +175 -0
  195. package/src/__tests__/cloud.test.ts +247 -0
  196. package/src/__tests__/dsl.test.ts +154 -0
  197. package/src/__tests__/edge-cases.test.ts +475 -0
  198. package/src/__tests__/engine.test.ts +137 -0
  199. package/src/__tests__/generators.test.ts +270 -0
  200. package/src/__tests__/introspection.test.ts +321 -0
  201. package/src/__tests__/protocol.test.ts +40 -0
  202. package/src/__tests__/provisioning.test.ts +162 -0
  203. package/src/__tests__/schema.test.ts +241 -0
  204. package/src/__tests__/svelte-integration.test.ts +431 -0
  205. package/src/__tests__/terminal-node.test.ts +352 -0
  206. package/src/adapters/cli.ts +175 -0
  207. package/src/cli/commands/auth.ts +271 -0
  208. package/src/cli/commands/cloud.ts +281 -0
  209. package/src/cli/commands/generate.ts +225 -0
  210. package/src/cli/index.ts +190 -0
  211. package/src/cloud/README.md +383 -0
  212. package/src/cloud/auth.ts +245 -0
  213. package/src/cloud/billing.ts +336 -0
  214. package/src/cloud/client.ts +221 -0
  215. package/src/cloud/index.ts +121 -0
  216. package/src/cloud/marketplace.ts +303 -0
  217. package/src/cloud/provisioning.ts +254 -0
  218. package/src/cloud/relay/endpoints.ts +307 -0
  219. package/src/cloud/relay/health/function.json +17 -0
  220. package/src/cloud/relay/health/index.ts +10 -0
  221. package/src/cloud/relay/host.json +15 -0
  222. package/src/cloud/relay/local.settings.json +8 -0
  223. package/src/cloud/relay/stats/function.json +17 -0
  224. package/src/cloud/relay/stats/index.ts +10 -0
  225. package/src/cloud/relay/sync/function.json +17 -0
  226. package/src/cloud/relay/sync/index.ts +10 -0
  227. package/src/cloud/relay/usage/function.json +17 -0
  228. package/src/cloud/relay/usage/index.ts +10 -0
  229. package/src/cloud/sponsors.ts +213 -0
  230. package/src/cloud/types.ts +198 -0
  231. package/src/components/README.md +125 -0
  232. package/src/components/TerminalNode.svelte +457 -0
  233. package/src/components/index.ts +46 -0
  234. package/src/core/actors.ts +205 -0
  235. package/src/core/component/generator.ts +432 -0
  236. package/src/core/engine.ts +243 -0
  237. package/src/core/introspection.ts +329 -0
  238. package/src/core/logic/generator.ts +420 -0
  239. package/src/core/pluresdb/generator.ts +229 -0
  240. package/src/core/protocol.ts +132 -0
  241. package/src/core/rules.ts +167 -0
  242. package/src/core/schema/loader.ts +247 -0
  243. package/src/core/schema/normalize.ts +322 -0
  244. package/src/core/schema/types.ts +557 -0
  245. package/src/dsl/index.ts +218 -0
  246. package/src/dsl.ts +214 -0
  247. package/src/examples/advanced-todo/App.svelte +506 -0
  248. package/src/examples/advanced-todo/README.md +371 -0
  249. package/src/examples/advanced-todo/index.ts +309 -0
  250. package/src/examples/auth-basic/index.ts +163 -0
  251. package/src/examples/cart/index.ts +259 -0
  252. package/src/examples/hero-ecommerce/index.ts +657 -0
  253. package/src/examples/svelte-counter/index.ts +168 -0
  254. package/src/flows.ts +268 -0
  255. package/src/index.ts +154 -0
  256. package/src/integrations/pluresdb.ts +93 -0
  257. package/src/integrations/svelte.ts +617 -0
  258. package/src/registry.ts +223 -0
  259. package/src/runtime/terminal-adapter.ts +175 -0
  260. package/src/step.ts +151 -0
  261. package/src/types.ts +70 -0
  262. package/templates/basic-app/README.md +147 -0
  263. package/templates/fullstack-app/README.md +279 -0
@@ -0,0 +1,389 @@
1
+ # CodeCanvas Integration Guide
2
+
3
+ CodeCanvas is the visual IDE for the Praxis framework. It provides a graphical interface for designing schemas, logic flows, and components.
4
+
5
+ ## Overview
6
+
7
+ CodeCanvas enables:
8
+ - **Visual Schema Design**: Drag-and-drop model and component design
9
+ - **Logic Flow Editor**: Build rules and state machines visually
10
+ - **Component Preview**: See generated components in real-time
11
+ - **Orchestration Visualization**: Visualize distributed systems
12
+ - **Documentation Navigation**: Interactive documentation browser
13
+
14
+ ## Getting Started
15
+
16
+ ### Launch Canvas
17
+
18
+ From your Praxis project:
19
+
20
+ ```bash
21
+ praxis canvas src/schemas/app.schema.ts
22
+ ```
23
+
24
+ This opens Canvas at http://localhost:3000 with your schema loaded.
25
+
26
+ ### Create New Schema
27
+
28
+ Start Canvas without a schema:
29
+
30
+ ```bash
31
+ praxis canvas --new
32
+ ```
33
+
34
+ ## Canvas Features
35
+
36
+ ### 1. Schema Editor
37
+
38
+ **Model Designer**:
39
+ - Drag models onto canvas
40
+ - Define fields with visual editor
41
+ - Set relationships between models
42
+ - Configure indexes and constraints
43
+ - Preview generated PluresDB schema
44
+
45
+ **Component Designer**:
46
+ - Create components from templates
47
+ - Bind components to models
48
+ - Configure props and events
49
+ - Design layout visually
50
+ - Preview generated Svelte components
51
+
52
+ ### 2. Logic Flow Editor
53
+
54
+ **Flow Canvas**:
55
+ - Visual state machine designer
56
+ - Connect facts, events, and rules
57
+ - Define transitions with conditions
58
+ - Test flows interactively
59
+ - Export to Praxis logic code
60
+
61
+ **Rule Builder**:
62
+ - Visual rule editor
63
+ - Condition builder with drag-and-drop
64
+ - Action designer
65
+ - Priority management
66
+ - Constraint visualization
67
+
68
+ ### 3. Component Preview
69
+
70
+ **Live Preview**:
71
+ - Real-time component rendering
72
+ - Interactive component testing
73
+ - Props editor
74
+ - Event logging
75
+ - Responsive preview modes
76
+
77
+ **Code Sync**:
78
+ - Two-way sync with files
79
+ - Live reload on changes
80
+ - Conflict resolution
81
+ - Version history
82
+
83
+ ### 4. Orchestration View
84
+
85
+ **System Topology**:
86
+ - Node visualization
87
+ - Connection mapping
88
+ - State distribution view
89
+ - Health monitoring
90
+ - Performance metrics
91
+
92
+ **DSC Designer**:
93
+ - Visual DSC configuration
94
+ - Node role assignment
95
+ - State sync configuration
96
+ - Health check setup
97
+
98
+ ### 5. Documentation Browser
99
+
100
+ **Interactive Docs**:
101
+ - Schema documentation
102
+ - API reference
103
+ - Component catalog
104
+ - Logic flow diagrams
105
+ - Generated from State-Docs
106
+
107
+ ## Workflows
108
+
109
+ ### Visual-First Workflow
110
+
111
+ 1. Design schema in Canvas
112
+ 2. Generate code with `praxis generate`
113
+ 3. Customize generated code
114
+ 4. Preview in Canvas
115
+ 5. Deploy
116
+
117
+ ### Code-First Workflow
118
+
119
+ 1. Write schema in TypeScript
120
+ 2. Open in Canvas for visualization
121
+ 3. Make visual adjustments in Canvas
122
+ 4. Sync changes back to code
123
+ 5. Continue development
124
+
125
+ ### Hybrid Workflow
126
+
127
+ 1. Start with visual design
128
+ 2. Export to code
129
+ 3. Add custom logic in code
130
+ 4. Use Canvas for visualization
131
+ 5. Iterate between visual and code
132
+
133
+ ## Configuration
134
+
135
+ ### Canvas Config File
136
+
137
+ Create `canvas.config.ts`:
138
+
139
+ ```typescript
140
+ import type { CanvasConfig } from '@plures/praxis/canvas';
141
+
142
+ export const config: CanvasConfig = {
143
+ // Server settings
144
+ port: 3000,
145
+ host: 'localhost',
146
+
147
+ // Editor settings
148
+ mode: 'edit', // 'edit' | 'view' | 'present'
149
+ theme: 'dark', // 'light' | 'dark' | 'auto'
150
+
151
+ // Features
152
+ features: {
153
+ collaboration: true,
154
+ autosave: true,
155
+ versionHistory: true,
156
+ aiAssist: false,
157
+ },
158
+
159
+ // Preview settings
160
+ preview: {
161
+ autoRefresh: true,
162
+ refreshInterval: 1000,
163
+ iframe: true,
164
+ },
165
+
166
+ // Code sync
167
+ sync: {
168
+ enabled: true,
169
+ watchFiles: true,
170
+ conflictResolution: 'ask', // 'ask' | 'canvas' | 'code'
171
+ },
172
+
173
+ // Export settings
174
+ export: {
175
+ format: 'typescript',
176
+ includeComments: true,
177
+ formatting: 'prettier',
178
+ },
179
+ };
180
+ ```
181
+
182
+ ### Launch with Config
183
+
184
+ ```bash
185
+ praxis canvas --config canvas.config.ts
186
+ ```
187
+
188
+ ## Collaboration
189
+
190
+ ### Real-Time Collaboration
191
+
192
+ Enable in config:
193
+
194
+ ```typescript
195
+ features: {
196
+ collaboration: true,
197
+ }
198
+ ```
199
+
200
+ Share Canvas URL with team members. Changes sync in real-time.
201
+
202
+ ### Permissions
203
+
204
+ Configure access:
205
+
206
+ ```typescript
207
+ collaboration: {
208
+ enabled: true,
209
+ permissions: {
210
+ view: ['*'],
211
+ edit: ['team@example.com'],
212
+ admin: ['owner@example.com'],
213
+ },
214
+ }
215
+ ```
216
+
217
+ ## Keyboard Shortcuts
218
+
219
+ - `Ctrl/Cmd + N`: New model
220
+ - `Ctrl/Cmd + C`: Create component
221
+ - `Ctrl/Cmd + R`: Add rule
222
+ - `Ctrl/Cmd + S`: Save
223
+ - `Ctrl/Cmd + G`: Generate code
224
+ - `Ctrl/Cmd + P`: Preview component
225
+ - `Ctrl/Cmd + /`: Command palette
226
+ - `Space`: Pan canvas
227
+ - `+/-`: Zoom in/out
228
+
229
+ ## Tips & Tricks
230
+
231
+ ### Efficient Model Design
232
+
233
+ 1. Start with core models
234
+ 2. Add fields incrementally
235
+ 3. Use Canvas to visualize relationships
236
+ 4. Generate early and often
237
+ 5. Iterate based on generated code
238
+
239
+ ### Logic Flow Design
240
+
241
+ 1. Map business processes first
242
+ 2. Identify key events
243
+ 3. Define facts that matter
244
+ 4. Connect with rules
245
+ 5. Test flows in Canvas
246
+
247
+ ### Component Design
248
+
249
+ 1. Use templates as starting points
250
+ 2. Preview frequently
251
+ 3. Test with different data
252
+ 4. Sync to code for styling
253
+ 5. Maintain separation of concerns
254
+
255
+ ## Integration with VS Code
256
+
257
+ ### Canvas Extension
258
+
259
+ Install the Praxis Canvas extension:
260
+
261
+ ```bash
262
+ code --install-extension plures.praxis-canvas
263
+ ```
264
+
265
+ Features:
266
+ - Open Canvas from editor
267
+ - Inline previews
268
+ - Quick navigation
269
+ - Code snippets
270
+
271
+ ## Troubleshooting
272
+
273
+ ### Canvas won't start
274
+
275
+ Check:
276
+ - Port 3000 is available
277
+ - Schema file path is correct
278
+ - Dependencies are installed
279
+
280
+ ### Changes not syncing
281
+
282
+ Solutions:
283
+ - Enable sync in config
284
+ - Check file permissions
285
+ - Restart Canvas with `--force-sync`
286
+
287
+ ### Preview not updating
288
+
289
+ Try:
290
+ - Clear browser cache
291
+ - Disable ad blockers
292
+ - Check preview refresh settings
293
+
294
+ ## Advanced Features
295
+
296
+ ### Custom Templates
297
+
298
+ Add custom component templates:
299
+
300
+ ```typescript
301
+ canvas: {
302
+ templates: {
303
+ components: [
304
+ {
305
+ name: 'CustomForm',
306
+ template: './templates/custom-form.svelte',
307
+ thumbnail: './templates/custom-form.png',
308
+ },
309
+ ],
310
+ },
311
+ }
312
+ ```
313
+
314
+ ### Plugins
315
+
316
+ Extend Canvas with plugins:
317
+
318
+ ```typescript
319
+ canvas: {
320
+ plugins: [
321
+ '@plures/canvas-plugin-figma',
322
+ '@plures/canvas-plugin-storybook',
323
+ './plugins/custom-plugin.ts',
324
+ ],
325
+ }
326
+ ```
327
+
328
+ ### AI Assistance
329
+
330
+ Enable AI features:
331
+
332
+ ```typescript
333
+ features: {
334
+ aiAssist: true,
335
+ }
336
+ ```
337
+
338
+ AI can:
339
+ - Suggest models from descriptions
340
+ - Generate rules from natural language
341
+ - Optimize logic flows
342
+ - Recommend component layouts
343
+
344
+ ## Export Options
345
+
346
+ ### Export to Code
347
+
348
+ ```bash
349
+ # From Canvas UI: File > Export > TypeScript
350
+ ```
351
+
352
+ Or via CLI:
353
+
354
+ ```bash
355
+ praxis export --source canvas --format typescript
356
+ ```
357
+
358
+ ### Export Diagrams
359
+
360
+ Export visual diagrams:
361
+ - PNG/SVG for documentation
362
+ - Mermaid for markdown
363
+ - DOT for Graphviz
364
+ - PDF for presentations
365
+
366
+ ### Export Documentation
367
+
368
+ Generate State-Docs from Canvas:
369
+
370
+ ```bash
371
+ praxis docs --source canvas
372
+ ```
373
+
374
+ ## Next Steps
375
+
376
+ - Explore example Canvas projects
377
+ - Try collaborative editing
378
+ - Customize with plugins
379
+ - Integrate with CI/CD
380
+ - Share your Canvas templates
381
+
382
+ ## Resources
383
+
384
+ - [Canvas Examples](../../examples/canvas/)
385
+ - [Plugin Development](../api/canvas-plugins.md)
386
+ - [Canvas API Reference](../api/canvas-api.md)
387
+ - [Video Tutorials](https://youtube.com/plures)
388
+
389
+ Canvas makes Praxis development visual, collaborative, and fun! 🎨
@@ -0,0 +1,347 @@
1
+ # Getting Started with Praxis Framework
2
+
3
+ Welcome to Praxis, the full-stack application framework for the Plures ecosystem! This guide will help you get started building modern, local-first, distributed applications.
4
+
5
+ ## What is Praxis?
6
+
7
+ Praxis is a **schema-driven framework** that unifies:
8
+ - **Logic Engine**: Facts, events, rules, and constraints for business logic
9
+ - **Component Generation**: Auto-generate UI from schemas
10
+ - **Local-First Data**: PluresDB for reactive, offline-capable storage
11
+ - **Visual Development**: CodeCanvas for schema and logic editing
12
+ - **Orchestration**: Distributed system coordination with DSC/MCP
13
+ - **Documentation**: Automatic State-Docs generation
14
+
15
+ ## Prerequisites
16
+
17
+ - Node.js 18+ and npm
18
+ - Basic TypeScript knowledge
19
+ - Familiarity with Svelte (for UI)
20
+ - Git for version control
21
+
22
+ ## Installation
23
+
24
+ ### Install Praxis CLI
25
+
26
+ ```bash
27
+ npm install -g @plures/praxis
28
+ ```
29
+
30
+ Verify installation:
31
+ ```bash
32
+ praxis --version
33
+ ```
34
+
35
+ ## Create Your First App
36
+
37
+ ### 1. Create a new project
38
+
39
+ ```bash
40
+ praxis create app my-first-app
41
+ cd my-first-app
42
+ npm install
43
+ ```
44
+
45
+ This creates a basic Praxis app with:
46
+ - Schema setup
47
+ - Logic engine configuration
48
+ - Svelte UI scaffolding
49
+ - PluresDB integration
50
+ - Development scripts
51
+
52
+ ### 2. Explore the structure
53
+
54
+ ```
55
+ my-first-app/
56
+ ├── src/
57
+ │ ├── schemas/
58
+ │ │ └── app.schema.ts # Your app schema
59
+ │ ├── logic/
60
+ │ │ └── engine.ts # Logic engine setup
61
+ │ ├── components/ # UI components
62
+ │ ├── store/ # Data store
63
+ │ └── main.ts # Entry point
64
+ ├── package.json
65
+ └── README.md
66
+ ```
67
+
68
+ ### 3. Define your schema
69
+
70
+ Open `src/schemas/app.schema.ts`:
71
+
72
+ ```typescript
73
+ import type { PraxisSchema } from '@plures/praxis/schema';
74
+
75
+ export const appSchema: PraxisSchema = {
76
+ version: '1.0.0',
77
+ name: 'MyFirstApp',
78
+ description: 'My first Praxis application',
79
+
80
+ // Define data models
81
+ models: [
82
+ {
83
+ name: 'Task',
84
+ description: 'A task item',
85
+ fields: [
86
+ { name: 'id', type: 'string', description: 'Unique identifier' },
87
+ { name: 'title', type: 'string', description: 'Task title' },
88
+ { name: 'completed', type: 'boolean', default: false },
89
+ { name: 'createdAt', type: 'date' },
90
+ ],
91
+ indexes: [
92
+ { name: 'by_created', fields: ['createdAt'] },
93
+ ],
94
+ },
95
+ ],
96
+
97
+ // Define UI components
98
+ components: [
99
+ {
100
+ name: 'TaskForm',
101
+ type: 'form',
102
+ model: 'Task',
103
+ description: 'Form for creating/editing tasks',
104
+ },
105
+ {
106
+ name: 'TaskList',
107
+ type: 'list',
108
+ model: 'Task',
109
+ description: 'List of all tasks',
110
+ },
111
+ ],
112
+
113
+ // Define business logic
114
+ logic: [
115
+ {
116
+ id: 'task-logic',
117
+ description: 'Task management logic',
118
+ events: [
119
+ {
120
+ tag: 'TASK_CREATE',
121
+ payload: { title: 'string' },
122
+ description: 'Create a new task',
123
+ },
124
+ {
125
+ tag: 'TASK_COMPLETE',
126
+ payload: { taskId: 'string' },
127
+ description: 'Mark task as completed',
128
+ },
129
+ ],
130
+ facts: [
131
+ {
132
+ tag: 'TaskCreated',
133
+ payload: { taskId: 'string', title: 'string' },
134
+ description: 'A task was created',
135
+ },
136
+ {
137
+ tag: 'TaskCompleted',
138
+ payload: { taskId: 'string' },
139
+ description: 'A task was completed',
140
+ },
141
+ ],
142
+ rules: [
143
+ {
144
+ id: 'create-task',
145
+ description: 'Create a task when TASK_CREATE event occurs',
146
+ on: ['TASK_CREATE'],
147
+ then: 'emit TaskCreated fact',
148
+ priority: 10,
149
+ },
150
+ ],
151
+ constraints: [
152
+ {
153
+ id: 'task-title-required',
154
+ description: 'Task title must not be empty',
155
+ check: 'title.length > 0',
156
+ message: 'Task title is required',
157
+ },
158
+ ],
159
+ },
160
+ ],
161
+ };
162
+ ```
163
+
164
+ ### 4. Generate code from schema
165
+
166
+ ```bash
167
+ praxis generate --schema src/schemas/app.schema.ts
168
+ ```
169
+
170
+ This generates:
171
+ - `src/components/TaskForm.svelte` - Form component
172
+ - `src/components/TaskList.svelte` - List component
173
+ - `src/logic/facts.ts` - Fact definitions
174
+ - `src/logic/events.ts` - Event definitions
175
+ - `src/logic/rules.ts` - Rule implementations
176
+ - TypeScript types throughout
177
+
178
+ ### 5. Implement custom logic
179
+
180
+ The generator creates stubs that you can customize. Edit `src/logic/rules.ts`:
181
+
182
+ ```typescript
183
+ import { defineRule } from '@plures/praxis';
184
+ import { TaskCreated } from './facts';
185
+ import { TASK_CREATE } from './events';
186
+
187
+ export const createTaskRule = defineRule({
188
+ id: 'create-task',
189
+ description: 'Create a task when TASK_CREATE event occurs',
190
+ impl: (state, events) => {
191
+ const createEvent = events.find(TASK_CREATE.is);
192
+ if (createEvent) {
193
+ const taskId = crypto.randomUUID();
194
+ return [
195
+ TaskCreated.create({
196
+ taskId,
197
+ title: createEvent.payload.title,
198
+ }),
199
+ ];
200
+ }
201
+ return [];
202
+ },
203
+ });
204
+ ```
205
+
206
+ ### 6. Wire up the UI
207
+
208
+ Edit `src/App.svelte`:
209
+
210
+ ```svelte
211
+ <script lang="ts">
212
+ import { createPraxisStore } from '@plures/praxis/svelte';
213
+ import { engine } from './logic/engine';
214
+ import TaskForm from './components/TaskForm.svelte';
215
+ import TaskList from './components/TaskList.svelte';
216
+
217
+ const store = createPraxisStore(engine);
218
+ </script>
219
+
220
+ <main>
221
+ <h1>My Task App</h1>
222
+ <TaskForm />
223
+ <TaskList />
224
+ </main>
225
+
226
+ <style>
227
+ main {
228
+ max-width: 800px;
229
+ margin: 0 auto;
230
+ padding: 2rem;
231
+ }
232
+ </style>
233
+ ```
234
+
235
+ ### 7. Run the development server
236
+
237
+ ```bash
238
+ npm run dev
239
+ ```
240
+
241
+ Open http://localhost:5173 to see your app!
242
+
243
+ ## Core Concepts
244
+
245
+ ### Schemas
246
+
247
+ Schemas are the single source of truth. They define:
248
+ - **Models**: Data structures and relationships
249
+ - **Components**: UI elements and their behavior
250
+ - **Logic**: Facts, events, rules, and constraints
251
+ - **Orchestration**: Distributed coordination (optional)
252
+
253
+ ### Logic Engine
254
+
255
+ The Praxis logic engine processes:
256
+ - **Events**: Things that happen (user actions, external triggers)
257
+ - **Facts**: Derived information about the domain
258
+ - **Rules**: Pure functions that transform events into facts
259
+ - **Constraints**: Invariants that must always hold
260
+
261
+ ### Component Generation
262
+
263
+ Components are generated from schemas but can be customized:
264
+ - Generated components provide scaffolding
265
+ - Extend with custom behavior and styling
266
+ - Regenerate safely (customizations preserved in separate files)
267
+
268
+ ### Local-First Data
269
+
270
+ PluresDB provides:
271
+ - Reactive data storage
272
+ - Offline operation
273
+ - Automatic sync when connected
274
+ - Conflict resolution
275
+
276
+ ## Next Steps
277
+
278
+ ### Visual Editing with Canvas
279
+
280
+ ```bash
281
+ praxis canvas src/schemas/app.schema.ts
282
+ ```
283
+
284
+ Opens CodeCanvas at http://localhost:3000 for visual schema editing.
285
+
286
+ ### Add Authentication
287
+
288
+ ```bash
289
+ praxis create component Auth --template auth
290
+ ```
291
+
292
+ Generates authentication components and logic.
293
+
294
+ ### Enable Documentation
295
+
296
+ State-Docs automatically generates documentation from your schemas:
297
+
298
+ ```bash
299
+ npm run docs
300
+ ```
301
+
302
+ View at http://localhost:3001
303
+
304
+ ### Deploy
305
+
306
+ Build for production:
307
+
308
+ ```bash
309
+ npm run build
310
+ ```
311
+
312
+ Deploy the `dist/` folder to your hosting provider.
313
+
314
+ ## Examples
315
+
316
+ Check out the examples in the Praxis repository:
317
+
318
+ - **Offline-First Chat**: Demonstrates local-first architecture
319
+ - **Knowledge Canvas**: Shows Canvas integration
320
+ - **E-Commerce**: Full-featured example with auth and cart
321
+
322
+ ## Resources
323
+
324
+ - [Framework Architecture](./FRAMEWORK.md)
325
+ - [Schema Reference](../api/schema.md)
326
+ - [Logic Engine Guide](../api/logic.md)
327
+ - [Component Generation](../api/components.md)
328
+ - [Praxis Repository](https://github.com/plures/praxis)
329
+
330
+ ## Getting Help
331
+
332
+ - GitHub Issues: Report bugs and request features
333
+ - Discussions: Ask questions and share your projects
334
+ - Discord: Join the Plures community
335
+
336
+ ## What's Next?
337
+
338
+ Now that you have a basic app running:
339
+
340
+ 1. Explore the generated code
341
+ 2. Add more models and components
342
+ 3. Implement complex business logic
343
+ 4. Try visual editing with Canvas
344
+ 5. Enable orchestration for distributed features
345
+ 6. Build something amazing!
346
+
347
+ Welcome to the Praxis framework! 🚀