@knowcode/doc-builder 1.8.2 → 1.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +23 -3
  2. package/README.md +4 -4
  3. package/cli.js +9 -40
  4. package/html/README.html +3 -3
  5. package/html/auth.js +1 -1
  6. package/html/documentation-index.html +3 -3
  7. package/html/guides/authentication-default-change.html +3 -3
  8. package/html/guides/authentication-guide.html +34 -45
  9. package/html/guides/claude-workflow-guide.html +3 -3
  10. package/html/guides/documentation-standards.html +3 -3
  11. package/html/guides/phosphor-icons-guide.html +3 -3
  12. package/html/guides/private-directory-authentication.html +35 -17
  13. package/html/guides/public-site-deployment.html +8 -9
  14. package/html/guides/search-engine-verification-guide.html +3 -3
  15. package/html/guides/seo-guide.html +3 -3
  16. package/html/guides/seo-optimization-guide.html +3 -3
  17. package/html/guides/troubleshooting-guide.html +3 -3
  18. package/html/guides/windows-setup-guide.html +3 -3
  19. package/html/index.html +3 -3
  20. package/html/js/auth.js +1 -1
  21. package/html/login.html +1 -1
  22. package/html/private/cache-control-anti-pattern.html +3 -3
  23. package/html/private/launch/README.html +3 -3
  24. package/html/private/launch/auth-cleanup-summary.html +3 -3
  25. package/html/private/launch/bubble-plugin-specification.html +3 -3
  26. package/html/private/launch/go-to-market-strategy.html +3 -3
  27. package/html/private/launch/launch-announcements.html +3 -3
  28. package/html/private/launch/vercel-deployment-auth-setup.html +25 -19
  29. package/html/private/next-steps-walkthrough.html +16 -43
  30. package/html/private/supabase-auth-implementation-completed.html +6 -6
  31. package/html/private/supabase-auth-implementation-plan.html +14 -31
  32. package/html/private/supabase-auth-integration-plan.html +32 -67
  33. package/html/private/supabase-auth-setup-guide.html +71 -82
  34. package/html/private/test-private-doc.html +3 -3
  35. package/html/private/user-management-tooling.html +7 -13
  36. package/html/sitemap.xml +44 -44
  37. package/html/vercel-cli-setup-guide.html +3 -3
  38. package/html/vercel-first-time-setup-guide.html +3 -3
  39. package/lib/config.js +3 -11
  40. package/lib/core-builder.js +1 -2
  41. package/lib/shared-auth-config.js +2 -10
  42. package/lib/supabase-auth.js +5 -11
  43. package/package.json +1 -1
  44. package/setup-database-v2.sql +53 -0
  45. package/user-management/README.md +9 -18
package/html/sitemap.xml CHANGED
@@ -2,265 +2,265 @@
2
2
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
3
  <url>
4
4
  <loc>https://doc-builder-delta.vercel.app/404.html</loc>
5
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
5
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
6
6
  <changefreq>monthly</changefreq>
7
7
  <priority>0.6</priority>
8
8
  </url>
9
9
  <url>
10
10
  <loc>https://doc-builder-delta.vercel.app/README.html</loc>
11
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
11
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
12
12
  <changefreq>monthly</changefreq>
13
13
  <priority>0.6</priority>
14
14
  </url>
15
15
  <url>
16
16
  <loc>https://doc-builder-delta.vercel.app/claude-workflow-guide.html</loc>
17
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
17
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
18
18
  <changefreq>monthly</changefreq>
19
19
  <priority>0.8</priority>
20
20
  </url>
21
21
  <url>
22
22
  <loc>https://doc-builder-delta.vercel.app/documentation-index.html</loc>
23
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
23
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
24
24
  <changefreq>monthly</changefreq>
25
25
  <priority>0.6</priority>
26
26
  </url>
27
27
  <url>
28
28
  <loc>https://doc-builder-delta.vercel.app/guides/authentication-default-change.html</loc>
29
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
29
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
30
30
  <changefreq>monthly</changefreq>
31
31
  <priority>0.8</priority>
