@knowcode/doc-builder 1.9.19 → 1.9.21

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 (87) hide show
  1. package/cli.js +15 -1
  2. package/doc-builder.config.js +4 -2
  3. package/doc-builder.config.js.backup.1754384764054 +124 -0
  4. package/doc-builder.config.js.backup.1754567425847 +124 -0
  5. package/html/README.html +12 -4
  6. package/html/about-doc-builder.html +12 -4
  7. package/html/documentation-index.html +12 -4
  8. package/html/guides/authentication-default-change.html +12 -4
  9. package/html/guides/authentication-guide.html +12 -4
  10. package/html/guides/claude-workflow-guide.html +12 -4
  11. package/html/guides/configuration-guide.html +12 -4
  12. package/html/guides/documentation-standards.html +12 -4
  13. package/html/guides/html-embedding-guide.html +12 -4
  14. package/html/guides/image-modal-guide.html +12 -4
  15. package/html/guides/phosphor-icons-guide.html +12 -4
  16. package/html/guides/private-directory-authentication-troubleshooting.html +12 -4
  17. package/html/guides/private-directory-authentication.html +12 -4
  18. package/html/guides/public-site-deployment.html +12 -4
  19. package/html/guides/search-engine-verification-guide.html +12 -4
  20. package/html/guides/seo-guide.html +12 -4
  21. package/html/guides/seo-optimization-guide.html +12 -4
  22. package/html/guides/supabase-authentication-complete-guide.html +12 -4
  23. package/html/guides/troubleshooting-guide.html +12 -4
  24. package/html/guides/windows-setup-guide.html +12 -4
  25. package/html/image-modal-test.html +12 -4
  26. package/html/index.html +12 -4
  27. package/html/private/cache-control-anti-pattern.html +12 -4
  28. package/html/private/launch/README.html +12 -4
  29. package/html/private/launch/auth-cleanup-summary.html +12 -4
  30. package/html/private/launch/bubble-plugin-specification.html +12 -4
  31. package/html/private/launch/go-to-market-strategy.html +12 -4
  32. package/html/private/launch/launch-announcements.html +12 -4
  33. package/html/private/launch/vercel-deployment-auth-setup.html +12 -4
  34. package/html/private/next-steps-walkthrough.html +12 -4
  35. package/html/private/supabase-auth-implementation-completed.html +12 -4
  36. package/html/private/supabase-auth-implementation-plan.html +12 -4
  37. package/html/private/supabase-auth-integration-plan.html +12 -4
  38. package/html/private/supabase-auth-setup-guide.html +12 -4
  39. package/html/private/test-private-doc.html +12 -4
  40. package/html/private/user-management-tooling.html +12 -4
  41. package/html/prompts/beautiful-documentation-design.html +12 -4
  42. package/html/prompts/markdown-document-standards.html +12 -4
  43. package/html/prompts/project-rename-strategy-sasha-publish.html +12 -4
  44. package/html/sitemap.xml +74 -56
  45. package/html/test-questions/how-does-it-work%3F.html +290 -0
  46. package/html/test-questions/step-1%3A%20getting-started.html +285 -0
  47. package/html/test-questions/what-is-the-purpose.html +289 -0
  48. package/html/vercel-cli-setup-guide.html +12 -4
  49. package/html/vercel-first-time-setup-guide.html +12 -4
  50. package/html-static/404.html +115 -0
  51. package/html-static/README.html +456 -0
  52. package/html-static/about-doc-builder.html +425 -0
  53. package/html-static/css/notion-style.css +2426 -0
  54. package/html-static/documentation-index.html +405 -0
  55. package/html-static/guides/authentication-default-change.html +304 -0
  56. package/html-static/guides/authentication-guide.html +443 -0
  57. package/html-static/guides/claude-workflow-guide.html +1008 -0
  58. package/html-static/guides/configuration-guide.html +406 -0
  59. package/html-static/guides/documentation-standards.html +628 -0
  60. package/html-static/guides/html-embedding-guide.html +395 -0
  61. package/html-static/guides/image-modal-guide.html +449 -0
  62. package/html-static/guides/phosphor-icons-guide.html +518 -0
  63. package/html-static/guides/private-directory-authentication-troubleshooting.html +489 -0
  64. package/html-static/guides/private-directory-authentication.html +475 -0
  65. package/html-static/guides/public-site-deployment.html +365 -0
  66. package/html-static/guides/search-engine-verification-guide.html +476 -0
  67. package/html-static/guides/seo-guide.html +595 -0
  68. package/html-static/guides/seo-optimization-guide.html +821 -0
  69. package/html-static/guides/supabase-authentication-complete-guide.html +800 -0
  70. package/html-static/guides/troubleshooting-guide.html +567 -0
  71. package/html-static/guides/windows-setup-guide.html +793 -0
  72. package/html-static/image-modal-test.html +252 -0
  73. package/html-static/index.html +456 -0
  74. package/html-static/js/main.js +1692 -0
  75. package/html-static/prompts/beautiful-documentation-design.html +718 -0
  76. package/html-static/prompts/markdown-document-standards.html +356 -0
  77. package/html-static/prompts/project-rename-strategy-sasha-publish.html +464 -0
  78. package/html-static/robots.txt +5 -0
  79. package/html-static/sitemap.xml +189 -0
  80. package/html-static/test-questions/how-does-it-work%3F.html +228 -0
  81. package/html-static/test-questions/step-1%3A%20getting-started.html +223 -0
  82. package/html-static/test-questions/what-is-the-purpose.html +227 -0
  83. package/html-static/vercel-cli-setup-guide.html +429 -0
  84. package/html-static/vercel-first-time-setup-guide.html +388 -0
  85. package/lib/config.js +9 -2
  86. package/lib/core-builder.js +167 -6
  87. package/package.json +1 -1
