@knowcode/doc-builder 1.9.30 → 1.9.31

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 (196) hide show
  1. package/package.json +12 -2
  2. package/.claude/settings.local.json +0 -56
  3. package/CACHE-BUSTING-GUIDE.md +0 -82
  4. package/CLAUDE.md +0 -86
  5. package/CONTRIBUTING.md +0 -148
  6. package/GITHUB_SETUP.md +0 -203
  7. package/RELEASE-NOTES-1.7.5.md +0 -64
  8. package/Screenshot 2025-07-22 at 19.51.21.png +0 -0
  9. package/Screenshot 2025-07-26 at 17.06.49.png +0 -0
  10. package/add-user-clive.sql +0 -35
  11. package/add-user-lindsay-fixed.sql +0 -85
  12. package/add-user-lindsay.sql +0 -68
  13. package/add-user-pmorgan.sql +0 -35
  14. package/add-user-robbie.sql +0 -35
  15. package/add-wru-users.sql +0 -105
  16. package/debug-login.sql +0 -30
  17. package/doc-builder.config.js +0 -126
  18. package/doc-builder.config.js.backup.1753793768283 +0 -47
  19. package/doc-builder.config.js.backup.1753803964423 +0 -114
  20. package/doc-builder.config.js.backup.1753945707032 +0 -115
  21. package/doc-builder.config.js.backup.1754059241330 +0 -115
  22. package/doc-builder.config.js.backup.1754119567787 +0 -123
  23. package/doc-builder.config.js.backup.1754120048862 +0 -124
  24. package/doc-builder.config.js.backup.1754120529913 +0 -124
  25. package/doc-builder.config.js.backup.1754218469785 +0 -124
  26. package/doc-builder.config.js.backup.1754384764054 +0 -124
  27. package/doc-builder.config.js.backup.1754567425847 +0 -124
  28. package/doc-builder.config.js.backup.1754568137859 +0 -126
  29. package/doc-builder.config.js.backup.1754569388252 +0 -126
  30. package/doc-builder.config.js.backup.1754576694123 +0 -126
  31. package/doc-builder.config.js.backup.1755031374829 +0 -126
  32. package/doc-builder.config.js.backup.1755034500990 +0 -126
  33. package/doc-builder.config.js.backup.1755034809236 +0 -126
  34. package/grant-access.sql +0 -15
  35. package/html/11.png +0 -0
  36. package/html/404.html +0 -115
  37. package/html/README.html +0 -522
  38. package/html/Screenshot 2025-08-12 at 21.35.07.png +0 -0
  39. package/html/about-doc-builder.html +0 -491
  40. package/html/auth.js +0 -157
  41. package/html/claude-workflow-guide.html +0 -525
  42. package/html/css/notion-style.css +0 -2502
  43. package/html/documentation-index.html +0 -471
  44. package/html/guides/authentication-default-change.html +0 -370
  45. package/html/guides/authentication-guide.html +0 -509
  46. package/html/guides/cache-control-anti-pattern.html +0 -361
  47. package/html/guides/claude-workflow-guide.html +0 -1074
  48. package/html/guides/configuration-guide.html +0 -472
  49. package/html/guides/document-standards.html +0 -518
  50. package/html/guides/documentation-standards.html +0 -694
  51. package/html/guides/html-embedding-guide.html +0 -461
  52. package/html/guides/image-modal-guide.html +0 -515
  53. package/html/guides/next-steps-walkthrough.html +0 -638
  54. package/html/guides/phosphor-icons-guide.html +0 -584
  55. package/html/guides/private-directory-authentication-troubleshooting.html +0 -555
  56. package/html/guides/private-directory-authentication.html +0 -541
  57. package/html/guides/public-site-deployment.html +0 -431
  58. package/html/guides/search-engine-verification-guide.html +0 -542
  59. package/html/guides/seo-guide.html +0 -661
  60. package/html/guides/seo-optimization-guide.html +0 -887
  61. package/html/guides/supabase-auth-implementation-plan.html +0 -543
  62. package/html/guides/supabase-auth-integration-plan.html +0 -671
  63. package/html/guides/supabase-auth-setup-guide.html +0 -498
  64. package/html/guides/supabase-authentication-complete-guide.html +0 -866
  65. package/html/guides/troubleshooting-guide.html +0 -633
  66. package/html/guides/vercel-deployment-auth-setup.html +0 -337
  67. package/html/guides/windows-setup-guide.html +0 -859
  68. package/html/image-modal-test.html +0 -318
  69. package/html/index.html +0 -522
  70. package/html/js/auth.js +0 -157
  71. package/html/js/main.js +0 -1754
  72. package/html/launch/README.html +0 -297
  73. package/html/launch/bubble-plugin-specification.html +0 -933
  74. package/html/launch/go-to-market-strategy.html +0 -663
  75. package/html/launch/launch-announcements.html +0 -593
  76. package/html/login.html +0 -102
  77. package/html/logout.html +0 -18
  78. package/html/private/cache-control-anti-pattern.html +0 -429
  79. package/html/private/launch/README.html +0 -371
  80. package/html/private/launch/auth-cleanup-summary.html +0 -361
  81. package/html/private/launch/bubble-plugin-specification.html +0 -1007
  82. package/html/private/launch/go-to-market-strategy.html +0 -737
  83. package/html/private/launch/launch-announcements.html +0 -667
  84. package/html/private/launch/vercel-deployment-auth-setup.html +0 -417
  85. package/html/private/next-steps-walkthrough.html +0 -679
  86. package/html/private/supabase-auth-implementation-completed.html +0 -454
  87. package/html/private/supabase-auth-implementation-plan.html +0 -594
  88. package/html/private/supabase-auth-integration-plan.html +0 -704
  89. package/html/private/supabase-auth-setup-guide.html +0 -555
  90. package/html/private/test-private-doc.html +0 -302
  91. package/html/private/user-management-tooling.html +0 -601
  92. package/html/prompts/Screenshot 2025-08-02 at 08.49.55.png +0 -0
  93. package/html/prompts/beautiful-documentation-design.html +0 -784
  94. package/html/prompts/markdown-document-standards.html +0 -422
  95. package/html/prompts/project-rename-strategy-sasha-publish.html +0 -530
  96. package/html/robots.txt +0 -9
  97. package/html/sitemap.xml +0 -357
  98. package/html/test-questions/how-does-it-work%3F.html +0 -294
  99. package/html/test-questions/step-1%3A%20getting-started.html +0 -289
  100. package/html/test-questions/what-is-the-purpose.html +0 -293
  101. package/html/test-status.html +0 -281
  102. package/html/vercel-cli-setup-guide.html +0 -495
  103. package/html/vercel-first-time-setup-guide.html +0 -454
  104. package/html/vercel.json +0 -29
  105. package/html-static/11.png +0 -0
  106. package/html-static/404.html +0 -115
  107. package/html-static/README.html +0 -609
  108. package/html-static/Screenshot 2025-08-12 at 21.35.07.png +0 -0
  109. package/html-static/about-doc-builder.html +0 -578
  110. package/html-static/css/notion-style.css +0 -2502
  111. package/html-static/documentation-index.html +0 -558
  112. package/html-static/guides/authentication-default-change.html +0 -457
  113. package/html-static/guides/authentication-guide.html +0 -596
  114. package/html-static/guides/claude-workflow-guide.html +0 -1161
  115. package/html-static/guides/configuration-guide.html +0 -559
  116. package/html-static/guides/documentation-standards.html +0 -781
  117. package/html-static/guides/html-embedding-guide.html +0 -548
  118. package/html-static/guides/image-modal-guide.html +0 -602
  119. package/html-static/guides/phosphor-icons-guide.html +0 -671
  120. package/html-static/guides/private-directory-authentication-troubleshooting.html +0 -642
  121. package/html-static/guides/private-directory-authentication.html +0 -628
  122. package/html-static/guides/public-site-deployment.html +0 -518
  123. package/html-static/guides/search-engine-verification-guide.html +0 -629
  124. package/html-static/guides/seo-guide.html +0 -748
  125. package/html-static/guides/seo-optimization-guide.html +0 -974
  126. package/html-static/guides/supabase-authentication-complete-guide.html +0 -953
  127. package/html-static/guides/troubleshooting-guide.html +0 -720
  128. package/html-static/guides/windows-setup-guide.html +0 -946
  129. package/html-static/image-modal-test.html +0 -405
  130. package/html-static/index.html +0 -609
  131. package/html-static/js/main.js +0 -1754
  132. package/html-static/prompts/Screenshot 2025-08-02 at 08.49.55.png +0 -0
  133. package/html-static/prompts/beautiful-documentation-design.html +0 -871
  134. package/html-static/prompts/markdown-document-standards.html +0 -509
  135. package/html-static/prompts/project-rename-strategy-sasha-publish.html +0 -617
  136. package/html-static/robots.txt +0 -5
  137. package/html-static/sitemap.xml +0 -195
  138. package/html-static/test-questions/how-does-it-work%3F.html +0 -381
  139. package/html-static/test-questions/step-1%3A%20getting-started.html +0 -376
  140. package/html-static/test-questions/what-is-the-purpose.html +0 -380
  141. package/html-static/vercel-cli-setup-guide.html +0 -582
  142. package/html-static/vercel-first-time-setup-guide.html +0 -541
  143. package/manage-users.sql +0 -191
  144. package/migrate-to-domain-auth.sql +0 -47
  145. package/package/CACHE-BUSTING-GUIDE.md +0 -82
  146. package/package/CHANGELOG.md +0 -902
  147. package/package/README.md +0 -248
  148. package/package/assets/css/notion-style.css +0 -2211
  149. package/package/assets/js/auth.js +0 -67
  150. package/package/assets/js/main.js +0 -1565
  151. package/package/cli.js +0 -764
  152. package/package/index.js +0 -38
  153. package/package/knowcode-doc-builder-1.3.15.tgz +0 -0
  154. package/package/lib/builder.js +0 -32
  155. package/package/lib/config.js +0 -278
  156. package/package/lib/core-builder.js +0 -957
  157. package/package/lib/deploy.js +0 -497
  158. package/package/lib/dev-server.js +0 -96
  159. package/package/package.json +0 -34
  160. package/package/scripts/npx-runner.js +0 -27
  161. package/package/scripts/setup.js +0 -56
  162. package/package/test-cache-bust.sh +0 -43
  163. package/public-config.js +0 -22
  164. package/public-html/404.html +0 -115
  165. package/public-html/README.html +0 -149
  166. package/public-html/css/notion-style.css +0 -2036
  167. package/public-html/index.html +0 -149
  168. package/public-html/js/auth.js +0 -67
  169. package/public-html/js/main.js +0 -1485
  170. package/quick-test-commands.md +0 -40
  171. package/recordings/Screenshot 2025-07-24 at 18.22.01.png +0 -0
  172. package/recordings/mh-ls-22jul.txt +0 -2305
  173. package/screenshot.png +0 -0
  174. package/scripts/Screenshot 2025-07-23 at 15.39.41.png +0 -0
  175. package/setup-database-v2.sql +0 -53
  176. package/setup-database.sql +0 -41
  177. package/test-auth-config.js +0 -17
  178. package/test-cache-bust.sh +0 -43
  179. package/test-docs/README.md +0 -39
  180. package/test-html/404.html +0 -115
  181. package/test-html/README.html +0 -172
  182. package/test-html/auth.js +0 -97
  183. package/test-html/css/notion-style.css +0 -2036
  184. package/test-html/index.html +0 -172
  185. package/test-html/js/auth.js +0 -97
  186. package/test-html/js/main.js +0 -1485
  187. package/test-html/login.html +0 -102
  188. package/test-html/logout.html +0 -18
  189. package/update-domain.sql +0 -9
  190. package/user-access-view.sql +0 -49
  191. package/user-management/README.md +0 -301
  192. package/user-management/add-users.sh +0 -776
  193. package/user-management/create-user.js +0 -65
  194. package/user-management/users.txt +0 -15
  195. package/view-all-users.sql +0 -40
  196. package/wru-auth-config.js +0 -17