32
32
  </url>
33
33
  <url>
34
34
  <loc>https://doc-builder-delta.vercel.app/guides/authentication-guide.html</loc>
35
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
35
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
36
36
  <changefreq>monthly</changefreq>
37
37
  <priority>0.8</priority>
38
38
  </url>
39
39
  <url>
40
40
  <loc>https://doc-builder-delta.vercel.app/guides/cache-control-anti-pattern.html</loc>
41
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
41
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
42
42
  <changefreq>monthly</changefreq>
43
43
  <priority>0.8</priority>
44
44
  </url>
45
45
  <url>
46
46
  <loc>https://doc-builder-delta.vercel.app/guides/claude-workflow-guide.html</loc>
47
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
47
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
48
48
  <changefreq>monthly</changefreq>
49
49
  <priority>0.8</priority>
50
50
  </url>
51
51
  <url>
52
52
  <loc>https://doc-builder-delta.vercel.app/guides/document-standards.html</loc>
53
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
53
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
54
54
  <changefreq>monthly</changefreq>
55
55
  <priority>0.8</priority>
56
56
  </url>
57
57
  <url>
58
58
  <loc>https://doc-builder-delta.vercel.app/guides/documentation-standards.html</loc>
59
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
59
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
60
60
  <changefreq>monthly</changefreq>
61
61
  <priority>0.8</priority>
62
62
  </url>
63
63
  <url>
64
64
  <loc>https://doc-builder-delta.vercel.app/guides/next-steps-walkthrough.html</loc>
65
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
65
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
66
66
  <changefreq>monthly</changefreq>
67
67
  <priority>0.8</priority>
68
68
  </url>
69
69
  <url>
70
70
  <loc>https://doc-builder-delta.vercel.app/guides/phosphor-icons-guide.html</loc>
71
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
71
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
72
72
  <changefreq>monthly</changefreq>
73
73
  <priority>0.8</priority>
74
74
  </url>
75
75
  <url>
76
76
  <loc>https://doc-builder-delta.vercel.app/guides/private-directory-authentication.html</loc>
77
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
77
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
78
78
  <changefreq>monthly</changefreq>
79
79
  <priority>0.8</priority>
80
80
  </url>
81
81
  <url>
82
82
  <loc>https://doc-builder-delta.vercel.app/guides/public-site-deployment.html</loc>
83
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
83
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
84
84
  <changefreq>monthly</changefreq>
85
85
  <priority>0.8</priority>
86
86
  </url>
87
87
  <url>
88
88
  <loc>https://doc-builder-delta.vercel.app/guides/search-engine-verification-guide.html</loc>
89
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
89
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
90
90
  <changefreq>monthly</changefreq>
91
91
  <priority>0.8</priority>
92
92
  </url>
93
93
  <url>
94
94
  <loc>https://doc-builder-delta.vercel.app/guides/seo-guide.html</loc>
95
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
95
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
96
96
  <changefreq>monthly</changefreq>
97
97
  <priority>0.8</priority>
98
98
  </url>
99
99
  <url>
100
100
  <loc>https://doc-builder-delta.vercel.app/guides/seo-optimization-guide.html</loc>
101
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
101
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
102
102
  <changefreq>monthly</changefreq>
103
103
  <priority>0.8</priority>
104
104
  </url>
105
105
  <url>
106
106
  <loc>https://doc-builder-delta.vercel.app/guides/supabase-auth-implementation-plan.html</loc>
107
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
107
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
108
108
  <changefreq>monthly</changefreq>
109
109
  <priority>0.8</priority>
110
110
  </url>
111
111
  <url>
112
112
  <loc>https://doc-builder-delta.vercel.app/guides/supabase-auth-integration-plan.html</loc>
113
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
113
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
114
114
  <changefreq>monthly</changefreq>
115
115
  <priority>0.8</priority>
116
116
  </url>
117
117
  <url>
118
118
  <loc>https://doc-builder-delta.vercel.app/guides/supabase-auth-setup-guide.html</loc>
119
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
119
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
120
120
  <changefreq>monthly</changefreq>
