forgecad 0.6.3 → 0.7.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 (193) hide show
  1. package/README.md +2 -11
  2. package/dist/assets/{AdminPage-CeqCUUgu.js → AdminPage-DAu1C1ST.js} +250 -151
  3. package/dist/assets/{BlogPage-P_AJP0v9.js → BlogPage-CJEXL_zJ.js} +94 -70
  4. package/dist/assets/{DocsPage-CKRV2iq2.js → DocsPage-Gc_BCdqC.js} +269 -143
  5. package/dist/assets/EditorApp-D9bJvtf7.js +11338 -0
  6. package/dist/assets/{EditorApp-CnC2k4cW.css → EditorApp-DG1-oUSV.css} +459 -87
  7. package/dist/assets/{EmbedViewer-DBlzmQ5i.js → EmbedViewer-CEO8XbV8.js} +2 -4
  8. package/dist/assets/LandingPage-CdCuEOdC.js +451 -0
  9. package/dist/assets/PricingPage-BSrxu6d7.js +232 -0
  10. package/dist/assets/{SettingsPage-BqCh9JcC.js → SettingsPage-FUCSIRq6.js} +129 -5
  11. package/dist/assets/{evalWorker-Ql-aKwLA.js → evalWorker-KoR0SNKq.js} +6770 -2914
  12. package/dist/assets/{index-2hfs_ub0.css → index-CyVd1D4D.css} +227 -53
  13. package/dist/assets/{Viewport-CoB46f5R.js → index-wTEK39at.js} +31385 -6439
  14. package/dist/assets/{javascript-DCxGoE5Y.js → javascript-DAl8Gmyo.js} +1 -1
  15. package/dist/assets/{manifold-CqNMHHKO.js → manifold-B1sGWdYk.js} +4 -3
  16. package/dist/assets/{manifold-Cce9wRFz.js → manifold-D7o0N50J.js} +1 -1
  17. package/dist/assets/{manifold-D6BeHIOo.js → manifold-G5sBaXzi.js} +1 -1
  18. package/dist/assets/{reportWorker-sFEFonXf.js → reportWorker-DYcRHhv9.js} +6798 -3341
  19. package/dist/assets/{vendor-react-Dt7-aaJH.js → vendor-react-CG3i_wp0.js} +65 -8
  20. package/dist/docs-raw/generated/assembly.md +691 -112
  21. package/dist/docs-raw/generated/concepts.md +1225 -1400
  22. package/dist/docs-raw/generated/core.md +464 -1412
  23. package/dist/docs-raw/generated/curves.md +593 -117
  24. package/dist/docs-raw/generated/lib.md +38 -748
  25. package/dist/docs-raw/generated/output.md +139 -245
  26. package/dist/docs-raw/generated/sheet-metal.md +473 -21
  27. package/dist/docs-raw/generated/sketch.md +553 -349
  28. package/dist/docs-raw/generated/viewport.md +345 -303
  29. package/dist/docs-raw/generated/wood.md +104 -0
  30. package/dist/index.html +2 -2
  31. package/dist/sitemap.xml +6 -6
  32. package/dist-cli/chunk-PZ5AY32C.js +10 -0
  33. package/dist-cli/chunk-PZ5AY32C.js.map +1 -0
  34. package/dist-cli/forgecad.js +9435 -5407
  35. package/dist-cli/forgecad.js.map +1 -0
  36. package/dist-cli/solver-FV7TJZGI.js +365 -0
  37. package/dist-cli/solver-FV7TJZGI.js.map +1 -0
  38. package/dist-skill/CONTEXT.md +3186 -7145
  39. package/dist-skill/SKILL-dev.md +21 -63
  40. package/dist-skill/SKILL.md +12 -56
  41. package/dist-skill/docs/API/core/concepts.md +16 -98
  42. package/dist-skill/docs/CLI/export.md +91 -0
  43. package/dist-skill/docs/CLI/projects.md +107 -0
  44. package/dist-skill/docs/CLI/studio_publishing.md +52 -0
  45. package/dist-skill/docs/CLI/validation.md +66 -0
  46. package/dist-skill/docs/generated/assembly.md +691 -112
  47. package/dist-skill/docs/generated/core.md +464 -1412
  48. package/dist-skill/docs/generated/curves.md +593 -117
  49. package/dist-skill/docs/generated/lib.md +38 -748
  50. package/dist-skill/docs/generated/output.md +139 -245
  51. package/dist-skill/docs/generated/sheet-metal.md +473 -21
  52. package/dist-skill/docs/generated/sketch.md +553 -349
  53. package/dist-skill/docs/generated/viewport.md +345 -303
  54. package/dist-skill/docs/generated/wood.md +104 -0
  55. package/dist-skill/docs/guides/coordinate-system.md +11 -17
  56. package/dist-skill/docs/guides/geometry-conventions.md +13 -70
  57. package/dist-skill/docs/guides/modeling-recipes.md +22 -195
  58. package/dist-skill/docs/guides/positioning.md +88 -147
  59. package/dist-skill/docs-dev/API/core/concepts.md +51 -0
  60. package/dist-skill/docs-dev/API/core/sdf-advanced.md +92 -0
  61. package/dist-skill/docs-dev/API/core/sdf-primitives.md +58 -0
  62. package/dist-skill/docs-dev/API/core/sdf-workflow.md +42 -0
  63. package/dist-skill/docs-dev/CLI/export.md +91 -0
  64. package/dist-skill/docs-dev/CLI/projects.md +107 -0
  65. package/dist-skill/docs-dev/CLI/studio_publishing.md +52 -0
  66. package/dist-skill/docs-dev/CLI/validation.md +66 -0
  67. package/dist-skill/{docs → docs-dev}/blueprint-first.md +5 -0
  68. package/dist-skill/{docs → docs-dev}/coding-best-practices.md +6 -8
  69. package/dist-skill/{docs → docs-dev}/coding.md +1 -3
  70. package/dist-skill/docs-dev/generated/assembly.md +771 -0
  71. package/dist-skill/docs-dev/generated/core.md +775 -0
  72. package/dist-skill/docs-dev/generated/curves.md +688 -0
  73. package/dist-skill/docs-dev/generated/lib.md +50 -0
  74. package/dist-skill/docs-dev/generated/output.md +234 -0
  75. package/dist-skill/docs-dev/generated/sheet-metal.md +506 -0
  76. package/dist-skill/docs-dev/generated/sketch.md +801 -0
  77. package/dist-skill/docs-dev/generated/viewport.md +486 -0
  78. package/dist-skill/docs-dev/generated/wood.md +104 -0
  79. package/dist-skill/docs-dev/guides/coordinate-system.md +46 -0
  80. package/dist-skill/docs-dev/guides/geometry-conventions.md +52 -0
  81. package/dist-skill/docs-dev/guides/modeling-recipes.md +77 -0
  82. package/dist-skill/docs-dev/guides/positioning.md +151 -0
  83. package/dist-skill/{docs → docs-dev}/guides/skill-maintenance.md +21 -10
  84. package/dist-skill/{docs → docs-dev}/internals/compiler.md +5 -6
  85. package/dist-skill/{docs → docs-dev}/internals/constraint-solver-quality.md +0 -1
  86. package/dist-skill/{docs → docs-dev}/internals/constraint-solver.md +0 -1
  87. package/dist-skill/{docs → docs-dev}/internals/sketch-2d-pipeline.md +2 -3
  88. package/examples/api/attachTo-basics.forge.js +5 -5
  89. package/examples/api/boolean-operations.forge.js +3 -3
  90. package/examples/api/bounding-box-visualizer.forge.js +2 -2
  91. package/examples/api/clone-duplicate.forge.js +1 -1
  92. package/examples/api/colors-union-vs-array.forge.js +6 -6
  93. package/examples/api/connector-assembly.forge.js +4 -4
  94. package/examples/api/connector-basics.forge.js +2 -2
  95. package/examples/api/extrude-options.forge.js +4 -10
  96. package/examples/api/feature-created-faces.forge.js +6 -10
  97. package/examples/api/fillet-showcase.forge.js +1 -1
  98. package/examples/api/folded-service-panel-cover.forge.js +2 -2
  99. package/examples/api/group-test.forge.js +1 -1
  100. package/examples/api/group-vs-union.forge.js +1 -1
  101. package/examples/api/highlight-debug.forge.js +4 -0
  102. package/examples/api/js-module-pillars.js +1 -1
  103. package/examples/api/js-module-scene.js +2 -2
  104. package/examples/api/mesh-import-slats.forge.js +1 -1
  105. package/examples/api/pointAlong-orientation.forge.js +1 -1
  106. package/examples/api/profile-2020-b-slot6.forge.js +0 -1
  107. package/examples/api/route-perimeter-flange.forge.js +1 -1
  108. package/examples/api/sdf-rover-demo.forge.js +10 -10
  109. package/examples/api/sketch-on-face-demo.forge.js +2 -2
  110. package/examples/api/sketch-regions.forge.js +4 -4
  111. package/examples/api/transition-curves.forge.js +1 -1
  112. package/examples/api/variable-sweep-pure-sdf-test.forge.js +162 -0
  113. package/examples/api/variable-sweep-test.forge.js +2 -2
  114. package/examples/api/wood-joinery.forge.js +60 -0
  115. package/examples/compiler-corpus/enclosure-shell-cuts.forge.js +3 -3
  116. package/examples/compiler-corpus/fastener-plate-variants.forge.js +2 -2
  117. package/examples/experiments/drone-arm.forge.js +53 -0
  118. package/examples/furniture/adjustable-table.forge.js +2 -2
  119. package/examples/furniture/bathroom.forge.js +11 -11
  120. package/examples/furniture/chair.forge.js +1 -1
  121. package/examples/generative/crystal-growth.forge.js +2 -2
  122. package/examples/generative/frost-spires.forge.js +3 -3
  123. package/examples/generative/golden-spiral-tower.forge.js +3 -3
  124. package/examples/mechanical/3d-printer.forge.js +28 -28
  125. package/examples/mechanical/5-finger-robot-hand.forge.js +15 -15
  126. package/examples/mechanical/airplane-propeller.forge.js +2 -2
  127. package/examples/mechanical/fillet-enclosure.forge.js +1 -1
  128. package/examples/mechanical/headphone-hanger-v2.forge.js +2 -2
  129. package/examples/mechanical/robot_hand.forge.js +15 -15
  130. package/examples/mechanical/robot_hand_2.forge.js +9 -9
  131. package/examples/products/bottle.forge.js +1 -1
  132. package/examples/products/chess-set.forge.js +19 -19
  133. package/examples/products/classical-piano.forge.js +11 -11
  134. package/examples/products/clock.forge.js +12 -12
  135. package/examples/products/iphone.forge.js +8 -8
  136. package/examples/products/laptop.forge.js +15 -15
  137. package/examples/products/liquid-soap-dispenser.forge.js +18 -18
  138. package/examples/products/origami-fish.forge.js +8 -6
  139. package/examples/products/spiderman-cake.forge.js +4 -4
  140. package/examples/toolbox/bolted-joint.forge.js +2 -2
  141. package/package.json +7 -4
  142. package/dist/assets/EditorApp-B-vQvgam.js +0 -9888
  143. package/dist/assets/LandingPage-C5n9hDXI.js +0 -322
  144. package/dist/assets/PublishedModelPage-Dt7PCVBj.js +0 -146
  145. package/dist/assets/__vite-browser-external-CURh0WXD.js +0 -8
  146. package/dist/assets/deserializeRunResult-BLAFoiE0.js +0 -19365
  147. package/dist/assets/index-1CYp3zUp.js +0 -1455
  148. package/dist/docs-raw/CLI.md +0 -865
  149. package/dist-skill/docs/API/API.md +0 -1666
  150. package/dist-skill/docs/API/README.md +0 -37
  151. package/dist-skill/docs/API/assembly/assembly.md +0 -617
  152. package/dist-skill/docs/API/core/edge-queries.md +0 -130
  153. package/dist-skill/docs/API/core/parameters.md +0 -122
  154. package/dist-skill/docs/API/core/reserved-terms.md +0 -137
  155. package/dist-skill/docs/API/core/sdf.md +0 -326
  156. package/dist-skill/docs/API/core/skill-cli.md +0 -194
  157. package/dist-skill/docs/API/core/skill-guide.md +0 -205
  158. package/dist-skill/docs/API/core/specs.md +0 -186
  159. package/dist-skill/docs/API/core/topology.md +0 -372
  160. package/dist-skill/docs/API/entities.md +0 -268
  161. package/dist-skill/docs/API/output/bom.md +0 -58
  162. package/dist-skill/docs/API/output/brep-export.md +0 -87
  163. package/dist-skill/docs/API/output/dimensions.md +0 -67
  164. package/dist-skill/docs/API/output/export.md +0 -110
  165. package/dist-skill/docs/API/output/gcode.md +0 -195
  166. package/dist-skill/docs/API/runtime/viewport.md +0 -420
  167. package/dist-skill/docs/API/sheet-metal/sheet-metal.md +0 -185
  168. package/dist-skill/docs/API/sketch/anchor.md +0 -37
  169. package/dist-skill/docs/API/sketch/booleans.md +0 -91
  170. package/dist-skill/docs/API/sketch/core.md +0 -73
  171. package/dist-skill/docs/API/sketch/extrude.md +0 -62
  172. package/dist-skill/docs/API/sketch/on-face.md +0 -104
  173. package/dist-skill/docs/API/sketch/operations.md +0 -78
  174. package/dist-skill/docs/API/sketch/path.md +0 -75
  175. package/dist-skill/docs/API/sketch/primitives.md +0 -146
  176. package/dist-skill/docs/API/sketch/regions.md +0 -80
  177. package/dist-skill/docs/API/sketch/text.md +0 -108
  178. package/dist-skill/docs/API/sketch/transforms.md +0 -65
  179. package/dist-skill/docs/API/toolbox/fasteners.md +0 -129
  180. package/dist-skill/docs/CLI.md +0 -865
  181. package/dist-skill/docs/INDEX.md +0 -94
  182. package/dist-skill/docs/RELEASING.md +0 -55
  183. package/dist-skill/docs/cli-monetization.md +0 -111
  184. package/dist-skill/docs/deployment.md +0 -281
  185. package/dist-skill/docs/generated/concepts.md +0 -2112
  186. package/dist-skill/docs/internals/shape-from-slices.md +0 -152
  187. package/dist-skill/docs/platform/admin.md +0 -45
  188. package/dist-skill/docs/platform/architecture.md +0 -79
  189. package/dist-skill/docs/platform/auth.md +0 -110
  190. package/dist-skill/docs/platform/email.md +0 -67
  191. package/dist-skill/docs/platform/projects.md +0 -111
  192. package/dist-skill/docs/platform/sharing.md +0 -90
  193. package/dist-skill/docs/runbook.md +0 -345