@@ -1,953 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <meta name="description" content="A comprehensive guide to implementing enterprise-grade authentication in @knowcode/doc-builder using Supabase.">
7
- <title>Complete Supabase Authentication Guide</title>
8
-
9
- <meta name="generator" content="@knowcode/doc-builder by Knowcode Ltd">
10
- <meta name="author" content="Lindsay Smith">
11
- <meta name="keywords" content="documentation, markdown, static site generator, vercel, notion-style, authentication, supabase">
12
- <meta name="robots" content="index, follow">
13
- <link rel="canonical" href="https://doc-builder-delta.vercel.app/guides/supabase-authentication-complete-guide.html">
14
-
15
- <!-- Open Graph / Facebook -->
16
- <meta property="og:type" content="article">
17
- <meta property="og:url" content="https://doc-builder-delta.vercel.app/guides/supabase-authentication-complete-guide.html">
18
- <meta property="og:title" content="Complete Supabase Authentication Guide">
19
- <meta property="og:description" content="A comprehensive guide to implementing enterprise-grade authentication in @knowcode/doc-builder using Supabase.">
20
- <meta property="og:image" content="https://doc-builder-delta.vercel.app/og-default.png">
21
- <meta property="og:site_name" content="@knowcode/doc-builder">
22
- <meta property="og:locale" content="en_US">
23
-
24
- <!-- Twitter Card -->
25
- <meta name="twitter:card" content="summary_large_image">
26
- <meta name="twitter:site" content="@planbbackups">
27
- <meta name="twitter:creator" content="@planbbackups">
28
- <meta name="twitter:title" content="Complete Supabase Authentication Guide">
29
- <meta name="twitter:description" content="A comprehensive guide to implementing enterprise-grade authentication in @knowcode/doc-builder using Supabase.">
30
- <meta name="twitter:image" content="https://doc-builder-delta.vercel.app/og-default.png">
31
-
32
- <!-- Custom Meta Tags -->
33
- <meta name="google-site-verification" content="FtzcDTf5BQ9K5EfnGazQkgU2U4FiN3ITzM7gHwqUAqQ">
34
- <meta name="msvalidate.01" content="B2D8C4C12C530D47AA962B24CAA09630">
35
-
36
- <!-- Fonts -->
37
- <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
38
-
39
- <!-- Icons -->
40
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
41
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@phosphor-icons/web@2.1.1/src/regular/style.css">
42
-
43
- <!-- Mermaid -->
44
- <script src="https://cdn.jsdelivr.net/npm/mermaid@10.6.1/dist/mermaid.min.js"></script>
45
-
46
- <!-- Styles -->
47
- <link rel="stylesheet" href="../css/notion-style.css">
48
-
49
-
50
- <!-- Blue theme and white background overrides for static output -->
51
- <style>
52
- /* Override green colors with blue */
53
- :root {
54
- --primary: #2563eb;
55
- --primary-dark: #1d4ed8;
56
- --primary-light: #dbeafe;
57
- --accent: #3b82f6;
58
- --color-accent-green: #2563eb;
59
- --color-accent-emerald: #3b82f6;
60
-
61
- /* White backgrounds for cleaner appearance */
62
- --color-bg-secondary: #FFFFFF;
63
- --color-bg-tertiary: #FAFAFA;
64
- --color-bg-hover: #F8F9FA;
65
- }
66
-
67
- /* Override green status colors with blue variants */
68
- .nav-item.active {
69
- background-color: #dbeafe !important;
70
- color: #1d4ed8 !important;
71
- }
72
-
73
- .nav-item:hover {
74
- background-color: #eff6ff !important;
75
- }
76
-
77
- /* Override complete/success icons to blue */
78
- .ph-check-circle[style*="color: #059669"] {
79
- color: #2563eb !important;
80
- }
81
-
82
- /* Override README/home icon color */
83
- .ph-house[style*="color: #059669"] {
84
- color: #2563eb !important;
85
- }
86
-
87
- /* Override links */
88
- a {
89
- color: #2563eb;
90
- }
91
-
92
- a:hover {
93
- color: #1d4ed8;
94
- }
95
-
96
- /* Override buttons and interactive elements */
97
- .theme-toggle:hover,
98
- .menu-toggle:hover {
99
- background-color: #dbeafe;
100
- color: #1d4ed8;
101
- }
102
-
103
- /* Override nav title hover */
104
- .nav-title:hover {
105
- background-color: #eff6ff;
106
- }
107
-
108
- /* White backgrounds for sidebar and navigation */
109
- body:not(.dark-mode) .sidebar {
110
- background: #FFFFFF !important;
111
- background-color: #FFFFFF !important;
112
- border-right: 1px solid #E5E7EB !important;
113
- }
114
-
115
- body:not(.dark-mode) .nav-section {
116
- background: #FFFFFF !important;
117
- background-color: #FFFFFF !important;
118
- }
119
-
120
- body:not(.dark-mode) .nav-content {
121
- background: #FFFFFF !important;
122
- background-color: #FFFFFF !important;
123
- }
124
-
125
- body:not(.dark-mode) .navigation {
126
- background: #FFFFFF !important;
127
- background-color: #FFFFFF !important;
128
- }
129
-
130
- /* Subtle separation for nav sections */
131
- body:not(.dark-mode) .nav-section + .nav-section {
132
- border-top: 1px solid #F3F4F6;
133
- }
134
-
135
- /* Adjust hover states for white backgrounds */
136
- body:not(.dark-mode) .nav-item:hover {
137
- background-color: #F8F9FA !important;
138
- }
139
-
140
- body:not(.dark-mode) .nav-title.collapsible:hover {
141
- background-color: #F8F9FA !important;
142
- }
143
-
144
- /* Header stays white (already is) but ensure consistency */
145
- body:not(.dark-mode) .header {
146
- background: #FFFFFF !important;
147
- background-color: #FFFFFF !important;
148
- border-bottom: 1px solid #E5E7EB !important;
149
- }
150
-
151
- /* Ensure search box looks good on white */
152
- body:not(.dark-mode) .filter-input,
153
- body:not(.dark-mode) .sidebar-search {
154
- background: #F8F9FA !important;
155
- background-color: #F8F9FA !important;
156
- border: 1px solid #E5E7EB !important;
157
- }
158
-
159
- body:not(.dark-mode) .filter-input:focus,
160
- body:not(.dark-mode) .sidebar-search:focus {
161
- background: #FFFFFF !important;
162
- background-color: #FFFFFF !important;
163
- border-color: #2563eb !important;
164
- }
165
-
166
- /* Override breadcrumbs */
167
- .breadcrumbs a {
168
- color: #2563eb;
169
- }
170
-
171
- .breadcrumbs a:hover {
172
- color: #1d4ed8;
173
- background-color: #dbeafe;
174
- }
175
-
176
- /* Override filter icon */
177
- .filter-icon {
178
- color: #2563eb;
179
- }
180
-
181
- /* Override deployment info on hover */
182
- .deployment-date:hover {
183
- color: #2563eb;
184
- }
185
-
186
- /* Dark mode adjustments */
187
- body.dark-mode {
188
- --primary: #3b82f6;
189
- --primary-dark: #2563eb;
190
- --primary-light: #1e3a8a;
191
- --accent: #60a5fa;
192
- }
193
-
194
- body.dark-mode .nav-item.active {
195
- background-color: rgba(59, 130, 246, 0.1) !important;
196
- color: #60a5fa !important;
197
- }
198
-
199
- body.dark-mode .nav-item:hover {
200
- background-color: rgba(59, 130, 246, 0.05) !important;
201
- }
202
-
203
- body.dark-mode a {
204
- color: #60a5fa;
205
- }
206
-
207
- body.dark-mode a:hover {
208
- color: #93bbfc;
209
- }
210
- </style>
211
-
212
-
213
-
214
-
215
- <!-- Favicon -->
216
- <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>✨</text></svg>">
217
-
218
- <script type="application/ld+json">
219
- {
220
- "@context": "https://schema.org",
221
- "@type": "TechArticle",
222
- "headline": "Complete Supabase Authentication Guide",
223
- "description": "A comprehensive guide to implementing enterprise-grade authentication in @knowcode/doc-builder using Supabase.",
224
- "author": {
225
- "@type": "Person",
226
- "name": "Lindsay Smith"
227
- },
228
- "publisher": {
229
- "@type": "Organization",
230
- "name": "Knowcode Ltd",
231
- "url": "https://knowcode.tech"
232
- },
233
- "datePublished": "2025-08-12T21:40:09.533Z",
234
- "dateModified": "2025-08-12T21:40:09.533Z",
235
- "mainEntityOfPage": {
236
- "@type": "WebPage",
237
- "@id": "https://doc-builder-delta.vercel.app/guides/supabase-authentication-complete-guide.html"
238
- },
239
- "breadcrumb": {
240
- "@type": "BreadcrumbList",
241
- "itemListElement": [
242
- {
243
- "@type": "ListItem",
244
- "position": 1,
245
- "name": "@knowcode/doc-builder",
246
- "item": "https://doc-builder-delta.vercel.app"
247
- },
248
- {
249
- "@type": "ListItem",
250
- "position": 2,
251
- "name": "Guides",
252
- "item": "https://doc-builder-delta.vercel.app/guides/"
253
- },
254
- {
255
- "@type": "ListItem",
256
- "position": 3,
257
- "name": "Supabase Authentication Complete Guide",
258
- "item": "https://doc-builder-delta.vercel.app/guides/supabase-authentication-complete-guide.html"
259
- }
260
- ]
261
- }
262
- }
263
- </script>
264
- </head>
265
- <body>
266
-
267
-
268
-
269
-
270
- <!-- Breadcrumbs -->
271
- <nav class="breadcrumbs breadcrumbs-static" id="breadcrumbs" data-build-date="Aug 12, 2025, 09:40 PM UTC" data-doc-builder-version="1.9.29">
272
-
273
- <!-- Pre-rendered breadcrumb content for static builds -->
274
- <div class="breadcrumbs-content breadcrumbs-homepage">
275
- <div class="breadcrumbs-right">
276
- <span class="breadcrumb-date" title="Built with doc-builder v1.9.29">Last updated: Aug 12, 2025, 09:40 PM UTC</span>
277
- <button class="breadcrumb-pdf-btn" onclick="if(typeof exportToPDF !== 'undefined') exportToPDF(); else window.print();" title="Export to PDF" aria-label="Export to PDF">
278
- <i class="fas fa-file-pdf"></i>
279
- </button>
280
- </div>
281
- </div>
282
-
283
- </nav>
284
-
285
- <!-- Main Content -->
286
- <div class="main-wrapper">
287
- <!-- Sidebar -->
288
- <aside class="sidebar">
289
- <div class="sidebar-header">
290
- <div class="filter-box">
291
- <input type="text" placeholder="Search menu..." class="filter-input" id="nav-filter">
292
- <i class="fas fa-search filter-icon"></i>
293
- </div>
294
- </div>
295
- <nav class="navigation">
296
-
297
- <div class="nav-section" data-level="0">
298
- <a class="nav-title toggle-all-nav expanded" href="#" id="nav-toggle-all" title="Collapse/Expand All">
299
- <i class="ph ph-caret-down" id="toggle-all-icon"></i> Documentation
300
- </a>
301
- <div class="nav-content">
302
- <a href="README.html" class="nav-item" data-tooltip="@knowcode/doc-builder."><i class="ph ph-file-text"></i> Overview</a>
303
- <a href="about-doc-builder.html" class="nav-item" data-tooltip="About @knowcode/doc-builder."><i class="ph ph-check-circle" style="color: #2563eb;"></i> About Doc Builder</a>
304
- <a href="documentation-index.html" class="nav-item" data-tooltip="This directory contains additional documentation for the @knowcode/doc-builder project, organized by topic and purpose."><i class="ph ph-pencil-simple" style="color: #d97706;"></i> Documentation Index</a>
305
- <a href="image-modal-test.html" class="nav-item" data-tooltip="This document tests the new image modal functionality in doc-builder."><i class="ph ph-file-text"></i> Image Modal Test</a>
306
- <a href="vercel-cli-setup-guide.html" class="nav-item" data-tooltip="This guide provides comprehensive instructions for installing the Vercel CLI across different operating systems."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Vercel Cli Setup Guide</a>
307
- <a href="vercel-first-time-setup-guide.html" class="nav-item" data-tooltip="This guide walks you through the Vercel deployment process when using ."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Vercel First Time Setup Guide</a></div></div>
308
- <div class="nav-section" data-level="1">
309
- <a class="nav-title collapsible expanded" href="#" data-target="nav-guides-1" >
310
- <i class="ph ph-caret-right collapse-icon"></i><i class="ph ph-book"></i> Guides
311
- </a>
312
- <div class="nav-content" id="nav-guides-1">
313
- <a href="guides/authentication-default-change.html" class="nav-item" data-tooltip="Starting from version 1.7.4, @knowcode/doc-builder now defaults to no authentication for all documentation sites."><i class="ph ph-file-text"></i> Authentication Default Change</a>
314
- <a href="guides/authentication-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder supports enterprise-grade authentication through Supabase - a secure, scalable authentication platform."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Authentication Guide</a>
315
- <a href="guides/claude-workflow-guide.html" class="nav-item" data-tooltip="This guide demonstrates an efficient workflow for using Claude Code with a refined CLAUDE.md file to create high-quality documentation and deploy it..."><i class="ph ph-pencil-simple" style="color: #d97706;"></i> Claude Workflow Guide</a>
316
- <a href="guides/configuration-guide.html" class="nav-item" data-tooltip="This guide explains how @knowcode/doc-builder handles configuration files and settings."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Configuration Guide</a>
317
- <a href="guides/documentation-standards.html" class="nav-item" data-tooltip="This document defines the documentation standards and conventions for the @knowcode/doc-builder project."><i class="ph ph-pencil-simple" style="color: #d97706;"></i> Documentation Standards</a>
318
- <a href="guides/html-embedding-guide.html" class="nav-item" data-tooltip="Starting from version 1.9.2, doc-builder treats HTML files ( and ) as attachments that are automatically copied to your output directory during the..."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Html Embedding Guide</a>
319
- <a href="guides/image-modal-guide.html" class="nav-item" data-tooltip="When users click on any image in your generated documentation, it opens in a professional modal overlay with: Full-screen viewing experience Smooth..."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Image Modal Guide</a>
320
- <a href="guides/phosphor-icons-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder automatically converts Unicode emojis in your markdown files to beautiful Phosphor icons in the generated HTML."><i class="ph ph-pencil-simple" style="color: #d97706;"></i> Phosphor Icons Guide</a>
321
- <a href="guides/private-directory-authentication.html" class="nav-item" data-tooltip="The @knowcode/doc-builder provides flexible authentication options to protect your documentation."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Private Directory Authentication</a>
322
- <a href="guides/private-directory-authentication-troubleshooting.html" class="nav-item" data-tooltip="Private Directory Authentication Troubleshooting."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Private Directory Authentication Troubleshooting</a>
323
- <a href="guides/public-site-deployment.html" class="nav-item" data-tooltip="The @knowcode/doc-builder now supports deploying public documentation sites without authentication."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Public Site Deployment</a>
324
- <a href="guides/search-engine-verification-guide.html" class="nav-item" data-tooltip="Search engine verification provides access to powerful webmaster tools:."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Search Engine Verification Guide</a>
325
- <a href="guides/seo-guide.html" class="nav-item" data-tooltip="@knowcode/doc-builder includes comprehensive SEO (Search Engine Optimization) features to help your documentation rank better in search results and..."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Seo Guide</a>
326
- <a href="guides/seo-optimization-guide.html" class="nav-item" data-tooltip="Comprehensive guide to optimizing documentation for search engines. Learn SEO best practices, use built-in features, and improve your rankings."><i class="ph ph-check-circle" style="color: #2563eb;"></i> SEO Optimization Guide for @knowcode/doc-builder</a>
327
- <a href="guides/supabase-authentication-complete-guide.html" class="nav-item active" data-tooltip="@knowcode/doc-builder includes built-in Supabase authentication that provides enterprise-grade security with zero configuration."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Supabase Authentication Complete Guide</a>
328
- <a href="guides/troubleshooting-guide.html" class="nav-item" data-tooltip="This guide helps you resolve common issues when using @knowcode/doc-builder."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Troubleshooting Guide</a>
329
- <a href="guides/windows-setup-guide.html" class="nav-item" data-tooltip="This guide helps Windows users set up the complete AI-powered documentation workflow using Claude Code, @knowcode/doc-builder, and Vercel."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Windows Setup Guide</a></div></div>
330
- <div class="nav-section" data-level="1">
331
- <a class="nav-title collapsible" href="#" data-target="nav-prompts-1" >
332
- <i class="ph ph-caret-right collapse-icon"></i><i class="ph ph-chat-circle-dots"></i> Prompts
333
- </a>
334
- <div class="nav-content collapsed" id="nav-prompts-1">
335
- <a href="prompts/beautiful-documentation-design.html" class="nav-item" data-tooltip="🎨 Beautiful Documentation Design Guide."><i class="ph ph-check-circle" style="color: #2563eb;"></i> Beautiful Documentation Design</a>
336
- <a href="prompts/markdown-document-standards.html" class="nav-item" data-tooltip="Detailed introduction to the topic..."><i class="ph ph-pencil-simple" style="color: #d97706;"></i> Markdown Document Standards</a>
337
- <a href="prompts/project-rename-strategy-sasha-publish.html" class="nav-item" data-tooltip="This document outlines the comprehensive strategy for renaming the @knowcode/doc-builder project to &quot;sasha-publish&quot;, including all package references,..."><i class="ph ph-x-circle" style="color: #dc2626;"></i> Project Rename Strategy Sasha Publish</a></div></div>
338
- <div class="nav-section" data-level="1">
339
- <a class="nav-title collapsible" href="#" data-target="nav-test-questions-1" >
340
- <i class="ph ph-caret-right collapse-icon"></i><i class="ph ph-folder"></i> Test Questions
341
- </a>
342
- <div class="nav-content collapsed" id="nav-test-questions-1">
343
- <a href="test-questions/how-does-it-work%3F.html" class="nav-item" data-tooltip="This is a test file to verify that question marks work properly in filenames."><i class="ph ph-file-text"></i> How Does It Work?</a>
344
- <a href="test-questions/step-1%3A%20getting-started.html" class="nav-item" data-tooltip="Step 1: Getting Started."><i class="ph ph-file-text"></i> Step 1: Getting Started</a>
345
- <a href="test-questions/what-is-the-purpose.html" class="nav-item" data-tooltip="Understanding the purpose of our documentation system"><i class="ph ph-file-text"></i> What Is The Purpose?</a></div></div>
346
- </nav>
347
- <div class="resize-handle"></div>
348
- </aside>
349
-
350
- <!-- Content Area -->
351
- <main class="content">
352
- <div class="content-inner">
353
- <h1>Complete Supabase Authentication Guide</h1>
354
- <p>A comprehensive guide to implementing enterprise-grade authentication in @knowcode/doc-builder using Supabase.</p>
355
- <h2>Table of Contents</h2>
356
- <ul>
357
- <li><a href="#overview">Overview</a></li>
358
- <li><a href="#how-it-works">How It Works</a></li>
359
- <li><a href="#authentication-modes">Authentication Modes</a></li>
360
- <li><a href="#quick-setup">Quick Setup</a></li>
361
- <li><a href="#database-setup">Database Setup</a></li>
362
- <li><a href="#user-management">User Management</a></li>
363
- <li><a href="#security-features">Security Features</a></li>
364
- <li><a href="#configuration-options">Configuration Options</a></li>
365
- <li><a href="#troubleshooting">Troubleshooting</a></li>
366
- <li><a href="#advanced-topics">Advanced Topics</a></li>
367
- </ul>
368
- <h2>Overview</h2>
369
- <p>@knowcode/doc-builder includes built-in <strong>Supabase authentication</strong> that provides enterprise-grade security with zero configuration. The system uses JWT tokens, domain-based access control, and automatic session management to protect your documentation.</p>
370
- <h3>Why Supabase?</h3>
371
- <table>
372
- <thead>
373
- <tr>
374
- <th>Feature</th>
375
- <th>Benefit</th>
376
- </tr>
377
- </thead>
378
- <tbody><tr>
379
- <td><i style="font-size: 1.2em" class="ph ph-lock-key" aria-label="secure"></i> <strong>Enterprise Security</strong></td>
380
- <td>JWT tokens, bcrypt password hashing, Row Level Security</td>
381
- </tr>
382
- <tr>
383
- <td><i style="font-size: 1.2em" class="ph ph-users" aria-label="team"></i> <strong>Scalable User Management</strong></td>
384
- <td>Handles millions of users with fine-grained access control</td>
385
- </tr>
386
- <tr>
387
- <td><i style="font-size: 1.2em" class="ph ph-globe-hemisphere-west" aria-label="world"></i> <strong>Global Infrastructure</strong></td>
388
- <td>Built on PostgreSQL with worldwide edge locations</td>
389
- </tr>
390
- <tr>
391
- <td><i style="font-size: 1.2em" class="ph ph-money" aria-label="money"></i> <strong>Generous Free Tier</strong></td>
392
- <td>50,000 monthly active users at no cost</td>
393
- </tr>
394
- <tr>
395
- <td><i style="font-size: 1.2em" class="ph ph-arrows-clockwise" aria-label="refresh"></i> <strong>Real-time Updates</strong></td>
396
- <td>Live permission changes without restarts</td>
397
- </tr>
398
- <tr>
399
- <td><i style="font-size: 1.2em" class="ph ph-shield" aria-label="security"></i> <strong>Built-in Security</strong></td>
400
- <td>Multi-factor auth, OAuth providers, audit logs</td>
401
- </tr>
402
- </tbody></table>
403
- <h2>How It Works</h2>
404
- <p>The authentication system follows this flow:</p>
405
- <div class="mermaid-wrapper">
406
- <div class="mermaid">graph TD
407
- A[User visits documentation page] --> B{Has valid JWT token?}
408
- B -->|No| C[Redirect to login page]
409
- B -->|Yes| D[Verify token with Supabase]
410
-
411
- C --> E[User enters credentials]
412
- E --> F[Authenticate with Supabase]
413
- F --> G{Valid credentials?}
414
- G -->|No| H[Show error message]
415
- G -->|Yes| I[Issue JWT token]
416
-
417
- I --> J[Check domain access in database]
418
- D --> J
419
-
420
- J --> K{User has access to domain?}
421
- K -->|Yes| L[Show protected content]
422
- K -->|No| M[Show access denied page]
423
-
424
- style A fill:#e1f5fe
425
- style L fill:#c8e6c9
426
- style M fill:#ffcdd2
427
- style H fill:#ffcdd2</div>
428
- </div>
429
- <h3>Technical Architecture</h3>
430
- <ol>
431
- <li><strong>Client-Side Check</strong>: JavaScript checks for valid JWT token on page load</li>
432
- <li><strong>Supabase Verification</strong>: Token verified against Supabase auth service</li>
433
- <li><strong>Domain-Based Access</strong>: User access checked against <code>docbuilder_access</code> table</li>
434
- <li><strong>Content Display</strong>: Protected content shown only to authorized users</li>
435
- <li><strong>Session Management</strong>: Automatic token refresh and session persistence</li>
436
- </ol>
437
- <h2>Authentication Modes</h2>
438
- <p>@knowcode/doc-builder supports three authentication modes:</p>
439
- <h3>1. <i style="font-size: 1.2em" class="ph ph-globe-hemisphere-west" aria-label="world"></i> Global Authentication</h3>
440
- <p><strong>When to use</strong>: Entire documentation site requires login</p>
441
- <pre><code class="language-javascript">// doc-builder.config.js
442
- module.exports = {
443
- features: {
444
- authentication: &#39;supabase&#39; // Entire site protected
445
- }
446
- };
447
- </code></pre>
448
- <p><strong>Behavior</strong>:</p>
449
- <ul>
450
- <li>All pages require authentication</li>
451
- <li>Redirects to login if not authenticated</li>
452
- <li>Shows access denied if user lacks domain access</li>
453
- </ul>
454
- <h3>2. <i style="font-size: 1.2em" class="ph ph-folder" aria-label="folder"></i> Private Directory Authentication</h3>
455
- <p><strong>When to use</strong>: Public docs with some private sections (most common)</p>
456
- <pre><code class="language-bash"># Create private directory - authentication automatically enabled
457
- mkdir docs/private
458
- echo &quot;# Admin Documentation&quot; &gt; docs/private/admin-guide.md
459
- </code></pre>
460
- <p><strong>Behavior</strong>:</p>
461
- <ul>
462
- <li>Public pages accessible to everyone</li>
463
- <li><code>/private/</code> folders require authentication</li>
464
- <li>Seamless navigation between public and private content</li>
465
- </ul>
466
- <h3>3. <i style="font-size: 1.2em" class="ph ph-arrows-clockwise" aria-label="refresh"></i> Hybrid Mode</h3>
467
- <p><strong>When to use</strong>: Complex access requirements</p>
468
- <pre><code class="language-javascript">// doc-builder.config.js
469
- module.exports = {
470
- features: {
471
- authentication: &#39;supabase&#39;, // Global auth enabled
472
- privateDirectoryAuth: true // Also check private directories
473
- }
474
- };
475
- </code></pre>
476
- <p><strong>Behavior</strong>:</p>
477
- <ul>
478
- <li>Combines global and directory-based authentication</li>
479
- <li>Granular control over different sections</li>
480
- <li>Advanced user permission management</li>
481
- </ul>
482
- <h2>Quick Setup</h2>
483
- <h3>Option 1: Zero Configuration (Recommended)</h3>
484
- <p>The easiest way to get started - built-in credentials included:</p>
485
- <pre><code class="language-bash"># 1. Create private content
486
- mkdir docs/private
487
- echo &quot;# Secret Documentation&quot; &gt; docs/private/admin.md
488
-
489
- # 2. Deploy with authentication automatically enabled
490
- npx @knowcode/doc-builder deploy
491
-
492
- # 3. Add users in Supabase dashboard
493
- # Visit your deployed site - authentication is ready!
494
- </code></pre>
495
- <h3>Option 2: Custom Configuration</h3>
496
- <p>For advanced users who want to use their own Supabase project:</p>
497
- <pre><code class="language-javascript">// doc-builder.config.js
498
- module.exports = {
499
- siteName: &#39;My Secure Docs&#39;,
500
-
501
- features: {
502
- authentication: &#39;supabase&#39;
503
- },
504
-
505
- auth: {
506
- supabaseUrl: process.env.SUPABASE_URL || &#39;https://your-project.supabase.co&#39;,
507
- supabaseAnonKey: process.env.SUPABASE_ANON_KEY || &#39;your-anon-key&#39;
508
- }
509
- };
510
- </code></pre>
511
- <h2>Database Setup</h2>
512
- <h3>Automatic Setup (Built-in Project)</h3>
513
- <p>If you&#39;re using the built-in Supabase project (recommended), the database is already configured. Skip to <a href="#user-management">User Management</a>.</p>
514
- <h3>Manual Setup (Custom Project)</h3>
515
- <p>If using your own Supabase project, run this SQL in the Supabase SQL editor:</p>
516
- <pre><code class="language-sql">-- Create access control table
517
- CREATE TABLE docbuilder_access (
518
- user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,
519
- domain TEXT NOT NULL,
520
- created_at TIMESTAMPTZ DEFAULT NOW(),
521
- updated_at TIMESTAMPTZ DEFAULT NOW(),
522
- PRIMARY KEY (user_id, domain)
523
- );
524
-
525
- -- Create indexes for performance
526
- CREATE INDEX idx_docbuilder_access_domain ON docbuilder_access(domain);
527
- CREATE INDEX idx_docbuilder_access_user_id ON docbuilder_access(user_id);
528
-
529
- -- Enable Row Level Security
530
- ALTER TABLE docbuilder_access ENABLE ROW LEVEL SECURITY;
531
-
532
- -- RLS Policy: Users can only see their own access records
533
- CREATE POLICY &quot;Users see own access&quot; ON docbuilder_access
534
- FOR SELECT USING (user_id = auth.uid());
535
-
536
- -- RLS Policy: Service role can manage all access
537
- CREATE POLICY &quot;Service role manages access&quot; ON docbuilder_access
538
- FOR ALL USING (current_setting(&#39;role&#39;) = &#39;service_role&#39;);
539
-
540
- -- Create trigger to update timestamp
541
- CREATE OR REPLACE FUNCTION update_updated_at_column()
542
- RETURNS TRIGGER AS $
543
- BEGIN
544
- NEW.updated_at = NOW();
545
- RETURN NEW;
546
- END;
547
- $ language &#39;plpgsql&#39;;
548
-
549
- CREATE TRIGGER update_docbuilder_access_updated_at
550
- BEFORE UPDATE ON docbuilder_access
551
- FOR EACH ROW EXECUTE FUNCTION update_updated_at_column();
552
- </code></pre>
553
- <h3>Database Schema</h3>
554
- <p>The authentication system uses a simple schema:</p>
555
- <pre><code class="language-sql">-- Table: docbuilder_access
556
- -- Purpose: Controls which users can access which documentation domains
557
-
558
- Column Type Description
559
- ----------- ----------- ----------------------------------
560
- user_id UUID Reference to auth.users(id)
561
- domain TEXT Domain name (e.g., docs.example.com)
562
- created_at TIMESTAMPTZ When access was granted
563
- updated_at TIMESTAMPTZ Last modified timestamp
564
- </code></pre>
565
- <h2>User Management</h2>
566
- <h3>Creating Users</h3>
567
- <p><strong>Option 1: Supabase Dashboard</strong></p>
568
- <ol>
569
- <li>Visit your Supabase project dashboard</li>
570
- <li>Go to Authentication → Users</li>
571
- <li>Click &quot;Invite user&quot;</li>
572
- <li>Enter email address</li>
573
- <li>User receives signup email</li>
574
- </ol>
575
- <p><strong>Option 2: User Self-Registration</strong><br>Users can sign up at your login page if enabled in Supabase settings.</p>
576
- <h3>Granting Access</h3>
577
- <p>Grant a user access to your documentation domain:</p>
578
- <pre><code class="language-sql">-- Grant access to a single user
579
- INSERT INTO docbuilder_access (user_id, domain)
580
- VALUES (
581
- (SELECT id FROM auth.users WHERE email = &#39;user@example.com&#39;),
582
- &#39;docs.example.com&#39;
583
- );
584
-
585
- -- Grant access to multiple users
586
- INSERT INTO docbuilder_access (user_id, domain)
587
- SELECT id, &#39;docs.example.com&#39;
588
- FROM auth.users
589
- WHERE email IN (
590
- &#39;admin@example.com&#39;,
591
- &#39;developer@example.com&#39;,
592
- &#39;manager@example.com&#39;
593
- );
594
-
595
- -- Grant access to all existing users (be careful!)
596
- INSERT INTO docbuilder_access (user_id, domain)
597
- SELECT id, &#39;docs.example.com&#39; FROM auth.users;
598
- </code></pre>
599
- <h3>Revoking Access</h3>
600
- <p>Remove a user&#39;s access to your documentation:</p>
601
- <pre><code class="language-sql">-- Remove specific user access
602
- DELETE FROM docbuilder_access
603
- WHERE user_id = (SELECT id FROM auth.users WHERE email = &#39;user@example.com&#39;)
604
- AND domain = &#39;docs.example.com&#39;;
605
-
606
- -- Remove all access for a domain (nuclear option)
607
- DELETE FROM docbuilder_access WHERE domain = &#39;docs.example.com&#39;;
608
- </code></pre>
609
- <h3>Bulk User Management</h3>
610
- <p><strong>Add users from CSV:</strong></p>
611
- <pre><code class="language-sql">-- Create temporary table
612
- CREATE TEMP TABLE user_emails (email TEXT);
613
-
614
- -- Insert emails (replace with your list)
615
- INSERT INTO user_emails VALUES
616
- (&#39;user1@example.com&#39;),
617
- (&#39;user2@example.com&#39;),
618
- (&#39;user3@example.com&#39;);
619
-
620
- -- Grant access to all
621
- INSERT INTO docbuilder_access (user_id, domain)
622
- SELECT u.id, &#39;docs.example.com&#39;
623
- FROM auth.users u
624
- JOIN user_emails e ON u.email = e.email;
625
- </code></pre>
626
- <p><strong>View all users with access:</strong></p>
627
- <pre><code class="language-sql">SELECT
628
- u.email,
629
- u.created_at as user_created,
630
- da.created_at as access_granted,
631
- da.domain
632
- FROM auth.users u
633
- JOIN docbuilder_access da ON u.id = da.user_id
634
- WHERE da.domain = &#39;docs.example.com&#39;
635
- ORDER BY da.created_at DESC;
636
- </code></pre>
637
- <h2>Security Features</h2>
638
- <h3>What&#39;s Included</h3>
639
- <table>
640
- <thead>
641
- <tr>
642
- <th>Security Feature</th>
643
- <th>Implementation</th>
644
- <th>Benefit</th>
645
- </tr>
646
- </thead>
647
- <tbody><tr>
648
- <td><strong>JWT Authentication</strong></td>
649
- <td>Industry-standard tokens</td>
650
- <td>Stateless, secure authentication</td>
651
- </tr>
652
- <tr>
653
- <td><strong>Password Hashing</strong></td>
654
- <td>bcrypt with salt</td>
655
- <td>Passwords never stored in plaintext</td>
656
- </tr>
657
- <tr>
658
- <td><strong>Row Level Security</strong></td>
659
- <td>PostgreSQL RLS policies</td>
660
- <td>Database-level access control</td>
661
- </tr>
662
- <tr>
663
- <td><strong>Session Management</strong></td>
664
- <td>Automatic token refresh</td>
665
- <td>Seamless user experience</td>
666
- </tr>
667
- <tr>
668
- <td><strong>HTTPS Only</strong></td>
669
- <td>Enforced in production</td>
670
- <td>Encrypted data transmission</td>
671
- </tr>
672
- <tr>
673
- <td><strong>Domain Validation</strong></td>
674
- <td>Runtime domain checking</td>
675
- <td>Prevents unauthorized access</td>
676
- </tr>
677
- <tr>
678
- <td><strong>Content Protection</strong></td>
679
- <td>Client-side verification</td>
680
- <td>No content served to unauthorized users</td>
681
- </tr>
682
- </tbody></table>
683
- <h3>Security Best Practices</h3>
684
- <ol>
685
- <li><p><strong>Use Environment Variables</strong> (for custom projects):</p>
686
- <pre><code class="language-bash"># .env.local
687
- SUPABASE_URL=https://your-project.supabase.co
688
- SUPABASE_ANON_KEY=your-anon-key
689
- </code></pre>
690
- </li>
691
- <li><p><strong>Regular Access Audits</strong>:</p>
692
- <pre><code class="language-sql">-- Review user access monthly
693
- SELECT u.email, da.domain, da.created_at
694
- FROM auth.users u
695
- JOIN docbuilder_access da ON u.id = da.user_id
696
- ORDER BY da.created_at DESC;
697
- </code></pre>
698
- </li>
699
- <li><p><strong>Monitor Authentication Logs</strong>:</p>
700
- <ul>
701
- <li>Check Supabase dashboard for login attempts</li>
702
- <li>Review failed authentication events</li>
703
- <li>Set up alerts for suspicious activity</li>
704
- </ul>
705
- </li>
706
- <li><p><strong>Custom Domain Setup</strong>:</p>
707
- <pre><code class="language-bash"># Use professional domains for better security
708
- https://docs.yourcompany.com # Good
709
- https://random-string.vercel.app # Less secure
710
- </code></pre>
711
- </li>
712
- </ol>
713
- <h2>Configuration Options</h2>
714
- <h3>Basic Configuration</h3>
715
- <pre><code class="language-javascript">// doc-builder.config.js - Minimal setup
716
- module.exports = {
717
- features: {
718
- authentication: &#39;supabase&#39; // Enable authentication
719
- }
720
- };
721
- </code></pre>
722
- <h3>Advanced Configuration</h3>
723
- <pre><code class="language-javascript">// doc-builder.config.js - Full configuration
724
- module.exports = {
725
- siteName: &#39;Secure Documentation&#39;,
726
- siteDescription: &#39;Private company documentation&#39;,
727
-
728
- features: {
729
- authentication: &#39;supabase&#39;, // Enable Supabase auth
730
- privateDirectoryAuth: true, // Also protect /private/ directories
731
- mermaid: true, // Enable diagrams
732
- tooltips: true, // Enable tooltips
733
- phosphorIcons: true // Use Phosphor icons
734
- },
735
-
736
- auth: {
737
- // Optional: Use custom Supabase project
738
- supabaseUrl: process.env.SUPABASE_URL,
739
- supabaseAnonKey: process.env.SUPABASE_ANON_KEY,
740
-
741
- // Optional: Custom login page settings
742
- loginPageTitle: &#39;Access Documentation&#39;,
743
- loginPageSubtitle: &#39;Enter your credentials to continue&#39;
744
- },
745
-
746
- // SEO settings work with authentication
747
- seo: {
748
- author: &#39;Your Company&#39;,
749
- keywords: [&#39;documentation&#39;, &#39;secure&#39;, &#39;private&#39;],
750
- ogImage: &#39;/images/og-secure.png&#39;
751
- }
752
- };
753
- </code></pre>
754
- <h3>Environment Variables</h3>
755
- <pre><code class="language-bash"># .env.local - For custom Supabase projects
756
- SUPABASE_URL=https://your-project.supabase.co
757
- SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCI...
758
-
759
- # Optional: Custom domain for authentication
760
- AUTH_DOMAIN=docs.yourcompany.com
761
- </code></pre>
762
- <h2>Troubleshooting</h2>
763
- <h3>Common Issues</h3>
764
- <h4><i style="font-size: 1.2em" class="ph ph-magnifying-glass" aria-label="search"></i> <strong>Users can&#39;t log in</strong></h4>
765
- <p><strong>Symptoms</strong>: Login form shows errors, authentication fails</p>
766
- <p><strong>Solutions</strong>:</p>
767
- <ol>
768
- <li>Check Supabase project is active and accessible</li>
769
- <li>Verify credentials in config file</li>
770
- <li>Ensure user exists in <code>auth.users</code> table</li>
771
- <li>Check user&#39;s email is confirmed (if confirmation required)</li>
772
- </ol>
773
- <pre><code class="language-sql">-- Check if user exists
774
- SELECT email, email_confirmed_at FROM auth.users WHERE email = &#39;user@example.com&#39;;
775
-
776
- -- Check user access
777
- SELECT * FROM docbuilder_access
778
- WHERE user_id = (SELECT id FROM auth.users WHERE email = &#39;user@example.com&#39;);
779
- </code></pre>
780
- <h4><i style="font-size: 1.2em" class="ph ph-arrows-clockwise" aria-label="refresh"></i> <strong>Content flashes before redirect</strong></h4>
781
- <p><strong>Symptoms</strong>: Protected content briefly visible before login redirect</p>
782
- <p><strong>Solutions</strong>:</p>
783
- <ol>
784
- <li>Update to latest version (<code>npm install @knowcode/doc-builder@latest</code>)</li>
785
- <li>Check network speed - slow connections may see flashing</li>
786
- <li>Verify authentication script is loading properly</li>
787
- </ol>
788
- <pre><code class="language-html">&lt;!-- This CSS is automatically included to prevent flashing --&gt;
789
- &lt;style&gt;
790
- body { visibility: hidden; opacity: 0; }
791
- body.authenticated { visibility: visible; opacity: 1; }
792
- &lt;/style&gt;
793
- </code></pre>
794
- <h4><i style="font-size: 1.2em" class="ph ph-x-circle" aria-label="error"></i> <strong>Access denied after login</strong></h4>
795
- <p><strong>Symptoms</strong>: User logs in successfully but sees &quot;Access Denied&quot; page</p>
796
- <p><strong>Solutions</strong>:</p>
797
- <ol>
798
- <li>Check user has entry in <code>docbuilder_access</code> table</li>
799
- <li>Verify domain matches exactly (including subdomains)</li>
800
- <li>Check RLS policies are correctly configured</li>
801
- </ol>
802
- <pre><code class="language-sql">-- Debug access check
803
- SELECT
804
- u.email,
805
- da.domain,
806
- &#39;Expected: &#39; || &#39;your-actual-domain.com&#39; as expected_domain
807
- FROM auth.users u
808
- LEFT JOIN docbuilder_access da ON u.id = da.user_id
809
- WHERE u.email = &#39;user@example.com&#39;;
810
- </code></pre>
811
- <h4><i style="font-size: 1.2em" class="ph ph-plug" aria-label="plugin"></i> <strong>Authentication not working locally</strong></h4>
812
- <p><strong>Symptoms</strong>: Authentication works on deployment but not locally</p>
813
- <p><strong>Solutions</strong>:</p>
814
- <ol>
815
- <li>Check localhost is included in Supabase allowed origins</li>
816
- <li>Use <code>http://localhost:3000</code> exactly in Supabase settings</li>
817
- <li>Clear browser cache and cookies</li>
818
- </ol>
819
- <h3>Debug Checklist</h3>
820
- <p>When authentication isn&#39;t working:</p>
821
- <ul>
822
- <li><input disabled="" type="checkbox"> Check browser console for JavaScript errors</li>
823
- <li><input disabled="" type="checkbox"> Verify JWT token in DevTools → Application → Local Storage</li>
824
- <li><input disabled="" type="checkbox"> Test Supabase connection in browser network tab</li>
825
- <li><input disabled="" type="checkbox"> Confirm domain in database matches deployment URL</li>
826
- <li><input disabled="" type="checkbox"> Check Supabase project is active and not paused</li>
827
- <li><input disabled="" type="checkbox"> Verify user email is confirmed (if required)</li>
828
- <li><input disabled="" type="checkbox"> Test with a fresh incognito browser window</li>
829
- </ul>
830
- <h3>Getting Help</h3>
831
- <ol>
832
- <li><strong>Check the logs</strong>: Browser console and Supabase dashboard</li>
833
- <li><strong>Test components</strong>: Try logging in directly to Supabase dashboard</li>
834
- <li><strong>Verify setup</strong>: Run through setup steps again</li>
835
- <li><strong>Ask for help</strong>: Open an issue on GitHub with full error details</li>
836
- </ol>
837
- <h2>Advanced Topics</h2>
838
- <h3>Custom Authentication Pages</h3>
839
- <p>While @knowcode/doc-builder generates beautiful login pages automatically, you can customize them:</p>
840
- <pre><code class="language-javascript">// doc-builder.config.js
841
- module.exports = {
842
- auth: {
843
- // Custom login page configuration
844
- loginPageTitle: &#39;Secure Access Required&#39;,
845
- loginPageSubtitle: &#39;Please authenticate to view our documentation&#39;,
846
-
847
- // Custom styling (advanced)
848
- customLoginCSS: `
849
- .auth-box {
850
- border-radius: 12px;
851
- box-shadow: 0 8px 32px rgba(0,0,0,0.1);
852
- }
853
- `
854
- }
855
- };
856
- </code></pre>
857
- <h3>Multi-Domain Setup</h3>
858
- <p>For organizations with multiple documentation sites:</p>
859
- <pre><code class="language-sql">-- Grant user access to multiple domains
860
- INSERT INTO docbuilder_access (user_id, domain) VALUES
861
- ((SELECT id FROM auth.users WHERE email = &#39;admin@example.com&#39;), &#39;docs.example.com&#39;),
862
- ((SELECT id FROM auth.users WHERE email = &#39;admin@example.com&#39;), &#39;api.example.com&#39;),
863
- ((SELECT id FROM auth.users WHERE email = &#39;admin@example.com&#39;), &#39;internal.example.com&#39;);
864
-
865
- -- View user&#39;s access across all domains
866
- SELECT u.email, array_agg(da.domain) as accessible_domains
867
- FROM auth.users u
868
- JOIN docbuilder_access da ON u.id = da.user_id
869
- GROUP BY u.id, u.email;
870
- </code></pre>
871
- <h3>OAuth Integration</h3>
872
- <p>Enable social login through Supabase (optional):</p>
873
- <ol>
874
- <li><p><strong>In Supabase Dashboard</strong>:</p>
875
- <ul>
876
- <li>Go to Authentication → Settings</li>
877
- <li>Enable desired providers (Google, GitHub, etc.)</li>
878
- <li>Configure OAuth credentials</li>
879
- </ul>
880
- </li>
881
- <li><p><strong>Update your config</strong>:</p>
882
- </li>
883
- </ol>
884
- <pre><code class="language-javascript">// doc-builder.config.js
885
- module.exports = {
886
- auth: {
887
- enableOAuth: true,
888
- oauthProviders: [&#39;google&#39;, &#39;github&#39;]
889
- }
890
- };
891
- </code></pre>
892
- <h3>Role-Based Access Control</h3>
893
- <p>Implement different permission levels:</p>
894
- <pre><code class="language-sql">-- Add role column to access table
895
- ALTER TABLE docbuilder_access ADD COLUMN role TEXT DEFAULT &#39;reader&#39;;
896
-
897
- -- Grant different roles
898
- INSERT INTO docbuilder_access (user_id, domain, role) VALUES
899
- ((SELECT id FROM auth.users WHERE email = &#39;admin@example.com&#39;), &#39;docs.example.com&#39;, &#39;admin&#39;),
900
- ((SELECT id FROM auth.users WHERE email = &#39;editor@example.com&#39;), &#39;docs.example.com&#39;, &#39;editor&#39;),
901
- ((SELECT id FROM auth.users WHERE email = &#39;reader@example.com&#39;), &#39;docs.example.com&#39;, &#39;reader&#39;);
902
- </code></pre>
903
- <h3>API Access Control</h3>
904
- <p>Protect API documentation or interactive content:</p>
905
- <pre><code class="language-javascript">// In your custom HTML pages
906
- &lt;script&gt;
907
- async function checkAuthForAPI() {
908
- const { data: { user } } = await supabaseClient.auth.getUser();
909
- if (!user) {
910
- // Redirect to login or show error
911
- return false;
912
- }
913
- return true;
914
- }
915
-
916
- // Use in interactive demos
917
- if (await checkAuthForAPI()) {
918
- // Show API explorer or interactive content
919
- }
920
- &lt;/script&gt;
921
- </code></pre>
922
- <h2>Conclusion</h2>
923
- <p>Supabase authentication in @knowcode/doc-builder provides enterprise-grade security with minimal setup. The system handles everything from user management to session persistence, letting you focus on creating great documentation.</p>
924
- <p><strong>Key takeaways</strong>:</p>
925
- <ul>
926
- <li><i style="font-size: 1.2em" class="ph ph-rocket-launch" aria-label="launch"></i> <strong>Zero configuration</strong> required with built-in credentials</li>
927
- <li><i style="font-size: 1.2em" class="ph ph-globe" aria-label="global"></i> <strong>Domain-based access</strong> control eliminates complex site registration</li>
928
- <li><i style="font-size: 1.2em" class="ph ph-folder" aria-label="folder"></i> <strong>Private directory</strong> support for hybrid public/private docs</li>
929
- <li><i style="font-size: 1.2em" class="ph ph-lock" aria-label="locked"></i> <strong>Enterprise security</strong> with JWT tokens and Row Level Security</li>
930
- <li><i style="font-size: 1.2em" class="ph ph-users" aria-label="team"></i> <strong>Scalable user management</strong> supporting unlimited users</li>
931
- </ul>
932
- <p>For most use cases, simply creating a <code>/private/</code> directory and running <code>npx @knowcode/doc-builder deploy</code> is all you need to secure your documentation.</p>
933
- <p>Need help? Check the <a href="#troubleshooting">troubleshooting section</a> or open an issue on GitHub.</p>
934
-
935
- </div>
936
- </main>
937
- </div>
938
-
939
- <!-- Scripts -->
940
- <script>
941
- // Pass configuration to frontend
942
- window.docBuilderConfig = {
943
- features: {
944
- showPdfDownload: true,
945
- menuDefaultOpen: false,
946
- mermaidEnhanced: true
947
- }
948
- };
949
- </script>
950
- <script src="../js/main.js"></script>
951
-
952
- </body>
953
- </html>