121
121
  <priority>0.8</priority>
122
122
  </url>
123
123
  <url>
124
124
  <loc>https://doc-builder-delta.vercel.app/guides/troubleshooting-guide.html</loc>
125
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
125
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
126
126
  <changefreq>monthly</changefreq>
127
127
  <priority>0.8</priority>
128
128
  </url>
129
129
  <url>
130
130
  <loc>https://doc-builder-delta.vercel.app/guides/vercel-deployment-auth-setup.html</loc>
131
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
131
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
132
132
  <changefreq>monthly</changefreq>
133
133
  <priority>0.8</priority>
134
134
  </url>
135
135
  <url>
136
136
  <loc>https://doc-builder-delta.vercel.app/guides/windows-setup-guide.html</loc>
137
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
137
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
138
138
  <changefreq>monthly</changefreq>
139
139
  <priority>0.8</priority>
140
140
  </url>
141
141
  <url>
142
142
  <loc>https://doc-builder-delta.vercel.app/index.html</loc>
143
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
143
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
144
144
  <changefreq>weekly</changefreq>
145
145
  <priority>1.0</priority>
146
146
  </url>
147
147
  <url>
148
148
  <loc>https://doc-builder-delta.vercel.app/launch/README.html</loc>
149
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
149
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
150
150
  <changefreq>monthly</changefreq>
151
151
  <priority>0.6</priority>
152
152
  </url>
153
153
  <url>
154
154
  <loc>https://doc-builder-delta.vercel.app/launch/bubble-plugin-specification.html</loc>
155
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
155
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
156
156
  <changefreq>monthly</changefreq>
157
157
  <priority>0.6</priority>
158
158
  </url>
159
159
  <url>
160
160
  <loc>https://doc-builder-delta.vercel.app/launch/go-to-market-strategy.html</loc>
161
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
161
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
162
162
  <changefreq>monthly</changefreq>
163
163
  <priority>0.6</priority>
164
164
  </url>
165
165
  <url>
166
166
  <loc>https://doc-builder-delta.vercel.app/launch/launch-announcements.html</loc>
167
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
167
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
168
168
  <changefreq>monthly</changefreq>
169
169
  <priority>0.6</priority>
170
170
  </url>
171
171
  <url>
172
172
  <loc>https://doc-builder-delta.vercel.app/private/cache-control-anti-pattern.html</loc>
173
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
173
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
174
174
  <changefreq>monthly</changefreq>
175
175
  <priority>0.6</priority>
176
176
  </url>
177
177
  <url>
178
178
  <loc>https://doc-builder-delta.vercel.app/private/launch/README.html</loc>
179
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
179
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
180
180
  <changefreq>monthly</changefreq>
181
181
  <priority>0.6</priority>
182
182
  </url>
183
183
  <url>
184
184
  <loc>https://doc-builder-delta.vercel.app/private/launch/auth-cleanup-summary.html</loc>
185
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
185
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
186
186
  <changefreq>monthly</changefreq>
187
187
  <priority>0.6</priority>
188
188
  </url>
189
189
  <url>
190
190
  <loc>https://doc-builder-delta.vercel.app/private/launch/bubble-plugin-specification.html</loc>
191
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
191
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
192
192
  <changefreq>monthly</changefreq>
193
193
  <priority>0.6</priority>
194
194
  </url>
195
195
  <url>
196
196
  <loc>https://doc-builder-delta.vercel.app/private/launch/go-to-market-strategy.html</loc>
197
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
197
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
198
198
  <changefreq>monthly</changefreq>
199
199
  <priority>0.6</priority>
200
200
  </url>
201
201
  <url>
202
202
  <loc>https://doc-builder-delta.vercel.app/private/launch/launch-announcements.html</loc>
203
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
203
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
204
204
  <changefreq>monthly</changefreq>
205
205
  <priority>0.6</priority>
206
206
  </url>
207
207
  <url>
208
208
  <loc>https://doc-builder-delta.vercel.app/private/launch/vercel-deployment-auth-setup.html</loc>
209
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
209
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
210
210
  <changefreq>monthly</changefreq>