@@ -0,0 +1,475 @@
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="The @knowcode/doc-builder provides flexible authentication options to protect your documentation. You can either protect specific documents using a `private`...">
7
+ <title>Private Directory 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, private, authentication">
12
+ <meta name="robots" content="index, follow">
13
+ <link rel="canonical" href="https://doc-builder-delta.vercel.app/guides/private-directory-authentication.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/private-directory-authentication.html">
18
+ <meta property="og:title" content="Private Directory Authentication Guide">
19
+ <meta property="og:description" content="The @knowcode/doc-builder provides flexible authentication options to protect your documentation. You can either protect specific documents using a `private`...">
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="Private Directory Authentication Guide">
29
+ <meta name="twitter:description" content="The @knowcode/doc-builder provides flexible authentication options to protect your documentation. You can either protect specific documents using a `private`...">
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
+ <!-- Favicon -->
52
+ <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>">
53
+
54
+ <script type="application/ld+json">
55
+ {
56
+ "@context": "https://schema.org",
57
+ "@type": "TechArticle",
58
+ "headline": "Private Directory Authentication Guide",
59
+ "description": "The @knowcode/doc-builder provides flexible authentication options to protect your documentation. You can either protect specific documents using a `private`...",
60
+ "author": {
61
+ "@type": "Person",
62
+ "name": "Lindsay Smith"
63
+ },
64
+ "publisher": {
65
+ "@type": "Organization",
66
+ "name": "Knowcode Ltd",
67
+ "url": "https://knowcode.tech"
68
+ },
69
+ "datePublished": "2025-08-07T11:50:26.080Z",
70
+ "dateModified": "2025-08-07T11:50:26.080Z",
71
+ "mainEntityOfPage": {
72
+ "@type": "WebPage",
73
+ "@id": "https://doc-builder-delta.vercel.app/guides/private-directory-authentication.html"
74
+ },
75
+ "breadcrumb": {
76
+ "@type": "BreadcrumbList",
77
+ "itemListElement": [
78
+ {
79
+ "@type": "ListItem",
80
+ "position": 1,
81
+ "name": "@knowcode/doc-builder",
82
+ "item": "https://doc-builder-delta.vercel.app"
83
+ },
84
+ {
85
+ "@type": "ListItem",
86
+ "position": 2,
87
+ "name": "Guides",
88
+ "item": "https://doc-builder-delta.vercel.app/guides/"
89
+ },
90
+ {
91
+ "@type": "ListItem",
92
+ "position": 3,
93
+ "name": "Private Directory Authentication",
94
+ "item": "https://doc-builder-delta.vercel.app/guides/private-directory-authentication.html"
95
+ }
96
+ ]
97
+ }
98
+ }
99
+ </script>
100
+ </head>
101
+ <body>
102
+ <!-- Header -->
103
+ <header class="header">
104
+ <div class="header-content">
105
+ <a href="/index.html" class="logo">@knowcode/doc-builder</a>
106
+
107
+ <div class="header-actions">
108
+ <div class="deployment-info">
109
+ <span class="deployment-date" title="Built with doc-builder v1.9.20">Last updated: Aug 7, 2025, 11:50 AM UTC</span>
110
+ </div>
111
+
112
+
113
+
114
+ <button id="theme-toggle" class="theme-toggle" aria-label="Toggle theme">
115
+ <i class="fas fa-moon"></i>
116
+ </button>
117
+
118
+ <button id="menu-toggle" class="menu-toggle" aria-label="Toggle menu">
119
+ <i class="fas fa-bars"></i>
120
+ </button>
121
+ </div>
122
+ </div>
123
+ </header>
124
+
125
+
126
+
127
+ <!-- Breadcrumbs -->
128
+ <nav class="breadcrumbs" id="breadcrumbs">
129
+ <!-- Breadcrumbs will be generated by JavaScript -->
130
+ </nav>
131
+
132
+ <!-- Main Content -->
133
+ <div class="main-wrapper">
134
+ <!-- Sidebar -->
135
+ <aside class="sidebar">
136
+ <div class="sidebar-header">
137
+ <div class="filter-box">
138
+ <input type="text" placeholder="Search menu..." class="filter-input" id="nav-filter">
139
+ <i class="fas fa-search filter-icon"></i>
140
+ </div>
141
+ </div>
142
+ <nav class="navigation">
143
+
144
+ <div class="nav-section" data-level="0">
145
+ <a class="nav-title toggle-all-nav expanded" href="#" id="nav-toggle-all" title="Collapse/Expand All">
146
+ <i class="ph ph-caret-down" id="toggle-all-icon"></i> Documentation
147
+ </a>
148
+ <div class="nav-content">
149
+ <a href="/README.html" class="nav-item" data-tooltip="@knowcode/doc-builder."><i class="ph ph-file-text"></i> Overview</a>
150
+ <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>
151
+ <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>
152
+ <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>
153
+ <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>
154
+ <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>
155
+ <div class="nav-section" data-level="1">
156
+ <a class="nav-title collapsible expanded" href="#" data-target="nav-guides-1" >
157
+ <i class="ph ph-caret-right collapse-icon"></i><i class="ph ph-book"></i> Guides
158
+ </a>
159
+ <div class="nav-content" id="nav-guides-1">
160
+ <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>
161
+ <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>
162
+ <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>
163
+ <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>
164
+ <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>
165
+ <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>
166
+ <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>
167
+ <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>
168
+ <a href="/guides/private-directory-authentication.html" class="nav-item active" 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>
169
+ <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>
170
+ <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>
171
+ <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>
172
+ <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>
173
+ <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>
174
+ <a href="/guides/supabase-authentication-complete-guide.html" class="nav-item" 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>
175
+ <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>
176
+ <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>
177
+ <div class="nav-section" data-level="1">
178
+ <a class="nav-title collapsible" href="#" data-target="nav-prompts-1" >
179
+ <i class="ph ph-caret-right collapse-icon"></i><i class="ph ph-chat-circle-dots"></i> Prompts
180
+ </a>
181
+ <div class="nav-content collapsed" id="nav-prompts-1">
182
+ <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>
183
+ <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>
184
+ <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>
185
+ <div class="nav-section" data-level="1">
186
+ <a class="nav-title collapsible" href="#" data-target="nav-test-questions-1" >
187
+ <i class="ph ph-caret-right collapse-icon"></i><i class="ph ph-folder"></i> Test Questions
188
+ </a>
189
+ <div class="nav-content collapsed" id="nav-test-questions-1">
190
+ <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>
191
+ <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>
192
+ <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>
193
+ </nav>
194
+ <div class="resize-handle"></div>
195
+ </aside>
196
+
197
+ <!-- Content Area -->
198
+ <main class="content">
199
+ <div class="content-inner">
200
+ <h1>Private Directory Authentication Guide</h1>
201
+ <h2>Overview</h2>
202
+ <p>The @knowcode/doc-builder provides flexible authentication options to protect your documentation. You can either protect specific documents using a <code>private</code> directory or secure your entire documentation site.</p>
203
+ <h2>Two Authentication Modes</h2>
204
+ <h3>1. Private Directory Mode (Mixed Public/Private)</h3>
205
+ <p>Create a <code>docs/private/</code> directory to automatically enable authentication for sensitive documents while keeping the rest of your documentation public.</p>
206
+ <p><strong>How it works:</strong></p>
207
+ <ul>
208
+ <li>Documents in <code>private/</code> folder require authentication</li>
209
+ <li>Documents outside <code>private/</code> remain publicly accessible</li>
210
+ <li>Login button appears in the header</li>
211
+ <li>Perfect for documentation with some sensitive content</li>
212
+ </ul>
213
+ <p><strong>Example structure:</strong></p>
214
+ <pre><code>docs/
215
+ ├── README.md # ✅ Public - Anyone can access
216
+ ├── getting-started.md # ✅ Public - Anyone can access
217
+ ├── guides/
218
+ │ ├── installation.md # ✅ Public - Anyone can access
219
+ │ └── usage.md # ✅ Public - Anyone can access
220
+ └── private/
221
+ ├── api-keys.md # 🔐 Private - Login required
222
+ ├── deployment.md # 🔐 Private - Login required
223
+ └── internal/
224
+ └── secrets.md # 🔐 Private - Login required
225
+ </code></pre>
226
+ <h3>2. Full Site Authentication Mode</h3>
227
+ <p>Make your entire documentation site private by setting authentication in your configuration file.</p>
228
+ <p><strong>How it works:</strong></p>
229
+ <ul>
230
+ <li>ALL documents require authentication</li>
231
+ <li>No public access whatsoever</li>
232
+ <li>Login required before viewing any page</li>
233
+ <li>Perfect for internal company documentation</li>
234
+ </ul>
235
+ <p><strong>Configuration:</strong></p>
236
+ <pre><code class="language-javascript">// doc-builder.config.js
237
+ module.exports = {
238
+ features: {
239
+ authentication: &#39;supabase&#39; // Entire site requires login
240
+ },
241
+ // ... other config
242
+ };
243
+ </code></pre>
244
+ <h2>How They Work Together</h2>
245
+ <p>If you have <strong>both</strong> a private directory AND set authentication in your config:</p>
246
+ <ul>
247
+ <li>The private directory <strong>always</strong> triggers authentication (for security)</li>
248
+ <li>Setting <code>authentication: &#39;supabase&#39;</code> makes the entire site private</li>
249
+ <li>Setting <code>authentication: false</code> is overridden by private directory presence</li>
250
+ <li>This ensures private content is never accidentally exposed</li>
251
+ </ul>
252
+ <h2>User Experience</h2>
253
+ <h3>Private Directory Mode</h3>
254
+ <p><strong>Unauthenticated users see:</strong></p>
255
+ <ul>
256
+ <li>Only public documents in navigation</li>
257
+ <li>Login button in header</li>
258
+ <li>Access to all public content</li>
259
+ <li>Redirect to login if trying to access private URLs</li>
260
+ </ul>
261
+ <p><strong>Authenticated users see:</strong></p>
262
+ <ul>
263
+ <li>Complete navigation including private folders</li>
264
+ <li>Logout button in header </li>
265
+ <li>Full access to all documentation</li>
266
+ <li>Seamless experience across public and private content</li>
267
+ </ul>
268
+ <h3>Full Site Mode</h3>
269
+ <p><strong>Everyone must:</strong></p>
270
+ <ul>
271
+ <li>Login before accessing any content</li>
272
+ <li>Authenticate to see navigation</li>
273
+ <li>Have valid credentials to view any page</li>
274
+ </ul>
275
+ <h2>Setting Up Supabase Authentication</h2>
276
+ <p>Both authentication modes use Supabase for secure user management. Here&#39;s how to configure it:</p>
277
+ <h3>1. Credentials Are Automatic! (v1.8.2+)</h3>
278
+ <p>No need to configure credentials anymore! The shared Supabase database is automatically configured. Each site gets a unique auto-generated site ID during build.</p>
279
+ <p>To override with custom credentials (optional):</p>
280
+ <pre><code class="language-javascript">module.exports = {
281
+ auth: {
282
+ supabaseUrl: &#39;https://your-project.supabase.co&#39;, // Optional override
283
+ supabaseAnonKey: &#39;your-anon-key&#39;, // Optional override
284
+ siteId: &#39;your-site-id&#39; // Optional custom ID
285
+ }
286
+ };
287
+ </code></pre>
288
+ <h3>2. Create Access Control Table</h3>
289
+ <p>In your Supabase dashboard, run this SQL (or use setup-database-v2.sql):</p>
290
+ <pre><code class="language-sql">CREATE TABLE docbuilder_access (
291
+ user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,
292
+ domain TEXT NOT NULL,
293
+ created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
294
+ PRIMARY KEY (user_id, domain)
295
+ );
296
+
297
+ -- Create index for performance
298
+ CREATE INDEX idx_docbuilder_access_domain ON docbuilder_access(domain);
299
+
300
+ -- Enable Row Level Security
301
+ ALTER TABLE docbuilder_access ENABLE ROW LEVEL SECURITY;
302
+
303
+ -- RLS Policy
304
+ CREATE POLICY &quot;Users see own access&quot; ON docbuilder_access
305
+ FOR SELECT USING (user_id = auth.uid());
306
+ </code></pre>
307
+ <h3>3. Grant User Access</h3>
308
+ <p>Add authorized users by domain:</p>
309
+ <pre><code class="language-sql">-- First, create a user in Supabase Auth
310
+ -- Then grant them access to your documentation domain
311
+ INSERT INTO docbuilder_access (user_id, domain)
312
+ VALUES (&#39;user-uuid-from-auth-users&#39;, &#39;docs.example.com&#39;);
313
+
314
+ -- Or grant access to multiple domains
315
+ INSERT INTO docbuilder_access (user_id, domain) VALUES
316
+ (&#39;user-uuid&#39;, &#39;docs.example.com&#39;),
317
+ (&#39;user-uuid&#39;, &#39;staging-docs.example.com&#39;),
318
+ (&#39;user-uuid&#39;, &#39;localhost:3000&#39;);
319
+ </code></pre>
320
+ <h3>Automatic Credential Configuration</h3>
321
+ <p>Starting from version 1.8.2, authentication is truly zero-configuration:</p>
322
+ <ul>
323
+ <li>All doc-builder sites share the same Supabase authentication database</li>
324
+ <li>Credentials are built into the package - no manual configuration needed</li>
325
+ <li>No site IDs needed - the system uses your domain automatically</li>
326
+ <li>Just grant users access to your domain in the database</li>
327
+ </ul>
328
+ <p><strong>Note</strong>: When you build with a private directory:</p>
329
+ <pre><code>🔐 Found private directory - automatically enabling Supabase authentication
330
+ Note: Grant users access by adding domain to the docbuilder_access table
331
+ </code></pre>
332
+ <p><strong>Example</strong>: For a site at <code>docs.example.com</code>, grant access with:</p>
333
+ <pre><code class="language-sql">INSERT INTO docbuilder_access (user_id, domain)
334
+ VALUES (&#39;user-uuid&#39;, &#39;docs.example.com&#39;);
335
+ </code></pre>
336
+ <h2>Best Practices</h2>
337
+ <h3>Choosing the Right Mode</h3>
338
+ <p><strong>Use Private Directory Mode when:</strong></p>
339
+ <ul>
340
+ <li>Most documentation is public</li>
341
+ <li>Only specific sections need protection</li>
342
+ <li>You want easy public access to general docs</li>
343
+ <li>Examples: Open source projects with private contributor guides</li>
344
+ </ul>
345
+ <p><strong>Use Full Site Mode when:</strong></p>
346
+ <ul>
347
+ <li>All content is confidential</li>
348
+ <li>Documentation is for internal use only</li>
349
+ <li>You need maximum security</li>
350
+ <li>Examples: Company handbooks, internal APIs</li>
351
+ </ul>
352
+ <h3>Organizing Private Content</h3>
353
+ <p>Structure your private directory meaningfully:</p>
354
+ <pre><code>private/
355
+ ├── admin/ # Admin-only documentation
356
+ ├── api/ # Internal API docs
357
+ ├── deployment/ # Deployment procedures
358
+ ├── credentials/ # API keys and secrets
359
+ └── team/ # Team processes
360
+ </code></pre>
361
+ <h3>Security Features</h3>
362
+ <ol>
363
+ <li><strong>Build-Time Protection</strong>: Private files excluded from public navigation during build</li>
364
+ <li><strong>URL Protection</strong>: Direct access to private URLs redirects to login</li>
365
+ <li><strong>Session Management</strong>: Supabase handles secure sessions</li>
366
+ <li><strong>Access Control</strong>: Fine-grained permissions via database</li>
367
+ </ol>
368
+ <h3>Migration Strategies</h3>
369
+ <p><strong>Moving to Private Directory Mode:</strong></p>
370
+ <ol>
371
+ <li>Create <code>docs/private/</code> folder</li>
372
+ <li>Move sensitive documents into it</li>
373
+ <li>Update internal links if needed</li>
374
+ <li>Deploy - authentication automatically enabled</li>
375
+ </ol>
376
+ <p><strong>Moving to Full Site Mode:</strong></p>
377
+ <ol>
378
+ <li>Add <code>authentication: &#39;supabase&#39;</code> to config</li>
379
+ <li>Configure Supabase credentials</li>
380
+ <li>Deploy - entire site now requires login</li>
381
+ </ol>
382
+ <h2>Common Scenarios</h2>
383
+ <h3>Example 1: Open Source Project with Private Docs</h3>
384
+ <pre><code>docs/
385
+ ├── README.md # ✅ Public - Project overview
386
+ ├── contributing.md # ✅ Public - How to contribute
387
+ ├── api-reference.md # ✅ Public - API documentation
388
+ └── private/
389
+ ├── deployment.md # 🔐 Private - How to deploy
390
+ ├── api-keys.md # 🔐 Private - Production keys
391
+ └── maintenance.md # 🔐 Private - Admin procedures
392
+ </code></pre>
393
+ <p>Perfect for: Open source projects where most docs are public but deployment and admin info is private.</p>
394
+ <h3>Example 2: Company Documentation Portal</h3>
395
+ <pre><code class="language-javascript">// doc-builder.config.js
396
+ module.exports = {
397
+ features: {
398
+ authentication: &#39;supabase&#39; // Everything requires login
399
+ }
400
+ };
401
+ </code></pre>
402
+ <p>Perfect for: Internal company wikis where all content is confidential.</p>
403
+ <h3>Example 3: Client Documentation with Mixed Access</h3>
404
+ <pre><code>docs/
405
+ ├── getting-started.md # ✅ Public - Basic setup
406
+ ├── faq.md # ✅ Public - Common questions
407
+ ├── changelog.md # ✅ Public - Version history
408
+ └── private/
409
+ ├── advanced-config.md # 🔐 Private - Advanced setup
410
+ ├── troubleshooting.md # 🔐 Private - Debug guides
411
+ └── support-contacts.md # 🔐 Private - Direct contacts
412
+ </code></pre>
413
+ <p>Perfect for: SaaS products where basic docs are public but advanced guides require authentication.</p>
414
+ <h2>Quick Reference</h2>
415
+ <table>
416
+ <thead>
417
+ <tr>
418
+ <th>Feature</th>
419
+ <th>Private Directory Mode</th>
420
+ <th>Full Site Mode</th>
421
+ </tr>
422
+ </thead>
423
+ <tbody><tr>
424
+ <td><strong>Trigger</strong></td>
425
+ <td>Create <code>docs/private/</code> folder</td>
426
+ <td>Set <code>authentication: &#39;supabase&#39;</code> in config</td>
427
+ </tr>
428
+ <tr>
429
+ <td><strong>Public Access</strong></td>
430
+ <td>Yes, for non-private docs</td>
431
+ <td>No, everything requires login</td>
432
+ </tr>
433
+ <tr>
434
+ <td><strong>Use Case</strong></td>
435
+ <td>Mixed public/private content</td>
436
+ <td>Fully private documentation</td>
437
+ </tr>
438
+ <tr>
439
+ <td><strong>Configuration</strong></td>
440
+ <td>Zero config (just create folder)</td>
441
+ <td>One line in config file</td>
442
+ </tr>
443
+ <tr>
444
+ <td><strong>Login Button</strong></td>
445
+ <td>Shows when private folder exists</td>
446
+ <td>Shows when config enabled</td>
447
+ </tr>
448
+ </tbody></table>
449
+ <h2>Summary</h2>
450
+ <p>The @knowcode/doc-builder provides two simple ways to protect your documentation:</p>
451
+ <ol>
452
+ <li><strong>Private Directory</strong>: Just create a <code>private</code> folder for mixed public/private sites</li>
453
+ <li><strong>Full Authentication</strong>: Add one line to config for completely private sites</li>
454
+ </ol>
455
+ <p>Both approaches use the same secure Supabase authentication system, giving you flexibility to choose the right protection level for your documentation needs.</p>
456
+
457
+ </div>
458
+ </main>
459
+ </div>
460
+
461
+ <!-- Scripts -->
462
+ <script>
463
+ // Pass configuration to frontend
464
+ window.docBuilderConfig = {
465
+ features: {
466
+ showPdfDownload: true,
467
+ menuDefaultOpen: false,
468
+ mermaidEnhanced: true
469
+ }
470
+ };
471
+ </script>
472
+ <script src="/js/main.js"></script>
473
+
474
+ </body>
475
+ </html>