@@ -1,94 +0,0 @@
1
- # ForgeCAD Documentation
2
-
3
- Central entry point for all ForgeCAD documentation. Start here.
4
-
5
- ---
6
-
7
- ## Operations & Runbook
8
-
9
- The first place to look when debugging, deploying, or onboarding.
10
-
11
- - **[Runbook](project/runbook.md)** — Dev server commands, local stack setup, health checks, production SSH, API endpoint reference, troubleshooting
12
- - **[Deployment & Environment](project/deployment.md)** — Docker Compose architecture, environment variables, Coolify setup, database migrations
13
- - **[Releasing](RELEASING.md)** — npm version, publish workflow, GitHub Releases
14
-
15
- ---
16
-
17
- ## Platform (Web App)
18
-
19
- Documentation for the hosted service at forgecad.io.
20
-
21
- - **[System Architecture](platform/architecture.md)** — Stack overview, URL routes, Docker topology, security
22
- - **[Authentication](platform/auth.md)** — JWT tokens, OAuth (GitHub/Google), registration, password reset, session management
23
- - **[Projects & Files](platform/projects.md)** — Project CRUD, member roles, file storage, storage quotas, SSE watching
24
- - **[Model Sharing](platform/sharing.md)** — Publishing, public URLs, embeds, gist/URL/inline sharing
25
- - **[Admin Dashboard](platform/admin.md)** — Admin panel, audit log, user management
26
- - **[Email Delivery](platform/email.md)** — Resend setup, verification emails, password reset emails
27
-
28
- ---
29
-
30
- ## CLI
31
-
32
- - **[CLI Reference](CLI.md)** — Full command reference: dev/studio servers, export (STL/STEP/SVG/G-code/SDF), render, capture, notebooks, invariant checks
33
- - **[Monetization & Licensing](project/cli-monetization.md)** — Free vs Pro tiers, license activation, feature gating strategy
34
-
35
- ---
36
-
37
- ## API Reference (Model Authoring)
38
-
39
- For users writing `.forge.js` scripts.
40
-
41
- - **[API Overview](API/README.md)** — Reading plan and orientation
42
- - **[Core API](API/API.md)** — Shapes, primitives, transforms, booleans, patterns
43
- - **[Entities](API/entities.md)** — 2D/3D entity-based API
44
- - **Sketches**: [Core](API/sketch/core.md) | [Primitives](API/sketch/primitives.md) | [Paths](API/sketch/path.md) | [Booleans](API/sketch/booleans.md) | [Operations](API/sketch/operations.md) | [Extrude/Revolve](API/sketch/extrude.md) | [Transforms](API/sketch/transforms.md) | [Regions](API/sketch/regions.md) | [Text](API/sketch/text.md) | [Anchoring](API/sketch/anchor.md) | [On-Face](API/sketch/on-face.md)
45
- - **Assembly**: [Assembly & Kinematics](API/assembly/assembly.md)
46
- - **Output**: [Export](API/output/export.md) | [BREP/STEP](API/output/brep-export.md) | [G-code](API/output/gcode.md) | [Dimensions](API/output/dimensions.md) | [BOM](API/output/bom.md)
47
- - **Other**: [Sheet Metal](API/sheet-metal/sheet-metal.md) | [Fasteners](API/toolbox/fasteners.md) | [Viewport](API/runtime/viewport.md)
48
- - **Core Concepts**: [Concepts](API/core/concepts.md) | [Parameters](API/core/parameters.md) | [Topology](API/core/topology.md) | [Edge Queries](API/core/edge-queries.md) | [Specs](API/core/specs.md) | [SDF](API/core/sdf.md)
49
- - **AI Skill**: [Skill Guide](API/core/skill-guide.md) | [Skill CLI](API/core/skill-cli.md)
50
- - **[Auto-Generated API Docs](generated/)** — Machine-generated from `forge-public-api.ts`
51
-
52
- ---
53
-
54
- ## Guides (Modeling)
55
-
56
- Techniques and conventions for model authors.
57
-
58
- - **[Coordinate System](guides/coordinate-system.md)** — Z-up convention, axis orientation
59
- - **[Geometry Conventions](guides/geometry-conventions.md)** — Winding order, depth, normals
60
- - **[Positioning](guides/positioning.md)** — Connectors, `matchTo()`, and placement strategies
61
- - **[Modeling Recipes](guides/modeling-recipes.md)** — Common patterns, iteration, multi-file composition
62
- - **[Skill Maintenance](guides/skill-maintenance.md)** — AI skill build process, `npm run refresh`
63
-
64
- ---
65
-
66
- ## Engine Internals
67
-
68
- For contributors working on ForgeCAD's core engine.
69
-
70
- - **[Compiler](internals/compiler.md)** — Multi-backend architecture (Manifold + OCCT), compile plans, lowering
71
- - **[Constraint Solver](internals/constraint-solver.md)** — Solver pipeline, architecture, Levenberg-Marquardt
72
- - **[Solver Quality](internals/constraint-solver-quality.md)** — Tunable vs architectural parameters
73
- - **[2D Sketch Pipeline](internals/sketch-2d-pipeline.md)** — Two-track export, ProfileCompilePlan
74
-
75
- ---
76
-
77
- ## Development Standards
78
-
79
- For contributors developing ForgeCAD itself.
80
-
81
- - **[Coding Guidelines](project/coding.md)** — Project structure, workflow, adding new features
82
- - **[Coding Best Practices](project/coding-best-practices.md)** — TypeScript, React, performance, self-review
83
- - **[Blueprint-First Design](project/blueprint-first.md)** — No trigonometry tax, intent-driven API design
84
-
85
- ---
86
-
87
- ## Processes
88
-
89
- Operational procedures for multi-agent development and investigations.
90
-
91
- - **[Multi-Agent Development](../processes/MULTI_AGENT_DEVELOPMENT.md)**
92
- - **[Program Lead](../processes/PROGRAM-LEAD.md)**
93
- - **[AI Investigation Projects](../processes/AI_INVESTIGATION_PROJECTS.md)**
94
- - **[Benchmark SOP](../processes/README_BENCHMARK_SOP.md)**
@@ -1,55 +0,0 @@
1
- ---
2
- skill-group: dev-conventions
3
- skill-order: 4
4
- skill-tiers: [dev]
5
- ---
6
-
7
- # Releasing ForgeCAD
8
-
9
- ## Quick Release
10
-
11
- ```bash
12
- npm version patch # or minor / major
13
- git push && git push --tags
14
- ```
15
-
16
- That's it. GitHub Actions handles the rest:
17
- - Builds everything (solver WASM + TypeScript + Vite + CLI + skills)
18
- - Runs the full test suite
19
- - Publishes to npm
20
- - Creates a GitHub Release with auto-generated notes
21
- - Production (forgecad.io) deploys automatically via Coolify on push to mainline
22
-
23
- ## Version Levels
24
-
25
- | Command | When | Example |
26
- |---------|------|---------|
27
- | `npm version patch` | Bug fixes, small changes | 0.1.5 → 0.1.6 |
28
- | `npm version minor` | New features | 0.1.5 → 0.2.0 |
29
- | `npm version major` | Breaking changes | 0.1.5 → 1.0.0 |
30
-
31
- `npm version` automatically:
32
- 1. Updates `version` in `package.json`
33
- 2. Creates a git commit (`v0.1.6`)
34
- 3. Creates a git tag (`v0.1.6`)
35
-
36
- ## Dry Run
37
-
38
- To test the publish workflow without actually releasing:
39
-
40
- 1. Go to **Actions → Publish to npm & GitHub Release → Run workflow**
41
- 2. Check "Dry run" and run
42
-
43
- ## Prerequisites
44
-
45
- - `NPM_TOKEN` must be set as a GitHub repo secret (Settings → Secrets → Actions)
46
- - Create a **Granular Access Token** at npmjs.com → Account → Access Tokens
47
- - Scope it to read+write on the `forgecad` package only
48
-
49
- ## What Gets Published
50
-
51
- - `dist-cli/forgecad.js` — CLI binary
52
- - `dist/` — web app bundles
53
- - `dist-skill/` — AI skill documentation and context
54
- - `examples/` — sample models
55
- - `README.md`, `LICENSE`
@@ -1,111 +0,0 @@
1
- # CLI Monetization Strategy
2
-
3
- ## The Model: Sublime Text Now, Cursor Later
4
-
5
- ForgeCAD follows a phased monetization strategy informed by how real software companies make money — not by how they try to prevent piracy.
6
-
7
- ### Phase 1: Honor System (Now)
8
-
9
- Ship a compiled binary with a local license gate. Pro commands show a clear upgrade message. No enforcement beyond that.
10
-
11
- **Why this works:**
12
- - Sublime Text makes $5-25M/year with zero enforcement (nag popup only)
13
- - WinRAR makes $20-40M/year with zero enforcement (40-day trial that never expires)
14
- - JetBrains makes $593M/year despite being cracked constantly
15
- - The pattern: individuals who crack it weren't going to pay. Enterprises must pay (legal compliance, audit risk, IT procurement). Pirates who learn ForgeCAD become advocates inside companies that buy licenses.
16
-
17
- **What we ship:**
18
- - Compiled native binary via `bun build --compile --minify` (source not trivially readable)
19
- - Local JWT license validation at `~/.forgecad/license.json`
20
- - Pro commands blocked with helpful message + free alternatives
21
- - `forgecad license activate/deactivate/status` commands
22
-
23
- **What we accept:**
24
- - A developer can bypass the local check in 30 minutes
25
- - String literals (error messages, API names) are visible via `strings`
26
- - This is fine. The gate converts honest users; it doesn't stop determined pirates.
27
-
28
- ### Phase 2: Enterprise Features (Soon)
29
-
30
- Add features that enterprises need and individuals don't care about:
31
- - License server (floating seats, team management, usage reporting)
32
- - Audit log (who exported what, when)
33
- - SSO/SAML integration
34
- - Priority support channel
35
-
36
- These features don't need anti-piracy because they're inherently organizational. A solo developer doesn't need a license server.
37
-
38
- ### Phase 3: Server-Side Pro Features (Later)
39
-
40
- Move high-value exports to run on the ForgeCAD server. The CLI uploads the model, the server processes it, the CLI downloads the result.
41
-
42
- **Why this is piracy-proof:** The code for STEP export, Blender rendering, and gcode computation never ships to the user. You can't crack what you don't have.
43
-
44
- **Proven by:**
45
- - Cursor: $2B ARR — the editor is free, AI calls are server-side
46
- - Figma: $1B revenue — all rendering is server-side
47
- - Onshape: acquired for $470M — 100% browser-based, nothing local to crack
48
-
49
- ## Feature Tiers
50
-
51
- | Tier | Price | Features |
52
- |------|-------|----------|
53
- | **Free** | $0 | Editor, dev server, run scripts, render PNG, export STL/3MF/SVG, all checks, debug tools |
54
- | **Pro** | $15-25/mo | STEP/BREP export, render-hq (Blender), capture GIF/MP4, gcode, report PDF, cutting layout, SDF/URDF, sketch PDF |
55
- | **Team** | $40-60/seat/mo | Everything in Pro + license server, floating seats, audit log, SSO, priority support |
56
-
57
- ### Why this split?
58
-
59
- **Free tier** includes everything needed to learn ForgeCAD, build models, and 3D print. This is the funnel — hobbyists, students, and evaluators use this. It's genuinely useful, not a crippled demo.
60
-
61
- **Pro tier** gates the features professionals need: exact CAD interchange (STEP), manufacturing outputs (gcode, cutting layouts), and presentation (render-hq, animations). These are the commands that save hours of work and justify a subscription.
62
-
63
- **Team tier** gates organizational features that individuals don't need.
64
-
65
- ## What NOT to Do
66
-
67
- ### Don't rewrite in a compiled language for code protection
68
- SolidWorks is C++ and it's cracked (SolidSquad). AutoCAD is C++ and it's cracked. The language doesn't matter — Ghidra/IDA Pro can reverse-engineer any native binary. The cost (rewriting years of work, losing the JS API that makes ForgeCAD special) far outweighs the marginal protection gain.
69
-
70
- ### Don't add aggressive DRM
71
- Dassault embeds forensic signatures in SolidWorks files and sues pirates — this generates "many millions" in settlements but also generates resentment. For a small product trying to build a community, aggressive enforcement is counterproductive.
72
-
73
- ### Don't make the free tier useless
74
- Ondsel (commercial FreeCAD) died in 2 years. Open-source CAD has near-zero commercial traction. But the opposite extreme — locking everything behind a paywall — kills adoption. The free tier must be genuinely useful.
75
-
76
- ### Don't ship source maps
77
- Claude Code accidentally shipped `.map` files in npm v2.1.88. Within hours, the entire 1,900-file TypeScript codebase was extracted, mirrored to GitHub (1,100+ stars), and reverse-engineered. `.npmignore` must exclude `*.map`, `*.ts` source, and `tsconfig.json`.
78
-
79
- ## The Gabe Newell Principle
80
-
81
- > "Piracy is almost always a service problem, not a pricing problem."
82
-
83
- Steam proved this — Russia went from "don't bother, too much piracy" to Valve's largest European market once they localized and shipped same-day.
84
-
85
- **Applied to ForgeCAD:** Make the paid version more convenient than the cracked one:
86
- - Automatic updates (the binary self-updates, cracked copies don't)
87
- - Cloud project sync (your models available everywhere)
88
- - Share links (one-click sharing from the editor)
89
- - Support (access to help when stuck)
90
- - Team features (collaboration, permissions)
91
-
92
- People pay for convenience and reliability, not because they can't find a crack.
93
-
94
- ## Distribution
95
-
96
- | Channel | Format | Audience |
97
- |---------|--------|----------|
98
- | **npm** (`npm install -g forgecad`) | Minified `cli.js` (no source maps) | Primary channel |
99
- | **forgecad.io** | Web editor (no install) | Evaluators, casual users |
100
-
101
- ForgeCAD users write `.forge.js` files — they already have Node.js. npm is the only CLI distribution channel we need to maintain.
102
-
103
- A compiled native binary build script exists (`npm run build:binary`) for potential future Homebrew distribution, but compiled binaries offer no additional source protection over minified JS (the source is stored as plain text in the binary's `__BUN` section). The binary is not worth maintaining as a separate channel until user volume justifies it.
104
-
105
- ### Build
106
-
107
- ```
108
- TypeScript source → tsup (ESM bundle, 2.5MB) → dist-cli/forgecad.js
109
- ```
110
-
111
- **Never ship source maps.** `.npmignore` must exclude `*.map`, `*.ts` source, and `tsconfig.json`.
@@ -1,281 +0,0 @@
1
- ---
2
- skill-group: dev-conventions
3
- skill-order: 3
4
- skill-tiers: [dev]
5
- ---
6
-
7
- # ForgeCAD Deployment & Environment
8
-
9
- See also the **[Runbook](runbook.md)** for day-to-day operations, testing, troubleshooting, and API reference.
10
-
11
- ForgeCAD runs as a Docker Compose stack. There are two compose files:
12
-
13
- - **`docker-compose.yml`** — Full self-hosted stack (Caddy + ForgeCAD + PostgreSQL + Redis). Use this for manual VPS deployment.
14
- - **`docker-compose.coolify.yml`** — Simplified stack for Coolify (ForgeCAD + PostgreSQL only). Coolify handles TLS and reverse proxy.
15
-
16
- Production runs on **Hetzner** via **Coolify**, which auto-deploys on push to `mainline`.
17
-
18
- ---
19
-
20
- ## Architecture
21
-
22
- ```
23
- Internet
24
-
25
- ├─ Coolify Proxy (Traefik) ← TLS termination, routing
26
- │ │
27
- │ └─ forgecad container ← Fastify app (Node.js)
28
- │ │
29
- │ ├─ Serves SPA (dist/) ← Vite-built React frontend
30
- │ ├─ API routes (/api/*) ← Auth, projects, files
31
- │ └─ connects to ──────► postgresql container
32
-
33
- └─ Volume: project-data ← User project files on disk
34
- ```
35
-
36
- In the self-hosted compose file, Caddy replaces Coolify's proxy, and Redis/Valkey is added for rate limiting.
37
-
38
- ---
39
-
40
- ## Environment Variables
41
-
42
- ### Server Core
43
-
44
- These configure the Fastify application server itself.
45
-
46
- | Variable | Required | Default | Purpose |
47
- |----------|----------|---------|---------|
48
- | `NODE_ENV` | no | `development` | Set to `production` for deployed instances |
49
- | `FORGE_PORT` | no | `5173` | HTTP port the server listens on |
50
- | `FORGE_HOST` | no | `127.0.0.1` | Bind address. Use `0.0.0.0` in Docker |
51
- | `FORGE_DIST_DIR` | no | — | Path to Vite build output (the SPA). In Docker: `/app/dist` |
52
-
53
- ### Database
54
-
55
- ForgeCAD uses PostgreSQL 16 for users, projects, sessions, and audit logs. The database schema is managed by Drizzle ORM with auto-migrations on server startup.
56
-
57
- | Variable | Required | Default | Purpose |
58
- |----------|----------|---------|---------|
59
- | `FORGE_DB_URL` | **yes** | — | PostgreSQL connection string |
60
-
61
- **How the connection is wired in Coolify:**
62
-
63
- Coolify auto-generates credentials for linked database services and injects them as `SERVICE_USER_POSTGRES` and `SERVICE_PASSWORD_POSTGRES`. The compose file constructs the full URL from these:
64
-
65
- ```yaml
66
- FORGE_DB_URL=postgresql://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgresql:5432/${POSTGRES_DB:-forgecad}
67
- ```
68
-
69
- The hostname `postgresql` is the Docker Compose service name — Docker's internal DNS resolves it to the postgres container. You never need to set `FORGE_DB_URL` directly in Coolify; it assembles itself from Coolify's auto-generated service credentials.
70
-
71
- **In the self-hosted compose file**, the pattern is simpler:
72
-
73
- ```yaml
74
- FORGE_DB_URL=postgresql://forgecad:${POSTGRES_PASSWORD}@postgres:5432/forgecad
75
- ```
76
-
77
- Here you set `POSTGRES_PASSWORD` in a `.env` file and the same value is shared with the postgres container.
78
-
79
- ### Authentication
80
-
81
- Authentication uses JWT access tokens (short-lived, 15 min) and refresh tokens (7 days, stored in DB with rotation and replay detection).
82
-
83
- | Variable | Required | Default | Purpose |
84
- |----------|----------|---------|---------|
85
- | `FORGE_JWT_SECRET` | **yes** | — | HMAC key for signing JWT tokens. Generate with `openssl rand -base64 32` |
86
- | `FORGE_JWT_ACCESS_EXPIRES` | no | `15m` | Access token lifetime |
87
- | `FORGE_JWT_REFRESH_EXPIRES` | no | `7d` | Refresh token lifetime |
88
-
89
- **The JWT secret is critical.** Without it, login and registration complete the database operations but crash when issuing tokens — the user gets a 500 error. The server starts without it (the value is lazily read), but all auth endpoints fail.
90
-
91
- ### CORS & Public URL
92
-
93
- These tell the server which origins to trust and how to construct user-facing URLs (e.g., in emails).
94
-
95
- | Variable | Required | Default | Purpose |
96
- |----------|----------|---------|---------|
97
- | `FORGE_ALLOWED_ORIGINS` | no | `http://localhost:5173` | Comma-separated list of allowed CORS origins |
98
- | `FORGE_APP_URL` | no | `http://localhost:5173` | Public base URL for the app. Used in email links |
99
-
100
- For production, set `FORGE_ALLOWED_ORIGINS=https://forgecad.io` and `FORGE_APP_URL=https://forgecad.io`.
101
-
102
- ### OAuth Providers
103
-
104
- Optional. If not set, the corresponding "Sign in with X" button won't appear on the login page.
105
-
106
- | Variable | Required | Default | Purpose |
107
- |----------|----------|---------|---------|
108
- | `GITHUB_CLIENT_ID` | no | — | GitHub OAuth app client ID |
109
- | `GITHUB_CLIENT_SECRET` | no | — | GitHub OAuth app client secret |
110
- | `GOOGLE_CLIENT_ID` | no | — | Google OAuth client ID |
111
- | `GOOGLE_CLIENT_SECRET` | no | — | Google OAuth client secret |
112
-
113
- To set up GitHub OAuth: create an OAuth App at github.com/settings/developers with callback URL `https://forgecad.io/auth/callback/github`.
114
-
115
- ### Email Delivery
116
-
117
- Email is used for account verification and password reset. Without `RESEND_API_KEY`, emails are logged to the container's stdout instead of being sent — useful for development, but users won't receive them.
118
-
119
- | Variable | Required | Default | Purpose |
120
- |----------|----------|---------|---------|
121
- | `RESEND_API_KEY` | no | — | API key from [resend.com](https://resend.com). Enables real email delivery |
122
- | `FORGE_EMAIL_FROM` | no | `ForgeCAD <noreply@forgecad.io>` | Sender address for outgoing emails |
123
-
124
- To enable email: sign up at Resend, verify `forgecad.io` as a sending domain (add their DNS records), get an API key, and set it in Coolify.
125
-
126
- ### File Storage
127
-
128
- User project files (`.forge.js`, meshes) are stored on disk, not in the database.
129
-
130
- | Variable | Required | Default | Purpose |
131
- |----------|----------|---------|---------|
132
- | `FORGE_STORAGE_ROOT` | no | `/data/projects` | Root directory for project file storage |
133
-
134
- In Docker, this is backed by the `project-data` volume, which persists across container rebuilds.
135
-
136
- ---
137
-
138
- ## Coolify-Specific Variables
139
-
140
- These are managed by Coolify itself — you don't set them manually, but the compose file references them:
141
-
142
- | Variable | Source | Purpose |
143
- |----------|--------|---------|
144
- | `SERVICE_USER_POSTGRES` | Coolify auto-generated | PostgreSQL username |
145
- | `SERVICE_PASSWORD_POSTGRES` | Coolify auto-generated | PostgreSQL password |
146
- | `POSTGRES_DB` | Coolify (defaults to `forgecad`) | Database name |
147
-
148
- ---
149
-
150
- ## What You Actually Need to Set in Coolify
151
-
152
- Only these variables need manual configuration in Coolify's environment settings:
153
-
154
- 1. **`FORGE_JWT_SECRET`** — `openssl rand -base64 32`. Without this, auth is broken.
155
- 2. **`FORGE_ALLOWED_ORIGINS`** — `https://forgecad.io`
156
- 3. **`RESEND_API_KEY`** — from resend.com (optional, but needed for email)
157
- 4. **`GITHUB_CLIENT_ID` / `GITHUB_CLIENT_SECRET`** — if you want GitHub login
158
- 5. **`GOOGLE_CLIENT_ID` / `GOOGLE_CLIENT_SECRET`** — if you want Google login
159
-
160
- Everything else has working defaults or is auto-generated by Coolify.
161
-
162
- ---
163
-
164
- ## Database Migrations
165
-
166
- Migrations run automatically on server startup (`server/db/migrate.ts`). The migration system:
167
-
168
- 1. Creates a `_migrations` table to track which migrations have been applied
169
- 2. Runs any unapplied migrations in order
170
- 3. Logs each migration to stdout
171
-
172
- No manual database setup is needed. The PostgreSQL container starts with an empty database, and the ForgeCAD server creates all tables on first boot.
173
-
174
- ---
175
-
176
- ## Debugging Production
177
-
178
- SSH access: `ssh hetzner` (see `~/.ssh/config`).
179
-
180
- ```bash
181
- # Find containers
182
- docker ps --format "{{.Names}}" | grep forge
183
-
184
- # App logs
185
- docker logs --tail 200 <forgecad-container>
186
-
187
- # DB access (get credentials from app env first)
188
- docker exec <forgecad-container> env | grep POSTGRES
189
- docker exec <postgres-container> psql -U <USER> -d forgecad
190
-
191
- # System health
192
- df -h && free -h
193
- ```
194
-
195
- See the `/hetzner-logs` skill for the full workflow.
196
-
197
- ### Email not delivered (user didn't receive verification/reset email)
198
-
199
- **Symptom:** User registers or requests password reset, no email arrives. Logs show:
200
- ```
201
- [email] To: user@example.com | Subject: Verify your ForgeCAD email
202
- ```
203
-
204
- **Cause:** `RESEND_API_KEY` is empty or missing. The `[email]` log line is the dev fallback — it means the email was *logged* to stdout, not sent.
205
-
206
- **Check:**
207
- ```bash
208
- docker exec <forgecad-container> env | grep RESEND_API_KEY
209
- # → RESEND_API_KEY= ← empty = emails not sent
210
- ```
211
-
212
- **Fix:** Set `RESEND_API_KEY` in Coolify environment variables → redeploy.
213
-
214
- ### Connecting a DB client (e.g. Beekeeper Studio) to prod
215
-
216
- The PostgreSQL container has no host port mapping — `localhost:5432` is not reachable from outside the server. Instead use an SSH tunnel to the container's Docker network IP.
217
-
218
- 1. Find the container IP (run once, it's stable across restarts within the same Coolify stack):
219
- ```bash
220
- ssh hetzner "docker inspect \$(docker ps -qf name=postgresql) | grep '\"IPAddress\"'"
221
- # → 10.0.2.3 (or similar)
222
- ```
223
-
224
- 2. In Beekeeper Studio, configure the SSH tunnel:
225
- - SSH Host: `65.108.210.215`, User: `kostard`, use your private key
226
- - DB Host: `10.0.2.3`, Port: `5432`
227
- - Credentials: from Coolify's auto-generated `SERVICE_USER_POSTGRES` / `SERVICE_PASSWORD_POSTGRES`
228
- - Database: `forgecad`
229
-
230
- > `AllowTcpForwarding yes` must be set in `/etc/ssh/sshd_config` on the server for the tunnel to work.
231
-
232
- ---
233
-
234
- ## Local Development
235
-
236
- ### Quick start (editor only, no auth)
237
-
238
- For working on the CAD editor, geometry, sketches, or viewer:
239
-
240
- ```bash
241
- npm run dev
242
- ```
243
-
244
- Opens the editor with local example files. No login, no database. Fastest workflow for anything that doesn't touch auth or multi-user features. Vite proxies `/api` to port 5174 but the backend is optional — the editor works without it.
245
-
246
- ### Production build locally (test real server behavior)
247
-
248
- For testing WASM serving, bundle sizes, caching headers — the full production Fastify server on your machine:
249
-
250
- ```bash
251
- npm run dev:db # start PostgreSQL (once)
252
- npm run dev:prod # tsc + vite build + run Fastify server
253
- ```
254
-
255
- Open `http://localhost:5173` — same server code as production, serving the Vite production build. ~25s turnaround.
256
-
257
- ### Full stack (auth, database, landing page, docs, blog)
258
-
259
- For working on the hosted application:
260
-
261
- ```bash
262
- # Terminal 1: start PostgreSQL (once)
263
- npm run dev:db
264
-
265
- # Terminal 2: start Fastify API server (port 5174)
266
- npm run dev:server
267
-
268
- # Terminal 3: start Vite dev server (port 5173, proxies /api to 5174)
269
- npm run dev:studio
270
- ```
271
-
272
- Open `http://localhost:5173` — landing page, login, docs, blog, admin, the full thing.
273
-
274
- To stop the database: `npm run dev:db:stop`
275
-
276
- **Dev credentials** (hardcoded in `dev:server`, never used in production):
277
- - Database: `forgecad:forgecad@localhost:5432/forgecad`
278
- - JWT secret: `dev-secret-do-not-use-in-production`
279
- - Allowed origin: `http://localhost:5173`
280
-
281
- Migrations run automatically on server startup.