211
211
  <priority>0.6</priority>
212
212
  </url>
213
213
  <url>
214
214
  <loc>https://doc-builder-delta.vercel.app/private/next-steps-walkthrough.html</loc>
215
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
215
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
216
216
  <changefreq>monthly</changefreq>
217
217
  <priority>0.6</priority>
218
218
  </url>
219
219
  <url>
220
220
  <loc>https://doc-builder-delta.vercel.app/private/supabase-auth-implementation-completed.html</loc>
221
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
221
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
222
222
  <changefreq>monthly</changefreq>
223
223
  <priority>0.6</priority>
224
224
  </url>
225
225
  <url>
226
226
  <loc>https://doc-builder-delta.vercel.app/private/supabase-auth-implementation-plan.html</loc>
227
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
227
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
228
228
  <changefreq>monthly</changefreq>
229
229
  <priority>0.6</priority>
230
230
  </url>
231
231
  <url>
232
232
  <loc>https://doc-builder-delta.vercel.app/private/supabase-auth-integration-plan.html</loc>
233
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
233
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
234
234
  <changefreq>monthly</changefreq>
235
235
  <priority>0.6</priority>
236
236
  </url>
237
237
  <url>
238
238
  <loc>https://doc-builder-delta.vercel.app/private/supabase-auth-setup-guide.html</loc>
239
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
239
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
240
240
  <changefreq>monthly</changefreq>
241
241
  <priority>0.8</priority>
242
242
  </url>
243
243
  <url>
244
244
  <loc>https://doc-builder-delta.vercel.app/private/test-private-doc.html</loc>
245
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
245
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
246
246
  <changefreq>monthly</changefreq>
247
247
  <priority>0.6</priority>
248
248
  </url>
249
249
  <url>
250
250
  <loc>https://doc-builder-delta.vercel.app/private/user-management-tooling.html</loc>
251
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
251
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
252
252
  <changefreq>monthly</changefreq>
253
253
  <priority>0.6</priority>
254
254
  </url>
255
255
  <url>
256
256
  <loc>https://doc-builder-delta.vercel.app/vercel-cli-setup-guide.html</loc>
257
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
257
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
258
258
  <changefreq>monthly</changefreq>
259
259
  <priority>0.8</priority>
260
260
  </url>
261
261
  <url>
262
262
  <loc>https://doc-builder-delta.vercel.app/vercel-first-time-setup-guide.html</loc>
263
- <lastmod>2025-07-26T10:38:42.055Z</lastmod>
263
+ <lastmod>2025-07-26T11:11:45.945Z</lastmod>
264
264
  <changefreq>monthly</changefreq>
265
265
  <priority>0.8</priority>
266
266
  </url>
@@ -98,8 +98,8 @@
98
98
  "name": "Knowcode Ltd",
99
99
  "url": "https://knowcode.tech"
100
100
  },
101
- "datePublished": "2025-07-26T10:38:42.041Z",
102
- "dateModified": "2025-07-26T10:38:42.041Z",
101
+ "datePublished": "2025-07-26T11:11:45.933Z",
102
+ "dateModified": "2025-07-26T11:11:45.933Z",
103
103
  "mainEntityOfPage": {
104
104
  "@type": "WebPage",
105
105
  "@id": "https://doc-builder-delta.vercel.app/vercel-cli-setup-guide.html"
@@ -132,7 +132,7 @@
132
132
 
133
133
  <div class="header-actions">
134
134
  <div class="deployment-info">
135
- <span class="deployment-date" title="Built with doc-builder v1.8.1">Last updated: Jul 26, 2025, 10:38 AM UTC</span>
135
+ <span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
136
136
  </div>
137
137
 
138
138
 
@@ -98,8 +98,8 @@
98
98
  "name": "Knowcode Ltd",
99
99
  "url": "https://knowcode.tech"
100
100
  },
