@gusto/baerly-storage 0.2.0 → 0.4.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 (155) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +29 -0
  3. package/README.md +176 -70
  4. package/dist/API.md +213 -139
  5. package/dist/CHANGELOG.md +434 -0
  6. package/dist/RECIPES.md +125 -0
  7. package/dist/THIRD-PARTY-LICENSES.txt +238 -0
  8. package/dist/{app-config-C0Bbw_Z6.d.ts → app-config-DyiFK3_k.d.ts} +55 -11
  9. package/dist/app-config.d.ts +1 -1
  10. package/dist/auth.d.ts +1 -1
  11. package/dist/auth.js +301 -301
  12. package/dist/auth.js.map +1 -1
  13. package/dist/aws4fetch.esm-p7eEzLCs.js +1702 -0
  14. package/dist/aws4fetch.esm-p7eEzLCs.js.map +1 -0
  15. package/dist/baerly.js +35 -15
  16. package/dist/baerly.js.map +1 -1
  17. package/dist/baerly.spec.json +342 -0
  18. package/dist/bytes-BXdamO3L.js.map +1 -1
  19. package/dist/{client-DYZfoZb9.d.ts → client-Fe8CwB73.d.ts} +10 -10
  20. package/dist/client-react.d.ts +3 -3
  21. package/dist/client-react.js +4 -4
  22. package/dist/client-react.js.map +1 -1
  23. package/dist/client.d.ts +4 -4
  24. package/dist/client.js +3 -3
  25. package/dist/client.js.map +1 -1
  26. package/dist/{cloudflare-CINJPKCW.js → cloudflare-DzKBrUlg.js} +178 -2
  27. package/dist/cloudflare-DzKBrUlg.js.map +1 -0
  28. package/dist/cloudflare.d.ts +49 -6
  29. package/dist/cloudflare.js +59 -26
  30. package/dist/cloudflare.js.map +1 -1
  31. package/dist/config-1tv0-Yzm.js +2693 -0
  32. package/dist/config-1tv0-Yzm.js.map +1 -0
  33. package/dist/constants-CfeMWQWk.js +222 -0
  34. package/dist/constants-CfeMWQWk.js.map +1 -0
  35. package/dist/context-DRZ3tZ5l.js.map +1 -1
  36. package/dist/{cost-CQt1YRkA.js → cost-DSMIVqzL.js} +43 -42
  37. package/dist/cost-DSMIVqzL.js.map +1 -0
  38. package/dist/current-json-C6nhPOm1.js +190 -0
  39. package/dist/current-json-C6nhPOm1.js.map +1 -0
  40. package/dist/{db-BM3y2JQw.d.ts → db-DsPkOVEH.d.ts} +26 -108
  41. package/dist/{deploy-CrAbfgCq.js → deploy-DonTr-CV.js} +12 -5
  42. package/dist/deploy-DonTr-CV.js.map +1 -0
  43. package/dist/dev-vite.d.ts +11 -7
  44. package/dist/dev-vite.js +7 -6
  45. package/dist/dev-vite.js.map +1 -1
  46. package/dist/dev.d.ts +1 -1
  47. package/dist/dev.js +1 -1
  48. package/dist/{doctor-Db-hzPmE.js → doctor-DSIyCDg_.js} +14 -136
  49. package/dist/doctor-DSIyCDg_.js.map +1 -0
  50. package/dist/{dump-BYA55NLP.js → dump-Bh5k26VQ.js} +10 -31
  51. package/dist/dump-Bh5k26VQ.js.map +1 -0
  52. package/dist/{errors-DOdL95kK.js → errors-Dfa3p78c.js} +25 -5
  53. package/dist/errors-Dfa3p78c.js.map +1 -0
  54. package/dist/{export-Bhbz90-z.js → export-DtF5tDIM.js} +11 -32
  55. package/dist/{export-Bhbz90-z.js.map → export-DtF5tDIM.js.map} +1 -1
  56. package/dist/{fsck-CPPZWt9p.js → fsck-D_djMO5D.js} +28 -39
  57. package/dist/fsck-D_djMO5D.js.map +1 -0
  58. package/dist/{http-Cw8p6y5b.js → http-DxM9MflO.js} +151 -79
  59. package/dist/http-DxM9MflO.js.map +1 -0
  60. package/dist/http.d.ts +42 -26
  61. package/dist/http.js +3 -2
  62. package/dist/{index-DwDTWPSU.d.ts → index-0rZcMBwy.d.ts} +10 -7
  63. package/dist/{index-C3JAH1Yo.d.ts → index-B6oexfOB.d.ts} +9 -9
  64. package/dist/{index-cUY-36AN.d.ts → index-BNRh23K9.d.ts} +21 -5
  65. package/dist/{index-DSvwEUeF.d.ts → index-BYk9oCNf.d.ts} +240 -202
  66. package/dist/index.d.ts +6 -6
  67. package/dist/index.js +5 -5
  68. package/dist/{indexes-DAu2AkTW.d.ts → indexes-Dn9hbGQG.d.ts} +2 -2
  69. package/dist/{inspect-Bdbzvi-_.js → inspect-6WZ-pC7-.js} +21 -36
  70. package/dist/inspect-6WZ-pC7-.js.map +1 -0
  71. package/dist/key-Di6yyxFu.js +35 -0
  72. package/dist/key-Di6yyxFu.js.map +1 -0
  73. package/dist/{snapshot-SS8USDUF.js → log-tail-D98U1JBo.js} +179 -84
  74. package/dist/log-tail-D98U1JBo.js.map +1 -0
  75. package/dist/{maintenance-ClzBC1Vv.js → maintenance-B4Dki6Ig.js} +438 -176
  76. package/dist/maintenance-B4Dki6Ig.js.map +1 -0
  77. package/dist/{maintenance-BRrThz8V.d.ts → maintenance-B_e0T99L.d.ts} +114 -26
  78. package/dist/{maintenance-BvOv6BMM.js → maintenance-C7coQp4c.js} +217 -94
  79. package/dist/maintenance-C7coQp4c.js.map +1 -0
  80. package/dist/maintenance.d.ts +3 -2
  81. package/dist/maintenance.js +3 -2
  82. package/dist/node.d.ts +176 -68
  83. package/dist/node.js +3 -2
  84. package/dist/{normalize-XWY25_sG.js → normalize-rjnZLwS4.js} +2 -2
  85. package/dist/normalize-rjnZLwS4.js.map +1 -0
  86. package/dist/{observability-CpOiEN0k.js → observability-wzs3-BL_.js} +279 -109
  87. package/dist/observability-wzs3-BL_.js.map +1 -0
  88. package/dist/observability.d.ts +3 -3
  89. package/dist/observability.js +1 -1
  90. package/dist/{plan-DOTl21vq.js → plan-a7PJHBCy.js} +7 -4
  91. package/dist/plan-a7PJHBCy.js.map +1 -0
  92. package/dist/{query-BmiQy328.js → query-rAtXNQQB.js} +1063 -1202
  93. package/dist/query-rAtXNQQB.js.map +1 -0
  94. package/dist/{rebuild-index-DC_nR6wP.js → rebuild-index-BVzQSZlm.js} +10 -32
  95. package/dist/rebuild-index-BVzQSZlm.js.map +1 -0
  96. package/dist/{request-BEF_OvMh.js → request-u0M51mhJ.js} +3 -3
  97. package/dist/{request-BEF_OvMh.js.map → request-u0M51mhJ.js.map} +1 -1
  98. package/dist/restore-R-4rbciV.js +778 -0
  99. package/dist/restore-R-4rbciV.js.map +1 -0
  100. package/dist/runtime-spec-qL3_lTTU.js +391 -0
  101. package/dist/runtime-spec-qL3_lTTU.js.map +1 -0
  102. package/dist/s3-http-B-z8th6O.d.ts +60 -0
  103. package/dist/s3.d.ts +47 -0
  104. package/dist/s3.js +45 -0
  105. package/dist/s3.js.map +1 -0
  106. package/dist/{shared-secret-BJdSwpgw.js → shared-secret-DgEicd3x.js} +13 -5
  107. package/dist/shared-secret-DgEicd3x.js.map +1 -0
  108. package/dist/src-BG20LZs7.js +2271 -0
  109. package/dist/src-BG20LZs7.js.map +1 -0
  110. package/dist/{src-zhEAmmF7.js → src-CYHFDrKz.js} +82 -99
  111. package/dist/src-CYHFDrKz.js.map +1 -0
  112. package/dist/{src-QQ7jDeL2.js → src-DYZ4H1aF.js} +44 -23
  113. package/dist/src-DYZ4H1aF.js.map +1 -0
  114. package/dist/subcommand-DoDA-K7d.js +197 -0
  115. package/dist/subcommand-DoDA-K7d.js.map +1 -0
  116. package/dist/time-DUqvFMHq.js +119 -0
  117. package/dist/time-DUqvFMHq.js.map +1 -0
  118. package/dist/{usage-CLjirdD-.js → usage-DBV1eQHC.js} +7 -22
  119. package/dist/usage-DBV1eQHC.js.map +1 -0
  120. package/dist/{validate-DCq_0DIn.js → validate-DtljsCh1.js} +51 -51
  121. package/dist/{validate-DCq_0DIn.js.map → validate-DtljsCh1.js.map} +1 -1
  122. package/dist/wire-izfGZDvr.js.map +1 -1
  123. package/package.json +77 -42
  124. package/dist/cloudflare-CINJPKCW.js.map +0 -1
  125. package/dist/config-DVfDGyw1.js +0 -278
  126. package/dist/config-DVfDGyw1.js.map +0 -1
  127. package/dist/cost-CQt1YRkA.js.map +0 -1
  128. package/dist/current-json-C-EyJqs0.js +0 -354
  129. package/dist/current-json-C-EyJqs0.js.map +0 -1
  130. package/dist/deploy-CrAbfgCq.js.map +0 -1
  131. package/dist/doctor-Db-hzPmE.js.map +0 -1
  132. package/dist/dump-BYA55NLP.js.map +0 -1
  133. package/dist/errors-DOdL95kK.js.map +0 -1
  134. package/dist/fsck-CPPZWt9p.js.map +0 -1
  135. package/dist/http-Cw8p6y5b.js.map +0 -1
  136. package/dist/inspect-Bdbzvi-_.js.map +0 -1
  137. package/dist/maintenance-BvOv6BMM.js.map +0 -1
  138. package/dist/maintenance-ClzBC1Vv.js.map +0 -1
  139. package/dist/normalize-XWY25_sG.js.map +0 -1
  140. package/dist/observability-CpOiEN0k.js.map +0 -1
  141. package/dist/plan-DOTl21vq.js.map +0 -1
  142. package/dist/query-BmiQy328.js.map +0 -1
  143. package/dist/rebuild-index-DC_nR6wP.js.map +0 -1
  144. package/dist/restore-C6IcmLeA.js +0 -771
  145. package/dist/restore-C6IcmLeA.js.map +0 -1
  146. package/dist/shared-secret-BJdSwpgw.js.map +0 -1
  147. package/dist/snapshot-SS8USDUF.js.map +0 -1
  148. package/dist/src-DU1sCMlr.js +0 -6236
  149. package/dist/src-DU1sCMlr.js.map +0 -1
  150. package/dist/src-QQ7jDeL2.js.map +0 -1
  151. package/dist/src-zhEAmmF7.js.map +0 -1
  152. package/dist/subcommand-DZcHcsYp.js +0 -5122
  153. package/dist/subcommand-DZcHcsYp.js.map +0 -1
  154. package/dist/usage-CLjirdD-.js.map +0 -1
  155. /package/dist/{chunk-EAsCxrDo.js → rolldown-runtime-EAsCxrDo.js} +0 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Gusto, Inc.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,29 @@
