@bsv/create-dpp-app 0.0.0-stage → 0.1.0-beta.2

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 (178) hide show
  1. package/LICENSE +203 -0
  2. package/NOTICE +2 -0
  3. package/PATENTS +12 -0
  4. package/README.md +93 -2
  5. package/dist/index.js +125 -0
  6. package/package.json +57 -4
  7. package/template/Dockerfile +37 -0
  8. package/template/README.md +389 -0
  9. package/template/_dockerignore +6 -0
  10. package/template/_env.example +122 -0
  11. package/template/_github/workflows/ci.yml +23 -0
  12. package/template/_gitignore +8 -0
  13. package/template/_prettierrc +6 -0
  14. package/template/apps/api/API.md +119 -0
  15. package/template/apps/api/package.json +39 -0
  16. package/template/apps/api/src/auth.ts +55 -0
  17. package/template/apps/api/src/bound-profiles.ts +590 -0
  18. package/template/apps/api/src/claims.ts +204 -0
  19. package/template/apps/api/src/cli.ts +99 -0
  20. package/template/apps/api/src/config.ts +180 -0
  21. package/template/apps/api/src/custody.ts +358 -0
  22. package/template/apps/api/src/dev-index.ts +120 -0
  23. package/template/apps/api/src/env-file.ts +55 -0
  24. package/template/apps/api/src/env.ts +14 -0
  25. package/template/apps/api/src/epcis/exchange.ts +434 -0
  26. package/template/apps/api/src/epcis/mongo-storage.ts +381 -0
  27. package/template/apps/api/src/epcis/routes.ts +364 -0
  28. package/template/apps/api/src/epcis/sources.ts +142 -0
  29. package/template/apps/api/src/go-live.ts +226 -0
  30. package/template/apps/api/src/http-error.ts +15 -0
  31. package/template/apps/api/src/identifiers.ts +57 -0
  32. package/template/apps/api/src/index-client.ts +261 -0
  33. package/template/apps/api/src/index-projects.ts +53 -0
  34. package/template/apps/api/src/lifecycle-authority.ts +49 -0
  35. package/template/apps/api/src/lifecycle.ts +485 -0
  36. package/template/apps/api/src/main.ts +58 -0
  37. package/template/apps/api/src/parties.ts +68 -0
  38. package/template/apps/api/src/platform.ts +176 -0
  39. package/template/apps/api/src/portability/commands.ts +224 -0
  40. package/template/apps/api/src/portability/export.ts +708 -0
  41. package/template/apps/api/src/portability/package.ts +270 -0
  42. package/template/apps/api/src/portability/restore.ts +863 -0
  43. package/template/apps/api/src/profiles.ts +125 -0
  44. package/template/apps/api/src/reader.ts +265 -0
  45. package/template/apps/api/src/resolver.ts +159 -0
  46. package/template/apps/api/src/sector-examples.ts +390 -0
  47. package/template/apps/api/src/server.ts +613 -0
  48. package/template/apps/api/src/store.ts +426 -0
  49. package/template/apps/api/src/validation-engine.ts +172 -0
  50. package/template/apps/api/src/wallet.ts +359 -0
  51. package/template/apps/api/src/worker.ts +113 -0
  52. package/template/apps/api/src/writer.ts +603 -0
  53. package/template/apps/api/test/bound-http.test.ts +496 -0
  54. package/template/apps/api/test/bound-profiles.test.ts +547 -0
  55. package/template/apps/api/test/config.test.ts +160 -0
  56. package/template/apps/api/test/custody-journal.test.ts +415 -0
  57. package/template/apps/api/test/custody-recovery-profile.test.ts +224 -0
  58. package/template/apps/api/test/custom-profile.test.ts +167 -0
  59. package/template/apps/api/test/env-file.test.ts +53 -0
  60. package/template/apps/api/test/epcis-fixtures.ts +270 -0
  61. package/template/apps/api/test/epcis-http.test.ts +1179 -0
  62. package/template/apps/api/test/epcis-mongo-storage.test.ts +313 -0
  63. package/template/apps/api/test/epcis-separation.test.ts +253 -0
  64. package/template/apps/api/test/epcis-web.test.ts +230 -0
  65. package/template/apps/api/test/exit-exercise.test.ts +1038 -0
  66. package/template/apps/api/test/external-index.test.ts +32 -0
  67. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/background.ttl +33 -0
  68. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/binding.json +141 -0
  69. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/context.jsonld +36 -0
  70. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/product.schema.json +44 -0
  71. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/shapes.ttl +112 -0
  72. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/conflicting-gtin.json +44 -0
  73. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/conflicting-serial.json +44 -0
  74. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/granularity-mismatch.json +44 -0
  75. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/item-gtin-13.json +43 -0
  76. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/item.json +42 -0
  77. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/missing-required-property.json +43 -0
  78. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/model-as-subject.json +44 -0
  79. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/no-passport-identifier.json +43 -0
  80. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/other-product.json +44 -0
  81. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/part-not-dishwasher-safe.json +45 -0
  82. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/registration/altered-artefact.json +19 -0
  83. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/registration/altered-background.ttl +33 -0
  84. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/registration/conflicting-binding.json +141 -0
  85. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/registration/conflicting-second-registration.json +19 -0
  86. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/registration/untrusted-binding.json +13 -0
  87. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/unlisted-context.json +47 -0
  88. package/template/apps/api/test/fixtures/custom-profile/example-bottle@1/vectors/wrong-binding-digest.json +44 -0
  89. package/template/apps/api/test/fixtures/custom-profile/example-notebook@1/binding.json +88 -0
  90. package/template/apps/api/test/fixtures/custom-profile/example-notebook@1/product.schema.json +25 -0
  91. package/template/apps/api/test/fixtures/custom-profile/example-notebook@1/vectors/item.json +26 -0
  92. package/template/apps/api/test/fixtures/custom-profile/example-notebook@1/vectors/missing-required-property.json +27 -0
  93. package/template/apps/api/test/fixtures/custom-profile/example-notebook@1/vectors/no-passport-identifier.json +27 -0
  94. package/template/apps/api/test/fixtures/custom-profile/example-notebook@1/vectors/other-product.json +28 -0
  95. package/template/apps/api/test/go-live.test.ts +179 -0
  96. package/template/apps/api/test/gs1-global-setup.ts +33 -0
  97. package/template/apps/api/test/gs1-test-env.ts +5 -0
  98. package/template/apps/api/test/identifier-host.test.ts +256 -0
  99. package/template/apps/api/test/index-projects.test.ts +81 -0
  100. package/template/apps/api/test/lifecycle-claims.test.ts +546 -0
  101. package/template/apps/api/test/lifecycle-fixtures.ts +167 -0
  102. package/template/apps/api/test/lifecycle.test.ts +147 -0
  103. package/template/apps/api/test/manifest-notice.test.ts +36 -0
  104. package/template/apps/api/test/network-guard.ts +113 -0
  105. package/template/apps/api/test/portability.test.ts +655 -0
  106. package/template/apps/api/test/profile-bundle-resolver.test.ts +198 -0
  107. package/template/apps/api/test/retired-profiles.test.ts +216 -0
  108. package/template/apps/api/test/sector-cutover.test.ts +95 -0
  109. package/template/apps/api/test/sector-forms.test.ts +420 -0
  110. package/template/apps/api/test/unjoined-index.test.ts +62 -0
  111. package/template/apps/api/test/validation-engine.test.ts +328 -0
  112. package/template/apps/api/test/wallet-monitor.test.ts +38 -0
  113. package/template/apps/api/test/writer-journal.test.ts +327 -0
  114. package/template/apps/api/tsconfig.json +9 -0
  115. package/template/apps/api/vitest.config.ts +12 -0
  116. package/template/apps/web/components.json +21 -0
  117. package/template/apps/web/index.html +12 -0
  118. package/template/apps/web/package.json +33 -0
  119. package/template/apps/web/src/app.tsx +55 -0
  120. package/template/apps/web/src/components/bits.tsx +188 -0
  121. package/template/apps/web/src/components/bound/bound-passport-form.tsx +368 -0
  122. package/template/apps/web/src/components/bound/field-view.tsx +237 -0
  123. package/template/apps/web/src/components/bound/pieces.tsx +169 -0
  124. package/template/apps/web/src/components/bound/readings.tsx +152 -0
  125. package/template/apps/web/src/components/bound/structured-value.tsx +114 -0
  126. package/template/apps/web/src/components/claim-dialog.tsx +344 -0
  127. package/template/apps/web/src/components/epcis-events.tsx +119 -0
  128. package/template/apps/web/src/components/layout.tsx +135 -0
  129. package/template/apps/web/src/components/lifecycle-claims.tsx +199 -0
  130. package/template/apps/web/src/components/passport-form.tsx +244 -0
  131. package/template/apps/web/src/components/read-passport.tsx +49 -0
  132. package/template/apps/web/src/components/reading.tsx +150 -0
  133. package/template/apps/web/src/components/ui/alert.tsx +65 -0
  134. package/template/apps/web/src/components/ui/badge.tsx +47 -0
  135. package/template/apps/web/src/components/ui/button.tsx +63 -0
  136. package/template/apps/web/src/components/ui/card.tsx +91 -0
  137. package/template/apps/web/src/components/ui/dialog.tsx +156 -0
  138. package/template/apps/web/src/components/ui/input.tsx +20 -0
  139. package/template/apps/web/src/components/ui/label.tsx +21 -0
  140. package/template/apps/web/src/components/ui/select.tsx +189 -0
  141. package/template/apps/web/src/components/ui/separator.tsx +25 -0
  142. package/template/apps/web/src/components/ui/table.tsx +115 -0
  143. package/template/apps/web/src/components/ui/tabs.tsx +90 -0
  144. package/template/apps/web/src/components/ui/textarea.tsx +17 -0
  145. package/template/apps/web/src/index.css +81 -0
  146. package/template/apps/web/src/lib/api.ts +396 -0
  147. package/template/apps/web/src/lib/auth.ts +10 -0
  148. package/template/apps/web/src/lib/bound/battery-form.ts +269 -0
  149. package/template/apps/web/src/lib/bound/display.ts +122 -0
  150. package/template/apps/web/src/lib/bound/fields.ts +128 -0
  151. package/template/apps/web/src/lib/bound/form-model.ts +521 -0
  152. package/template/apps/web/src/lib/bound/forms.ts +15 -0
  153. package/template/apps/web/src/lib/bound/identity.ts +48 -0
  154. package/template/apps/web/src/lib/bound/textile-form.ts +236 -0
  155. package/template/apps/web/src/lib/bound/units.ts +37 -0
  156. package/template/apps/web/src/lib/epcis.ts +345 -0
  157. package/template/apps/web/src/lib/format.ts +87 -0
  158. package/template/apps/web/src/lib/lifecycle.ts +350 -0
  159. package/template/apps/web/src/lib/session.tsx +92 -0
  160. package/template/apps/web/src/lib/use-load.ts +46 -0
  161. package/template/apps/web/src/main.tsx +18 -0
  162. package/template/apps/web/src/pages/accept.tsx +113 -0
  163. package/template/apps/web/src/pages/brand.tsx +94 -0
  164. package/template/apps/web/src/pages/brands.tsx +104 -0
  165. package/template/apps/web/src/pages/events.tsx +388 -0
  166. package/template/apps/web/src/pages/home.tsx +51 -0
  167. package/template/apps/web/src/pages/new-passport.tsx +137 -0
  168. package/template/apps/web/src/pages/operations.tsx +169 -0
  169. package/template/apps/web/src/pages/passport.tsx +632 -0
  170. package/template/apps/web/src/pages/public-passport.tsx +64 -0
  171. package/template/apps/web/src/pages/sign-in.tsx +93 -0
  172. package/template/apps/web/src/pages/verify.tsx +30 -0
  173. package/template/apps/web/src/pages/wallet.tsx +141 -0
  174. package/template/apps/web/tsconfig.json +29 -0
  175. package/template/apps/web/vite.config.ts +23 -0
  176. package/template/deploy/compose.yml +38 -0
  177. package/template/package.json +48 -0
  178. package/template/tsconfig.base.json +13 -0