101
- "datePublished": "2025-07-26T10:38:42.043Z",
102
- "dateModified": "2025-07-26T10:38:42.043Z",
101
+ "datePublished": "2025-07-26T11:11:45.935Z",
102
+ "dateModified": "2025-07-26T11:11:45.935Z",
103
103
  "mainEntityOfPage": {
104
104
  "@type": "WebPage",
105
105
  "@id": "https://doc-builder-delta.vercel.app/vercel-first-time-setup-guide.html"
@@ -132,7 +132,7 @@
132
132
 
133
133
  <div class="header-actions">
134
134
  <div class="deployment-info">
135
- <span class="deployment-date" title="Built with doc-builder v1.8.1">Last updated: Jul 26, 2025, 10:38 AM UTC</span>
135
+ <span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
136
136
  </div>
137
137
 
138
138
 
package/lib/config.js CHANGED
@@ -38,8 +38,7 @@ const defaultConfig = {
38
38
  // Authentication - Supabase only (basic auth removed for security)
39
39
  auth: {
40
40
  supabaseUrl: sharedAuth.supabaseUrl,
41
- supabaseAnonKey: sharedAuth.supabaseAnonKey,
42
- siteId: '' // Will be auto-generated if not provided
41
+ supabaseAnonKey: sharedAuth.supabaseAnonKey
43
42
  },
44
43
 
45
44
  // Changelog settings
@@ -124,8 +123,7 @@ const notionInspiredPreset = {
124
123
 
125
124
  auth: {
126
125
  supabaseUrl: process.env.SUPABASE_URL || sharedAuth.supabaseUrl,
127
- supabaseAnonKey: process.env.SUPABASE_ANON_KEY || sharedAuth.supabaseAnonKey,
128
- siteId: process.env.DOC_SITE_ID || '' // Will be auto-generated if not provided
126
+ supabaseAnonKey: process.env.SUPABASE_ANON_KEY || sharedAuth.supabaseAnonKey
129
127
  },
130
128
 
131
129
  changelog: {
@@ -312,13 +310,7 @@ async function loadConfig(configPath, options = {}) {
312
310
  console.log(chalk.blue('🔐 Found private directory - automatically enabling Supabase authentication'));
313
311
  config.features.authentication = 'supabase';
314
312
  config.features.autoAuthEnabled = true; // Track that this was auto-enabled
315
-
316
- // Auto-generate site ID if not provided
317
- if (!config.auth.siteId) {
318
- config.auth.siteId = sharedAuth.generateSiteId(config.siteName);
319
- console.log(chalk.blue(`📋 Generated site ID: ${config.auth.siteId}`));
320
- console.log(chalk.yellow(' Note: Add this site ID to your Supabase database to enable user access'));
321
- }
313
+ console.log(chalk.yellow(' Note: Grant users access by adding domain to the docbuilder_access table'));
322
314
  }
323
315
  }
324
316
 
@@ -1195,8 +1195,7 @@ async function generateSupabaseAuthFiles(outputDir, config) {
1195
1195
  // Use configured credentials (now with defaults from shared-auth-config)
1196
1196
  const authConfig = {
1197
1197
  supabaseUrl: config.auth.supabaseUrl,
1198
- supabaseAnonKey: config.auth.supabaseAnonKey,
1199
- siteId: config.auth.siteId
1198
+ supabaseAnonKey: config.auth.supabaseAnonKey
1200
1199
  };
1201
1200
 
1202
1201
  // Create Supabase auth instance
@@ -3,19 +3,11 @@
3
3
  *
4
4
  * These are the default Supabase credentials used by all doc-builder sites.
5
5
  * The same Supabase database is shared across all documentation sites,
6
- * with access control managed via the docbuilder_access table.
6
+ * with access control managed via the docbuilder_access table using domains as keys.
7
7
  */
8
8
 
9
9
  module.exports = {
10
10
  // Shared Supabase project credentials
11
11
  supabaseUrl: 'https://xcihhnfcitjrwbynxmka.supabase.co',
12
- supabaseAnonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InhjaWhobmZjaXRqcndieW54bWthIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTM0Mzc2MzcsImV4cCI6MjA2OTAxMzYzN30.zvWp3JFIR8fBIiwuFF5gqOR_Kxb42baZS5fsBz60XOY',
13
-
14
- // Function to generate a unique site ID
15
- generateSiteId: function(siteName) {
16
- const timestamp = Date.now();
17
- const random = Math.random().toString(36).substring(2, 8);
18
- const cleanName = siteName.toLowerCase().replace(/[^a-z0-9]/g, '-');
19
- return `${cleanName}-${timestamp}-${random}`;
20
- }
12
+ supabaseAnonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InhjaWhobmZjaXRqcndieW54bWthIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NTM0Mzc2MzcsImV4cCI6MjA2OTAxMzYzN30.zvWp3JFIR8fBIiwuFF5gqOR_Kxb42baZS5fsBz60XOY'
21
13
  };
@@ -21,8 +21,6 @@ class SupabaseAuth {
21
21
  detectSessionInUrl: true
22
22
  }
23
23
  });
24
-
25
- this.siteId = config.siteId;
26
24
  }
27
25
 
28
26
  /**
@@ -77,12 +75,12 @@ class SupabaseAuth {
77
75
  return;
78
76
  }
79
77
 
80
- // Check if user has access to this site
78
+ // Check if user has access to this site (using domain)
81
79
  const { data: access, error: accessError } = await supabaseClient
82
80
  .from('docbuilder_access')
83
81
  .select('*')
84
82
  .eq('user_id', user.id)
85
- .eq('site_id', '${this.config.siteId}')
83
+ .eq('domain', window.location.host)
86
84
  .single();
87
85
 
88
86
  if (accessError || !access) {
@@ -237,12 +235,12 @@ class SupabaseAuth {
237
235
 
238
236
  if (error) throw error;
239
237
 
240
- // Check if user has access to this site
238
+ // Check if user has access to this site (using domain)
241
239
  const { data: access, error: accessError } = await supabaseClient
242
240
  .from('docbuilder_access')
243
241
  .select('*')
244
242
  .eq('user_id', data.user.id)
245
- .eq('site_id', '${this.config.siteId}')
243
+ .eq('domain', window.location.host)
246
244
  .single();
247
245
 
248
246
  if (accessError || !access) {
@@ -322,7 +320,7 @@ class SupabaseAuth {
322
320
 
323
321
  // Only validate if at least one credential is provided
324
322
  // This allows the auth UI to show even without full configuration
325
- const hasAnyCredential = config.auth.supabaseUrl || config.auth.supabaseAnonKey || config.auth.siteId;
323
+ const hasAnyCredential = config.auth.supabaseUrl || config.auth.supabaseAnonKey;
326
324
 
327
325
  if (hasAnyCredential) {
328
326
  if (!config.auth.supabaseUrl) {
@@ -333,10 +331,6 @@ class SupabaseAuth {
333
331
  errors.push('auth.supabaseAnonKey is required');
334
332
  }
335
333
 
336
- if (!config.auth.siteId) {
337
- errors.push('auth.siteId is required');
338
- }
339
-
340
334
  // Validate URL format
341
335
  if (config.auth.supabaseUrl && !config.auth.supabaseUrl.match(/^https:\/\/\w+\.supabase\.co$/)) {
342
336
  errors.push('auth.supabaseUrl must be a valid Supabase URL (https://xxx.supabase.co)');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knowcode/doc-builder",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "Reusable documentation builder for markdown-based sites with Vercel deployment support",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -0,0 +1,53 @@
1
+ -- Doc-builder Supabase Database Setup V2
2
+ -- Simplified schema using domains instead of site IDs
3
+ -- Run this in your Supabase SQL Editor
4
+
5
+ -- Drop old tables if migrating
6
+ -- DROP TABLE IF EXISTS docbuilder_access;
7
+ -- DROP TABLE IF EXISTS docbuilder_sites;
8
+
9
+ -- Single table for user access control
10
+ CREATE TABLE docbuilder_access (
11
+ user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,
12
+ domain TEXT NOT NULL,
13
+ created_at TIMESTAMPTZ DEFAULT NOW(),
14
+ PRIMARY KEY (user_id, domain)
15
+ );
16
+
17
+ -- Create index for faster lookups
18
+ CREATE INDEX idx_docbuilder_access_domain ON docbuilder_access(domain);
19
+
20
+ -- Enable Row Level Security
21
+ ALTER TABLE docbuilder_access ENABLE ROW LEVEL SECURITY;
22
+
23
+ -- RLS Policy: Users can only see their own access
24
+ CREATE POLICY "Users see own access" ON docbuilder_access
25
+ FOR SELECT USING (user_id = auth.uid());
26
+
27
+ -- Example: Grant access to a user for a specific domain
28
+ -- INSERT INTO docbuilder_access (user_id, domain)
29
+ -- VALUES ('user-uuid-here', 'doc-builder-delta.vercel.app');
30
+
31
+ -- Example: Grant access to multiple users for a domain
32
+ -- INSERT INTO docbuilder_access (user_id, domain) VALUES
33
+ -- ('user-1-uuid', 'mydocs.vercel.app'),
34
+ -- ('user-2-uuid', 'mydocs.vercel.app'),
35
+ -- ('user-3-uuid', 'mydocs.vercel.app');
36
+
37
+ -- Example: Grant a user access to multiple domains
38
+ -- INSERT INTO docbuilder_access (user_id, domain) VALUES
39
+ -- ('user-uuid', 'docs.example.com'),
40
+ -- ('user-uuid', 'internal-docs.example.com'),
41
+ -- ('user-uuid', 'api-docs.example.com');
42
+
43
+ -- View all access for a domain (admin use)
44
+ -- SELECT u.email, da.created_at
45
+ -- FROM docbuilder_access da
46
+ -- JOIN auth.users u ON da.user_id = u.id
47
+ -- WHERE da.domain = 'mydocs.vercel.app';
48
+
49
+ -- Migration from old schema (if needed)
50
+ -- INSERT INTO docbuilder_access (user_id, domain)
51
+ -- SELECT da.user_id, ds.domain
52
+ -- FROM old_docbuilder_access da
53
+ -- JOIN docbuilder_sites ds ON da.site_id = ds.id;
@@ -217,10 +217,7 @@ Run the setup command:
217
217
 
218
218
  ### "Site not found"
219
219
 
220
- Make sure the site exists in the `docbuilder_sites` table. You can check with:
221
- ```bash
222
- ./add-users.sh sites
223
- ```
220
+ With the new domain-based system, sites no longer need to be registered. Just use the domain directly when granting access.
224
221
 
225
222
  ### "User already exists"
226
223
 
@@ -232,29 +229,23 @@ The user already has access to this site. No action needed.
232
229
 
233
230
  ## 📊 Database Schema
234
231
 
235
- The system uses two main tables:
236
-
237
- ### docbuilder_sites
238
- - `id` (UUID) - Primary key
239
- - `domain` (TEXT) - Site URL without https://
240
- - `name` (TEXT) - Display name
241
- - `created_at` (TIMESTAMP)
232
+ The system uses a single table with domain-based access:
242
233
 
243
234
  ### docbuilder_access
244
235
  - `user_id` (UUID) - References auth.users
245
- - `site_id` (UUID) - References docbuilder_sites
236
+ - `domain` (TEXT) - Site domain (e.g., docs.example.com)
246
237
  - `created_at` (TIMESTAMP)
238
+ - Primary key on (user_id, domain)
247
239
 
248
240
  ## 🎯 Common Workflows
249
241
 
250
242
  ### Setting up a new documentation site
251
243
 
252
- 1. Add the site to the database (manually or via SQL)
253
- 2. Add users who should have access:
254
- ```bash
255
- ./add-users.sh add my-docs.vercel.app user1@example.com
256
- ./add-users.sh add my-docs.vercel.app user2@example.com
257
- ```
244
+ No site registration needed! Just add users with domain access:
245
+ ```bash
246
+ ./add-users.sh add my-docs.vercel.app user1@example.com
247
+ ./add-users.sh add my-docs.vercel.app user2@example.com
248
+ ```
258
249
 
259
250
  ### Onboarding multiple team members
260
251