1
+ baerly-storage
2
+ Copyright 2026 Gusto, Inc.
3
+
4
+ This product includes software derived from mps3
5
+ (https://github.com/endpointservices/mps3), Copyright (c) 2023 Endpoint
6
+ Services, licensed under the MIT License. The full text of that license
7
+ follows:
8
+
9
+ MIT License
10
+
11
+ Copyright (c) 2023 Endpoint Services
12
+
13
+ Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ of this software and associated documentation files (the "Software"), to deal
15
+ in the Software without restriction, including without limitation the rights
16
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ copies of the Software, and to permit persons to whom the Software is
18
+ furnished to do so, subject to the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be included in all
21
+ copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ SOFTWARE.
package/README.md CHANGED
@@ -1,26 +1,74 @@
1
1
  # baerly-storage
2
2
 
3
- **Storage is the missing primitive for agent-built software, and all you need is a library.**
3
+ **A database with no server. No daemon. No database runtime. Just your app and a bucket.**
4
4
 
5
- > _Currently a private Gusto preview, published as `@gusto/baerly-storage` privately under the `@gusto` org on npm (npmjs.com)._
5
+ A document database that lives _in_ an S3/R2 bucket you already own. No new vendor to clear, nothing resident to keep running, and an API small enough for an open-weights LLM to zero-shot.
6
6
 
7
- `baerly-storage` is a library that turns an S3-compatible bucket into a document database. **There is no runtime. None.** All coordination — fencing, commit, compaction, garbage collection — runs inside the HTTP request that triggered it: no daemon, no leader, no service bill, no on-call. The only persistent component is your bucket.
8
-
9
- Server bundle: ~110 KB gzipped on Cloudflare Workers, ~160 KB gzipped on Node. Browser client: ~5 KB gzipped. The whole public API fits in a single ~1000-line `dist/API.md` — small enough that an LLM can hold it in context.
7
+ ```text
8
+ before: client → app handler → database server (a server)
9
+ after: client → app handler → S3/R2 bucket (just storage)
10
+ ```
10
11
 
11
- [S3 does the hard parts](https://aws.amazon.com/blogs/aws/amazon-s3-update-strong-read-after-write-consistency/), `baerly-storage` is the coordination that fixes the API. Built like git: content-addressed documents, immutable log entries, and a single CAS-advanced pointer to HEAD. Document model, live queries, snapshot isolation — the whole surface in a `.d.ts` an LLM can use zero-shot.
12
+ The trick is to cram the entire database execution layer inside an HTTP
13
+ request. There is no server, daemon, or coordinator: each read or
14
+ write runs as library code inside your request handler, the bucket
15
+ holds the data, and the protocol supplies the commit rules.
16
+
17
+ The load-bearing operation is narrow — one conditional create of the next
18
+ log object commits a write. When the request ends, baerly-storage is gone. Poof!
19
+
20
+ - **An API small enough to hold in your context.** No DDL, no raw SQL —
21
+ 8 verbs and a ~12k-token surface you can hand to an LLM or a
22
+ non-engineer and walk away.
23
+ - **Idle rounds to zero.** No database process to keep warm, and no
24
+ per-app database floor across a fleet of small internal tools.
25
+ - **No data hostage.** `baerly export --target=postgres` gives you a
26
+ per-collection SQL snapshot. Crossing the envelope is the graduation
27
+ signal; the data exit is mechanical.
28
+ - **No new vendor.** Your S3/R2 bucket cleared security review years
29
+ ago; every hosted alternative means a fresh vendor review and an IT
30
+ ticket for a new managed-DB SKU.
31
+ - **Nothing to go down.** No resident service in your critical path, one
32
+ fewer failure domain. Servers that don't exist can't go down.
33
+ - **Built like git.** Content-addressed documents, immutable numbered log
34
+ entries, and one conditional log create as the commit, per collection.
35
+
36
+ <!-- Hero demo: render `docs/assets/demo.gif` from `docs/assets/demo.tape`
37
+ (`vhs docs/assets/demo.tape`) against a real bucket, then uncomment:
38
+ ![baerly-storage in 15 seconds — write a row, then list the bucket](./docs/assets/demo.gif)
39
+ -->
12
40
 
13
- Apps sized for this primitive — small, server-only writes, ~10 GB ceiling, mechanical exit to Postgres when they cross it — get a tool that matches their shape instead of a stack that doesn't.
41
+ ## Quick start
14
42
 
43
+ ```sh
44
+ pnpm create @gusto/baerly-storage@latest
15
45
  ```
16
- Compute → FaaS
17
- Tokens → LLM API
18
- Storage → this.
19
- ```
20
46
 
21
- Almost every team already has an S3-compatible bucket — for exports, backups, CSV graveyards. The security review happened years ago; the budget exists.
47
+ The wizard asks for a project name, target, and starter, then prints the
48
+ dev command. First run needs no bucket credentials: local dev uses local
49
+ storage and serves the UI plus `/v1/*` from one origin.
50
+
51
+ For a runnable multi-tab demo see
52
+ [`examples/react-node/`](./examples/react-node); for the full set of
53
+ production-shaped scaffolds see [`examples/`](./examples).
54
+
55
+ ## In code
56
+
57
+ The public surface is a small document API. The scaffolds wire `db` on
58
+ the server and `useQuery` in React; the calls look like this:
22
59
 
23
- ## The whole backend
60
+ ```ts
61
+ // server — writes land in your object-storage bucket
62
+ await db.collection("tickets").insert({ title: "Onboard Alex", status: "open" });
63
+
64
+ // client — reactive over your trusted handler, across every open tab
65
+ const open = useQuery((c) => c.collection("tickets").where({ status: "open" }).all(), []);
66
+ // open.status → "loading" | "refreshing" | "ok" | "skipped" | "error"
67
+ // open.data is present for "ok" / "refreshing"
68
+ ```
69
+
70
+ Application auth and tenant choice stay explicit in the handler. What
71
+ disappears is the database service and its surrounding machinery:
24
72
 
25
73
  ```diff
26
74
  - docker-compose.yml
@@ -35,84 +83,138 @@ Almost every team already has an S3-compatible bucket — for exports, backups,
35
83
  + // baerly.config.ts
36
84
  + export default defineConfig({
37
85
  + app: "tickets",
86
+ + tenant: "main",
38
87
  + collections: { tickets: {} },
39
88
  + target: "cloudflare",
89
+ + auth: "none", // dev; production supplies a verifier
40
90
  + });
41
91
  ```
42
92
 
43
- Your data lives in your bucket. The entire public surface fits in `.d.ts` files — no DDL, no SQL strings, no migrations to chase across deploys.
44
-
45
- ## In code
46
-
47
- ```ts
48
- // server — writes land in your R2 bucket
49
- await db.collection("tickets")
50
- .insert({ title: "Onboard Alex", status: "open" });
51
-
52
- // client — live across every open tab
53
- const { rows } = useLiveQuery<Ticket>({
54
- collection: "tickets",
55
- where: { status: "open" },
56
- });
57
- ```
93
+ Ordinary schema shape changes are TypeScript or config edits — no DDL, no
94
+ SQL strings, no generated migration ceremony.
58
95
 
59
96
  ## Cheat sheet
60
97
 
61
98
  ```ts
62
99
  // reads — Collection or, after a modifier, Query
63
- db.collection("tickets").get(id); // by id
100
+ db.collection("tickets").get(id); // by id
64
101
  db.collection("tickets").where({ status: "open" }).all();
65
- db.collection("tickets").where(q => q.gte("count", 1)).count();
102
+ db.collection("tickets")
103
+ .where((q) => q.gte("count", 1))
104
+ .count();
66
105
 
67
106
  // writes — by id on Collection, bulk on Query
68
107
  db.collection("tickets").insert({ status: "open", title: "ship it" });
69
- db.collection("tickets").update(id, { status: "closed" }); // merge-patch
108
+ db.collection("tickets").update(id, { status: "closed" }); // merge-patch
70
109
  db.collection("tickets").where({ status: "closed" }).delete();
71
110
  ```
72
111
 
73
- |---|---|
74
- | **Verbs** | `first` `all` `count` `get` · `insert` `update` `replace` `delete` |
75
- | **Modifiers** | `where` `order` `limit` |
76
- | **Operators** | `eq` `gt` `gte` `lt` `lte` `in` |
77
- | **Errors** | one `BaerlyError`, discriminate by `.code` (`Conflict`, `NotFound`, `SchemaError`, …) |
78
-
79
- Full reference: [`docs/guide/cheatsheet.md`](./docs/guide/cheatsheet.md), or
80
- `cat node_modules/@gusto/baerly-storage/dist/API.md` in an installed app.
81
-
82
- ## Why?
83
-
84
- - **An API an LLM can use first try.** The whole public surface fits in
85
- `.d.ts` files. No DDL. No raw SQL. Discriminated string errors.
86
- Provisioning is `pnpm install`, not a cloud-console detour. Verified
87
- with zero-shot eval suites.
88
- - **Idle rounds to zero.** No $5/mo floors multiplied across forty
89
- abandoned internal tools the loop produced last quarter. The runtime
90
- is a rounding error against the bucket.
91
- - **No hostage situation.** Log entries are shaped like Postgres
92
- logical-replication messages. `baerly export --target=postgres`
93
- graduates you out, mechanically, on the day an app outgrows this.
94
- - **Honest about its envelope.** Sized for ~10 GB / tenant, ~30 writes/min/collection sustained, ~100 collections / tenant. Crossing any of those is the success signal to graduate.
95
-
96
- ## Quick start
97
-
98
- ```sh
99
- pnpm create @gusto/baerly-storage@latest -- my-app --target=cloudflare
100
- cd my-app && pnpm install && pnpm dev
101
- ```
102
-
103
- `pnpm dev` boots Vite + workerd on `:5173`, so `/v1/*` and the React UI share one origin. For `--target=node`, it's `:3000` over `LocalFsStorage` — no S3 creds needed.
104
-
105
- Production deploys: anywhere `node server.js` runs — Railway, Render, Fly, Docker, bare VMs, on-prem boxes.
106
-
107
- For a runnable multi-tab demo see [`examples/react-node/`](./examples/react-node); for the full set of production-shaped scaffolds see [`examples/`](./examples).
112
+ | Surface | Vocabulary |
113
+ | ------------- | ------------------------------------------------------------------------------------- |
114
+ | **Verbs** | `first` `all` `count` `get` · `insert` `update` `replace` `delete` |
115
+ | **Modifiers** | `where` `order` `limit` |
116
+ | **Operators** | `eq` `gt` `gte` `lt` `lte` `in` |
117
+ | **Errors** | one `BaerlyError`, discriminate by `.code` (`Conflict`, `NotFound`, `SchemaError`, …) |
118
+
119
+ Full reference: [`docs/guide/cheatsheet.md`](./docs/guide/cheatsheet.md),
120
+ or `cat node_modules/@gusto/baerly-storage/dist/API.md` in an installed
121
+ app.
122
+
123
+ ## How it works
124
+
125
+ **The hard part of a database-in-a-bucket is the commit.** A bucket can
126
+ store objects; it cannot run a transaction coordinator. So one writer must
127
+ win each race, and every reader must be able to tell what won. [S3's strong consistency][s3-strong] makes object
128
+ storage usable as shared state; conditional writes supply the
129
+ one-writer-wins operation.
130
+
131
+ Concretely, a write drops new immutable objects in the bucket and then
132
+ creates the next numbered log entry for that collection with
133
+ create-if-absent (`If-None-Match: "*"`). Two writers racing the same slot
134
+ cannot both win; the loser reads the winner and retries at the next slot.
135
+ That create _is_ the commit. There is no resident coordinator: each
136
+ request reads bucket state, tries that create, and leaves no required
137
+ process behind. A read follows `current.json` to the snapshot and folds
138
+ the committed log tail into rows.
139
+
140
+ baerly-storage shares the immutable-artifact foundation of table formats
141
+ like Apache Iceberg and Delta Lake, but commits with a narrower step: no
142
+ metadata-pointer swap and no separate coordinator — just that one log
143
+ create. See [prior art and lineage](docs/spec/prior-art.md) for how it
144
+ relates to Iceberg, Delta Lake, Litestream, and Turbopuffer.
145
+
146
+ Each collection has its own ordered log, so **writes are per-collection
147
+ linearizable** — the `If-None-Match` log create linearizes every commit.
148
+ Cross-collection writes are unordered and non-atomic; that boundary is
149
+ part of the contract (see [When (not) to use it](#when-not-to-use-it)).
150
+
151
+ The durable contract is the bucket layout plus the conditional-write
152
+ rules. Another language could speak it by writing the same layout and
153
+ honoring the same rules. See
154
+ [`storage-compatibility.md`](./docs/spec/storage-compatibility.md).
155
+
156
+ [s3-strong]: https://aws.amazon.com/blogs/aws/amazon-s3-update-strong-read-after-write-consistency/
157
+
158
+ ### Security model
159
+
160
+ Bucket credentials never leave the server. Browsers talk only to your
161
+ trusted handler, which authenticates the caller, chooses the tenant
162
+ prefix, and applies the protocol against the bucket. Production recipes
163
+ support Cloudflare Access and JWKS bearer verification; shared-secret
164
+ auth is for service-to-service calls and dev. See
165
+ [`client-auth.md`](./docs/guide/client-auth.md).
166
+
167
+ ## When (not) to use it
168
+
169
+ Before you count rows or price reads, ask one question:
170
+
171
+ > Can the app's most important work be done from one collection?
172
+
173
+ If yes, baerly-storage may fit; then check query shape, atomicity, size,
174
+ and cost. A todo list, a single board's kanban, an event's RSVPs, one
175
+ channel's chat — each maps to one collection. The shape is narrow on
176
+ purpose: production-shaped for small workloads with a specific access
177
+ pattern, not a general-purpose database. If the core screen is a view
178
+ _across_ many collections, users, or tenants ("my pull requests," "all
179
+ code search," a cross-org dashboard), baerly-storage
180
+ should not be the only query engine for it.
181
+
182
+ It is **deliberately not** a few things:
183
+
184
+ - **No SQL, no joins.** Equality + dotted-path predicates, operators
185
+ added one at a time. The small surface is part of the contract.
186
+ - **Not a D1 / Postgres replacement.** Those are graduation targets, not
187
+ competitors — baerly-storage keeps the experiment cheap until you know
188
+ whether it's worth graduating.
189
+ - **Browser-direct multi-writer is out.** Trusted server-side app code is
190
+ the design center.
191
+ - **Realtime is long-poll first.** Polling is always correct; a WebSocket
192
+ tier would be a future opt-in.
193
+
194
+ None of these are apologies — baerly-storage names its envelope so
195
+ graduation is a feature, not a surprise: `baerly export
196
+ --target=postgres` makes the exit mechanical.
197
+ The shape test lives in
198
+ [workload-fit.md](./docs/about/workload-fit.md); the numeric envelope in
199
+ [graduation.md](./docs/about/graduation.md).
108
200
 
109
201
  ## Go deeper
110
202
 
111
- - 📖 **The essay** — [*Storage Is the Missing Primitive for Agent-Built Software*](https://docs.google.com/document/d/1jpMR-dV9wCprtzY2DUxAg_NZTrAf81OcB_vxKhiCPQ0/edit?tab=t.vo58xtzxjwr) [TODO: Replace with external link on publish]
112
- - 🧭 **How it works** — [`docs/about/how-it-works.md`](./docs/about/how-it-works.md) (the plain-language mental model — bucket + one atomic pointer flip)
203
+ - ✨ **Why baerly-storage** —
204
+ [`docs/about/why-baerly.md`](./docs/about/why-baerly.md)
205
+ - 🧭 **How it works** —
206
+ [`docs/about/how-it-works.md`](./docs/about/how-it-works.md) (bucket +
207
+ conditional log create)
113
208
  - 🧱 **Product thesis** — [`docs/about/thesis.md`](./docs/about/thesis.md)
114
- - 🏗️ **Architecture** — [`docs/contributing/architecture.md`](./docs/contributing/architecture.md)
115
- - 🔧 **Embed by hand** — [`packages/server/API.md`](./packages/server/API.md) (the embed-by-hand + custom-routes recipes — `baerlyNode().fetch` is the canonical shape; ships as `dist/API.md` in the package)
209
+ - 🏗️ **Architecture** —
210
+ [`docs/architecture.md`](./docs/architecture.md)
211
+ - 🔧 **Embed by hand** —
212
+ [`packages/server/API.md`](./packages/server/API.md) (embed-by-hand +
213
+ custom-routes recipes; ships as `dist/API.md` in the package)
214
+ - 📊 **Alternatives** —
215
+ [`docs/about/alternatives.md`](./docs/about/alternatives.md) (how
216
+ baerly-storage compares to Firebase, Supabase, Convex, and Cloudflare
217
+ D1)
116
218
 
117
219
  ## Where things live
118
220
 
@@ -122,3 +224,7 @@ For a runnable multi-tab demo see [`examples/react-node/`](./examples/react-node
122
224
  conventions, ADRs, protocol specs, operating procedures.
123
225
  - [`examples/`](./examples) — runnable scaffolds + the `react-node/`
124
226
  multi-tab demo.
227
+
228
+ ## License
229
+
230
+ Apache-2.0 — see [LICENSE](./LICENSE) and [NOTICE](./NOTICE).