package/LICENSE ADDED
@@ -0,0 +1,203 @@
1
+ Copyright © BSV Association
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,2 @@
1
+ dpp
2
+ Copyright 2026 BSV Association
package/PATENTS ADDED
@@ -0,0 +1,12 @@
1
+ THE FOREGOING LICENSE APPLIES SOLELY TO COPYRIGHT IN THE SOFTWARE INDICATED, AS
2
+ BSV ASSOCIATION (THE “LICENSOR”) HOLDS NO PATENT RIGHTS. THE LICENSOR SHALL NOT,
3
+ AND SHALL PROCURE ANY ENTITY LICENSING INTELLECTUAL PROPERTY TO THE LICENSOR
4
+ SHALL NOT, ASSERT ANY PATENT RIGHTS AGAINST YOU IN CONNECTION WITH YOUR USE OF
5
+ THE SOFTWARE OR ANY WORK DERIVED FROM IT. HOWEVER, THE SOFTWARE IS PROVIDED "AS
6
+ IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
7
+ TO THE WARRANTIES REGARDING ENTITLEMENT, MERCHANTABILITY, FITNESS FOR A
8
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE LICENSOR, AUTHORS
9
+ OR COPYRIGHT HOLDERS THEREOF BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
10
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
11
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
12
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,94 @@
1
- # Temporary Holding Version
1
+ # @bsv/create-dpp-app
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Scaffold a Digital Product Passport application on BSV in one command.
4
+
5
+ This starter and its renamed protocol dependency are source candidates pending publication. The npm command below applies after both are published; use the development commands below to test them from this checkout.
6
+
7
+ ```sh
8
+ npm create @bsv/dpp-app@0.1.0-beta.2 my-app
9
+ cd my-app
10
+ npm test
11
+ npm run dev
12
+ ```
13
+
14
+ You get a working application: a React web app with a brand dashboard, passport pages, hand-on acceptance and public verification; an Express API that owns a platform wallet, writes and reads passports with the `@bsv/dpp` packages, keeps a journal and runs the unattended duties; and a Compose service for the application database. The first run is a test of a whole passport lifecycle, with no wallet, funds or Docker. The template's README explains the rest, including the route to writing real passports.
15
+
16
+ In this source candidate the application also imports EPCIS 2.0 documents, pulls events from a configured source and exports what it received, byte for byte, by calling `@bsv/dpp-credentials/epcis-exchange`. Its tests of that fetch two things once and keep them: the three EPCIS files GS1 publishes, from `https://ref.gs1.org`, and a MongoDB server binary for the storage tests. The generated README's **EPCIS exchange** section covers the pages, the settings and the store.
17
+
18
+ It writes and reads passports under the manifest profile `general@2` and under profiles held by a binding: the current `eu-battery@2` and `eu-textile@2`, each with a form for its nested product data, and a profile of your own registered from a folder whose binding digest you trust. Under a binding the product document is split into a public part, on chain for good, and a restricted part, sealed off chain. The earlier sector manifest profiles are retired: the application offers none of them and refuses a write under one with `profile-retired`. The generated README's **Product documents under a binding** section covers the forms, the two views a reader is shown and the validation engine. Existing `eu-battery@1` and `eu-textile@1` passports remain readable and can be maintained under their signed bindings. Explicit new issuance under either historical binding names its version 2 successor.
19
+
20
+ ## Choose the index connection
21
+
22
+ | You want to | What to use |
23
+ | --- | --- |
24
+ | Build the application | `@bsv/create-dpp-app`, this starter |
25
+ | Connect to an existing compatible index | Its URL, network and scoped access settings |
26
+ | Operate your own index | The repository's operator preset, [`deploy/`](../../deploy/README.md): the index image and MongoDB on Docker Compose, whose `dpp-index connection` writes the file `npm run connect-index -- --from <file>` reads |
27
+
28
+ The app's Compose file starts only its database, so connecting a separately operated index cannot start another index accidentally. The app includes overlay library components for its offline exercises; those components do not deploy a persistent index. Do not manually install another overlay package as part of app setup. See the generated README's **Connect an index** section and [service choices](../../docs/start/choose-components-and-services.md).
29
+
30
+ ## What it decides for you
31
+
32
+ - TypeScript throughout, Node 22 or later, npm workspaces.
33
+ - Web: React, Vite, React Router, Tailwind CSS, shadcn/ui, built to static files the API serves.
34
+ - API: Express 5; MongoDB for records, journal and sign-in; Better Auth for sign-in with organisations as brands; a journal-driven worker loop for proofs and re-announcements.
35
+ - Wallet: `@bsv/wallet-toolbox` as a library, service-owned, keys in a SQLite file.
36
+ - Custody: managed, the platform signs for signed-in users; the party interface keeps self-custody open.
37
+ - Identifiers: GS1 Digital Links under the demonstration prefix 952 until you set a licensed one. The API answers each one at its own path as a GS1-Conformant Resolver for GTINs, with the resolver helpers of `@bsv/dpp-profiles`: a browser is redirected with 307 to the passport page at `/passport/01/<gtin>/21/<serial>`, and a client that asks for the linkset gets it.
38
+ - Validation: Ajv for manifest profiles; `jsonld`, `n3` and `shacl-engine`, at the versions `@bsv/dpp-profiles` is tested with, for profiles held by a binding. Nothing is fetched while validating. With `VALIDATOR_URL` set, the same two engines are asked of a validator service through `@bsv/dpp-profiles/validator-client` instead, and a service that does not answer blocks a write as missing libraries do.
39
+ - EPCIS: `@bsv/dpp-credentials/epcis-exchange` for import, pull and export, over a MongoDB storage adapter the template carries. An event is supplied data, kept apart from every passport: an import signs nothing and never reaches the wallet.
40
+ - Lifecycle claims: EPCIS lifecycle claims, `dpp-epcis-lifecycle@1` from `@bsv/dpp-credentials/epcis-lifecycle`, signed from an event a member enters or one the exchange retained, bound to the passports the event names and verified one finding at a time; native `dpp-lifecycle-v1` claims issued before are read and labelled historical, and no new one is issued.
41
+
42
+ - Moving: `export` and `restore` commands that carry the whole application as one signed `dpp-evidence-package@1` and restore it into another deployment, calling the profile bundle of `@bsv/dpp-profiles` and the recovery snapshot of `@bsv/dpp-credentials/epcis-exchange`. No package carries a key or a credential.
43
+
44
+ Every opinion is a file you can change. The standard itself prefers none of them.
45
+
46
+ ## Versions
47
+
48
+ Each release of this package scaffolds one DPP release set, named under `dpp` in `package.json`, with the exact package versions it pins. This source candidate uses `dpp-release-2026-11`: protocol and profiles `0.3.0-beta.10`, overlay `0.4.0-beta.13`, credentials `0.2.0-beta.6` and SDK `2.8.10`, the runtime the repository's index image builds. The generated app imports `@bsv/dpp-protocol` directly. Once published, a new release set requires a new starter version.
49
+
50
+ ## Development
51
+
52
+ This package is a workspace of the DPP standard's repository, published separately from its four runtime packages. Publish the pinned runtime set before the starter. From the repository root, test the source candidate:
53
+
54
+ ```sh
55
+ npm ci
56
+ npm run build
57
+ npm test -w @bsv/create-dpp-app
58
+ npm run starter:check
59
+ ```
60
+
61
+ The check installs the packed generator outside the repository, creates an app and uses local archives for the pinned DPP runtime. It then installs dependencies, builds, typechecks and runs the generated app's tests, including a check that `@bsv/dpp-core` is absent. The template keeps exact npm versions; archive paths are written only into the local test project.
62
+
63
+ To retain an editable app at a new directory, use:
64
+
65
+ ```sh
66
+ npm run starter:check -- --directory ../my-app
67
+ ```
68
+
69
+ Before publication, run the separate registry prerequisite check after the runtime packages are available:
70
+
71
+ ```sh
72
+ npm run starter:check -- --registry-dependencies
73
+ ```
74
+
75
+ This mode uses a fresh npm cache, installs the template's exact versions from public npm, and refuses missing dependencies without substituting local archives. The starter publication workflow requires it. Candidate checks establish neither registry availability nor blockchain inclusion.
76
+
77
+ For the CI image check, `--prepare-only --directory /tmp/my-app` creates the app and candidate archives without installing or testing. Its `.candidate.Dockerfile` adds the archive copy before the template's existing dependency installation; the bundled Dockerfile is unchanged. The image check builds that file and checks the API health endpoint.
78
+
79
+ The template lives in `template/`; files that tooling treats specially ship with a leading underscore (`_gitignore`, `_env.example`) and are renamed when scaffolded. Make template changes there, then regenerate and check a fresh app.
80
+
81
+ Two things in the template are copies or inventions, and the package's tests hold them to their sources:
82
+
83
+ - `template/apps/api/test/fixtures/custom-profile/` is a byte-for-byte copy of the repository's `examples/custom-profile/`, so a generated app can test a profile registered from a folder with no checkout beside it.
84
+ - The battery and textile examples in `template/apps/api/src/sector-examples.ts` were written for the starter: invented organisations and values, under the GS1 demonstration prefix 952. The template carries no third-party product document.
85
+
86
+ The web app has no test runner. The modules that decide what a form writes and where a finding is shown, under `template/apps/web/src/lib/bound/`, touch neither the page nor the network, and the API's tests exercise them (`apps/api/test/sector-forms.test.ts`). The same holds for the words the events page puts on an import, a pull and an event, in `template/apps/web/src/lib/epcis.ts` (`apps/api/test/epcis-web.test.ts`). The pages themselves are type-checked by the build.
87
+
88
+ The generated app's exit exercise, `apps/api/test/exit-exercise.test.ts`, builds one deployment, exports it, stops its database and its index, and restores into a second deployment with another store and another source of profiles. `npm run starter:check -- --exit-record deploy/evidence/exit-exercise.json` writes the record of that run. Both deployments are in one test process, with the reference index's code, the test wallet and the development session standing in for an index, a wallet and sign-in: the record says so.
89
+
90
+ The generated app's EPCIS tests need the pinned GS1 files and one MongoDB node in memory. `npm run starter:check` hands the generated app the repository's own GS1 cache, `node_modules/.cache/dpp-gs1`, when a test run has filled it; otherwise the app's test set-up fetches the files from `https://ref.gs1.org`. The MongoDB binary is the one the `@bsv/dpp-overlay` tests use, from the same cache.
91
+
92
+ ## Licence
93
+
94
+ Apache 2.0.
package/dist/index.js ADDED
@@ -0,0 +1,125 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * create-dpp-app: copy the bundled template into a new directory and name it.
4
+ *
5
+ * npm create @bsv/dpp-app@0.1.0-beta.2 my-app
6
+ * npx @bsv/create-dpp-app my-app [--no-install] [--yes]
7
+ *
8
+ * The template ships inside this package, so scaffolding needs no network;
9
+ * installing the dependencies does. Every version the template pins comes
10
+ * from one DPP release set, named in this package's manifest under "dpp".
11
+ */
12
+ import { randomBytes } from 'node:crypto';
13
+ import { spawnSync } from 'node:child_process';
14
+ import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, statSync, writeFileSync } from 'node:fs';
15
+ import { basename, dirname, join, resolve } from 'node:path';
16
+ import { fileURLToPath } from 'node:url';
17
+ const here = dirname(fileURLToPath(import.meta.url));
18
+ const packageRoot = join(here, '..');
19
+ const manifest = JSON.parse(readFileSync(join(packageRoot, 'package.json'), 'utf8'));
20
+ const args = process.argv.slice(2);
21
+ const flags = new Set(args.filter((a) => a.startsWith('--')));
22
+ const positional = args.filter((a) => !a.startsWith('--'));
23
+ if (flags.has('--help') || flags.has('-h')) {
24
+ console.log(`create-dpp-app ${manifest.version}: scaffold a Digital Product Passport application on BSV.
25
+
26
+ usage: npm create @bsv/dpp-app@0.1.0-beta.2 <directory> [--no-install] [--yes]
27
+
28
+ <directory> where to create the application; must be empty or hold only .git
29
+ --no-install do not run npm install afterwards
30
+ --yes create without the confirmation line (for scripts)
31
+
32
+ The template pins the DPP packages of ${manifest.dpp.releaseSet}:
33
+ ${Object.entries(manifest.dpp.packages)
34
+ .map(([name, version]) => ` ${name}@${version}`)
35
+ .join('\n')}`);
36
+ process.exit(0);
37
+ }
38
+ if (flags.has('--version') || flags.has('-v')) {
39
+ console.log(manifest.version);
40
+ process.exit(0);
41
+ }
42
+ const target = resolve(positional[0] ?? 'my-dpp');
43
+ const projectName = basename(target)
44
+ .toLowerCase()
45
+ .replace(/[^a-z0-9-]+/g, '-')
46
+ .replace(/^-+|-+$/g, '') || 'my-dpp';
47
+ if (existsSync(target)) {
48
+ const entries = readdirSync(target).filter((name) => name !== '.git');
49
+ if (entries.length > 0) {
50
+ console.error(`${target} is not empty (${entries.slice(0, 5).join(', ')}${entries.length > 5 ? ', ...' : ''}). Choose an empty directory.`);
51
+ process.exit(2);
52
+ }
53
+ }
54
+ console.log(`Creating ${projectName} in ${target} from the ${manifest.dpp.releaseSet} template.`);
55
+ mkdirSync(target, { recursive: true });
56
+ // Development artefacts never travel: a template checkout may hold them.
57
+ const skipped = new Set(['node_modules', 'dist', 'local', '.env', 'package-lock.json', '.DS_Store']);
58
+ cpSync(join(packageRoot, 'template'), target, {
59
+ recursive: true,
60
+ errorOnExist: false,
61
+ filter: (source) => !skipped.has(basename(source)),
62
+ });
63
+ // Files that npm strips or that tooling treats specially are shipped with a
64
+ // leading underscore and renamed here: _gitignore -> .gitignore and so on.
65
+ function restoreDotfiles(dir) {
66
+ for (const name of readdirSync(dir)) {
67
+ const path = join(dir, name);
68
+ if (statSync(path).isDirectory())
69
+ restoreDotfiles(path);
70
+ if (/^_[a-z]/i.test(name))
71
+ renameSync(path, join(dir, `.${name.slice(1)}`));
72
+ }
73
+ }
74
+ restoreDotfiles(target);
75
+ // Secrets exist from the first run: .env is written from .env.example with
76
+ // fresh values, so nothing is copied from an example file and the API's
77
+ // placeholder check never fires on a scaffolded project. The wallet root key
78
+ // stays empty: the first go-live generates it. The default index is the
79
+ // hosted testnet one, which go-live registers with.
80
+ const envPath = join(target, '.env');
81
+ if (existsSync(envPath)) {
82
+ console.error(`${envPath} already exists; it was not touched.`);
83
+ }
84
+ else {
85
+ const example = readFileSync(join(target, '.env.example'), 'utf8');
86
+ const generated = {
87
+ AUTH_SECRET: randomBytes(32).toString('hex'),
88
+ BRAND_ROOT_SECRET: randomBytes(32).toString('hex'),
89
+ MANAGED_IDENTITY_SECRET: randomBytes(32).toString('hex'),
90
+ NETWORK: 'test',
91
+ INDEX_URL: 'https://dpp-overlay-testnet.bsvb.net',
92
+ };
93
+ const env = example
94
+ .split('\n')
95
+ .map((line) => {
96
+ const match = /^([A-Z_]+)=/.exec(line);
97
+ return match != null && generated[match[1]] != null ? `${match[1]}=${generated[match[1]]}` : line;
98
+ })
99
+ .join('\n');
100
+ writeFileSync(envPath, env, { mode: 0o600 });
101
+ }
102
+ const rootManifestPath = join(target, 'package.json');
103
+ const rootManifest = JSON.parse(readFileSync(rootManifestPath, 'utf8'));
104
+ rootManifest.name = projectName;
105
+ writeFileSync(rootManifestPath, `${JSON.stringify(rootManifest, null, 2)}\n`);
106
+ const install = !flags.has('--no-install');
107
+ if (install) {
108
+ console.log('Installing dependencies with npm. The wallet toolbox brings a native SQLite driver; npm 11 may ask you to approve its install script.');
109
+ const result = spawnSync('npm', ['install'], { cwd: target, stdio: 'inherit' });
110
+ if (result.status !== 0) {
111
+ console.error('npm install did not finish. Run it again inside the directory; if npm reports a held install script, run: npm install-scripts approve better-sqlite3');
112
+ }
113
+ }
114
+ console.log(`
115
+ Done. Next:
116
+
117
+ cd ${positional[0] ?? 'my-dpp'}${install ? '' : '\n npm install'}
118
+ npm test # the offline dry run: issue, update, hand on, retire, claim; no wallet, funds or Docker
119
+ npm run dev # web on http://localhost:5173, API on http://localhost:3000, an index in this process
120
+ npm run go-live # register with the testnet index, check wallet, funds and admission, then publish for real
121
+
122
+ .env holds fresh secrets and points at the default testnet index; go-live makes the wallet key and stores the tokens.
123
+ An index is the service your app announces passports to and readers look them up in. The default one is hosted;
124
+ npm run connect-index takes another provider's, or your own run from the DPP operator preset.
125
+ Read README.md for what go-live checks and for mainnet.`);
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@bsv/create-dpp-app",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0-beta.2",
4
+ "description": "Scaffold a Digital Product Passport application on BSV: a web app, an API that writes and reads passports with the @bsv/dpp packages, and an offline dry run as its first test",
5
+ "license": "Apache-2.0",
6
+ "type": "module",
7
+ "bin": {
8
+ "create-dpp-app": "dist/index.js"
9
+ },
10
+ "files": [
11
+ "PATENTS",
12
+ "NOTICE",
13
+ "dist",
14
+ "template",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
18
+ "engines": {
19
+ "node": ">=22"
20
+ },
21
+ "scripts": {
22
+ "prepack": "node -e \"const fs=require('fs');for(const f of ['NOTICE','PATENTS'])fs.copyFileSync('../../'+f,f)\"",
23
+ "build": "tsc -p tsconfig.json",
24
+ "typecheck": "tsc -p tsconfig.json --noEmit",
25
+ "test": "node --test test/*.test.mjs",
26
+ "scaffold:check": "node scripts/scaffold-check.mjs"
27
+ },
28
+ "dpp": {
29
+ "releaseSet": "dpp-release-2026-11",
30
+ "packages": {
31
+ "@bsv/dpp-protocol": "0.3.0-beta.10",
32
+ "@bsv/dpp-profiles": "0.3.0-beta.10",
33
+ "@bsv/dpp-overlay": "0.4.0-beta.13",
34
+ "@bsv/dpp-credentials": "0.2.0-beta.6",
35
+ "@bsv/sdk": "2.8.10"
36
+ }
37
+ },
38
+ "devDependencies": {
39
+ "@types/node": "^22.20.3",
40
+ "typescript": "^7.0.2"
41
+ },
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/bsv-blockchain/dpp.git",
45
+ "directory": "packages/create-dpp-app"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public",
49
+ "registry": "https://registry.npmjs.org/",
50
+ "tag": "latest"
51
+ },
52
+ "keywords": [
53
+ "bsv",
54
+ "digital-product-passport",
55
+ "dpp",
56
+ "scaffold",
57
+ "create"
58
+ ]
59
+ }
@@ -0,0 +1,37 @@
1
+ # One image: the API serving the built web app. The wallet's SQLite driver is
2
+ # a native module; it ships prebuilt binaries for common platforms, and the
3
+ # build stage carries the tools to compile it where it does not.
4
+ #
5
+ # The base image is a build argument so a build can take the same Docker
6
+ # Official Image from a mirror, for example
7
+ # --build-arg BASE_IMAGE=public.ecr.aws/docker/library/node:22.23.4-bookworm-slim
8
+ # where Docker Hub rate limits apply. The default is Docker Hub's.
9
+ ARG BASE_IMAGE=node:22.23.4-bookworm-slim
10
+
11
+ FROM ${BASE_IMAGE} AS build
12
+ RUN test "$(node --version)" = "v22.23.4"
13
+ RUN apt-get update && apt-get install -y --no-install-recommends python3 make g++ && rm -rf /var/lib/apt/lists/*
14
+ WORKDIR /app
15
+ COPY package.json package-lock.json* ./
16
+ COPY apps/api/package.json apps/api/
17
+ COPY apps/web/package.json apps/web/
18
+ # npm ci with the committed lockfile; a fresh scaffold without one installs instead.
19
+ RUN if [ -f package-lock.json ]; then npm ci --no-audit --no-fund; else npm install --no-audit --no-fund; fi
20
+ COPY . .
21
+ RUN npm run build && npm prune --omit=dev
22
+
23
+ FROM ${BASE_IMAGE}
24
+ RUN test "$(node --version)" = "v22.23.4"
25
+ ENV NODE_ENV=production
26
+ WORKDIR /app
27
+ COPY --from=build /app/node_modules ./node_modules
28
+ COPY --from=build /app/package.json ./
29
+ COPY --from=build /app/apps/api/package.json ./apps/api/
30
+ COPY --from=build /app/apps/api/dist ./apps/api/dist
31
+ COPY --from=build /app/apps/web/dist ./apps/web/dist
32
+ # The wallet file and anything else the application keeps on disk.
33
+ RUN mkdir -p /app/local && chown -R node:node /app
34
+ USER node
35
+ VOLUME ["/app/local"]
36
+ EXPOSE 3000
37
+ CMD ["node", "apps/api/dist/main.js"]