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