@knowcode/doc-builder 1.8.2 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +23 -3
- package/README.md +4 -4
- package/cli.js +9 -40
- package/html/README.html +3 -3
- package/html/auth.js +1 -1
- package/html/documentation-index.html +3 -3
- package/html/guides/authentication-default-change.html +3 -3
- package/html/guides/authentication-guide.html +34 -45
- package/html/guides/claude-workflow-guide.html +3 -3
- package/html/guides/documentation-standards.html +3 -3
- package/html/guides/phosphor-icons-guide.html +3 -3
- package/html/guides/private-directory-authentication.html +35 -17
- package/html/guides/public-site-deployment.html +8 -9
- package/html/guides/search-engine-verification-guide.html +3 -3
- package/html/guides/seo-guide.html +3 -3
- package/html/guides/seo-optimization-guide.html +3 -3
- package/html/guides/troubleshooting-guide.html +3 -3
- package/html/guides/windows-setup-guide.html +3 -3
- package/html/index.html +3 -3
- package/html/js/auth.js +1 -1
- package/html/login.html +1 -1
- package/html/private/cache-control-anti-pattern.html +3 -3
- package/html/private/launch/README.html +3 -3
- package/html/private/launch/auth-cleanup-summary.html +3 -3
- package/html/private/launch/bubble-plugin-specification.html +3 -3
- package/html/private/launch/go-to-market-strategy.html +3 -3
- package/html/private/launch/launch-announcements.html +3 -3
- package/html/private/launch/vercel-deployment-auth-setup.html +25 -19
- package/html/private/next-steps-walkthrough.html +16 -43
- package/html/private/supabase-auth-implementation-completed.html +6 -6
- package/html/private/supabase-auth-implementation-plan.html +14 -31
- package/html/private/supabase-auth-integration-plan.html +32 -67
- package/html/private/supabase-auth-setup-guide.html +71 -82
- package/html/private/test-private-doc.html +3 -3
- package/html/private/user-management-tooling.html +7 -13
- package/html/sitemap.xml +44 -44
- package/html/vercel-cli-setup-guide.html +3 -3
- package/html/vercel-first-time-setup-guide.html +3 -3
- package/lib/config.js +3 -11
- package/lib/core-builder.js +1 -2
- package/lib/shared-auth-config.js +2 -10
- package/lib/supabase-auth.js +5 -11
- package/package.json +1 -1
- package/setup-database-v2.sql +53 -0
- package/user-management/README.md +9 -18
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.898Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.898Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/guides/troubleshooting-guide.html"
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
|
|
139
139
|
<div class="header-actions">
|
|
140
140
|
<div class="deployment-info">
|
|
141
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
141
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
142
142
|
</div>
|
|
143
143
|
|
|
144
144
|
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.902Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.902Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/guides/windows-setup-guide.html"
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
|
|
139
139
|
<div class="header-actions">
|
|
140
140
|
<div class="deployment-info">
|
|
141
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
141
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
142
142
|
</div>
|
|
143
143
|
|
|
144
144
|
|
package/html/index.html
CHANGED
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.854Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.854Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/README.html"
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
|
|
133
133
|
<div class="header-actions">
|
|
134
134
|
<div class="deployment-info">
|
|
135
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
135
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
136
136
|
</div>
|
|
137
137
|
|
|
138
138
|
|
package/html/js/auth.js
CHANGED
package/html/login.html
CHANGED
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.904Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.904Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/private/cache-control-anti-pattern.html"
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
|
|
139
139
|
<div class="header-actions">
|
|
140
140
|
<div class="deployment-info">
|
|
141
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
141
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
142
142
|
</div>
|
|
143
143
|
|
|
144
144
|
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.906Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.906Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/private/launch/README.html"
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
|
|
145
145
|
<div class="header-actions">
|
|
146
146
|
<div class="deployment-info">
|
|
147
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
147
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.907Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.907Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/private/launch/auth-cleanup-summary.html"
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
|
|
145
145
|
<div class="header-actions">
|
|
146
146
|
<div class="deployment-info">
|
|
147
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
147
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.909Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.909Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/private/launch/bubble-plugin-specification.html"
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
|
|
145
145
|
<div class="header-actions">
|
|
146
146
|
<div class="deployment-info">
|
|
147
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
147
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.912Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.912Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/private/launch/go-to-market-strategy.html"
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
|
|
145
145
|
<div class="header-actions">
|
|
146
146
|
<div class="deployment-info">
|
|
147
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
147
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.915Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.915Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/private/launch/launch-announcements.html"
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
|
|
145
145
|
<div class="header-actions">
|
|
146
146
|
<div class="deployment-info">
|
|
147
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
147
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.917Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.917Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/private/launch/vercel-deployment-auth-setup.html"
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
|
|
145
145
|
<div class="header-actions">
|
|
146
146
|
<div class="deployment-info">
|
|
147
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
147
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
148
148
|
</div>
|
|
149
149
|
|
|
150
150
|
|
|
@@ -255,16 +255,19 @@
|
|
|
255
255
|
<ul>
|
|
256
256
|
<li><strong>URL</strong>: <a href="https://doc-builder-2znroyb5z-lindsay-1340s-projects.vercel.app">https://doc-builder-2znroyb5z-lindsay-1340s-projects.vercel.app</a></li>
|
|
257
257
|
</ul>
|
|
258
|
-
<h2>Step 1:
|
|
259
|
-
<p>
|
|
258
|
+
<h2>Step 1: Grant User Access for Vercel Domain</h2>
|
|
259
|
+
<p>Since we now use domain-based authentication, you need to grant users access to the Vercel domain.</p>
|
|
260
260
|
<h3>Option A: Using Supabase Dashboard (Recommended)</h3>
|
|
261
261
|
<ol>
|
|
262
262
|
<li>Go to your Supabase project: <a href="https://supabase.com/dashboard/project/xcihhnfcitjrwbynxmka">https://supabase.com/dashboard/project/xcihhnfcitjrwbynxmka</a></li>
|
|
263
263
|
<li>Click on <strong>Table Editor</strong> in the left sidebar</li>
|
|
264
|
-
<li>Select the <code>
|
|
265
|
-
<li>
|
|
266
|
-
<li>
|
|
267
|
-
<li
|
|
264
|
+
<li>Select the <code>docbuilder_access</code> table</li>
|
|
265
|
+
<li>Click <strong>Insert row</strong></li>
|
|
266
|
+
<li>Add:<ul>
|
|
267
|
+
<li><code>user_id</code>: Select the test user from dropdown</li>
|
|
268
|
+
<li><code>domain</code>: <code>doc-builder-2znroyb5z-lindsay-1340s-projects.vercel.app</code></li>
|
|
269
|
+
</ul>
|
|
270
|
+
</li>
|
|
268
271
|
<li>Click <strong>Save</strong></li>
|
|
269
272
|
</ol>
|
|
270
273
|
<h3>Option B: Using SQL Editor</h3>
|
|
@@ -273,15 +276,18 @@
|
|
|
273
276
|
<li>Click on <strong>SQL Editor</strong> in the left sidebar</li>
|
|
274
277
|
<li>Run this SQL command:</li>
|
|
275
278
|
</ol>
|
|
276
|
-
<pre><code class="language-sql">--
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
279
|
+
<pre><code class="language-sql">-- Grant user access to Vercel deployment domain
|
|
280
|
+
INSERT INTO docbuilder_access (user_id, domain)
|
|
281
|
+
VALUES (
|
|
282
|
+
(SELECT id FROM auth.users WHERE email = 'testuser@example.com'),
|
|
283
|
+
'doc-builder-2znroyb5z-lindsay-1340s-projects.vercel.app'
|
|
284
|
+
);
|
|
280
285
|
|
|
281
|
-
-- Verify the
|
|
282
|
-
SELECT
|
|
283
|
-
FROM
|
|
284
|
-
|
|
286
|
+
-- Verify the access
|
|
287
|
+
SELECT u.email, da.domain, da.created_at
|
|
288
|
+
FROM docbuilder_access da
|
|
289
|
+
JOIN auth.users u ON u.id = da.user_id
|
|
290
|
+
WHERE da.domain = 'doc-builder-2znroyb5z-lindsay-1340s-projects.vercel.app';
|
|
285
291
|
</code></pre>
|
|
286
292
|
<h2>Step 2: Test Authentication Flow</h2>
|
|
287
293
|
<p>Once the database is updated, test the authentication:</p>
|
|
@@ -348,8 +354,8 @@ npx @knowcode/doc-builder auth:add-user production-email@example.com
|
|
|
348
354
|
</li>
|
|
349
355
|
<li><p><strong>Deploy Multiple Sites</strong>:</p>
|
|
350
356
|
<ul>
|
|
351
|
-
<li>Each site
|
|
352
|
-
<li>Users can have access to multiple
|
|
357
|
+
<li>Each site uses its domain for authentication</li>
|
|
358
|
+
<li>Users can have access to multiple domains</li>
|
|
353
359
|
<li>Central authentication system</li>
|
|
354
360
|
</ul>
|
|
355
361
|
</li>
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.920Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.920Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/private/next-steps-walkthrough.html"
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
|
|
139
139
|
<div class="header-actions">
|
|
140
140
|
<div class="deployment-info">
|
|
141
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
141
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
142
142
|
</div>
|
|
143
143
|
|
|
144
144
|
|
|
@@ -268,37 +268,21 @@ npm install
|
|
|
268
268
|
<li><strong>Go to SQL Editor</strong> in Supabase dashboard</li>
|
|
269
269
|
<li><strong>Run this SQL</strong> to create the required tables:</li>
|
|
270
270
|
</ol>
|
|
271
|
-
<pre><code class="language-sql">--
|
|
272
|
-
CREATE TABLE docbuilder_sites (
|
|
273
|
-
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
274
|
-
domain TEXT UNIQUE NOT NULL,
|
|
275
|
-
name TEXT NOT NULL,
|
|
276
|
-
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
277
|
-
);
|
|
278
|
-
|
|
279
|
-
-- Table 2: User access mapping
|
|
271
|
+
<pre><code class="language-sql">-- Single table for user access control (simplified!)
|
|
280
272
|
CREATE TABLE docbuilder_access (
|
|
281
273
|
user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,
|
|
282
|
-
|
|
274
|
+
domain TEXT NOT NULL,
|
|
283
275
|
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
284
|
-
PRIMARY KEY (user_id,
|
|
276
|
+
PRIMARY KEY (user_id, domain)
|
|
285
277
|
);
|
|
286
278
|
|
|
279
|
+
-- Create index for faster lookups
|
|
280
|
+
CREATE INDEX idx_docbuilder_access_domain ON docbuilder_access(domain);
|
|
281
|
+
|
|
287
282
|
-- Enable Row Level Security
|
|
288
|
-
ALTER TABLE docbuilder_sites ENABLE ROW LEVEL SECURITY;
|
|
289
283
|
ALTER TABLE docbuilder_access ENABLE ROW LEVEL SECURITY;
|
|
290
284
|
|
|
291
|
-
-- RLS Policy: Users can only see
|
|
292
|
-
CREATE POLICY "Users see accessible sites" ON docbuilder_sites
|
|
293
|
-
FOR SELECT USING (
|
|
294
|
-
EXISTS (
|
|
295
|
-
SELECT 1 FROM docbuilder_access
|
|
296
|
-
WHERE site_id = docbuilder_sites.id
|
|
297
|
-
AND user_id = auth.uid()
|
|
298
|
-
)
|
|
299
|
-
);
|
|
300
|
-
|
|
301
|
-
-- RLS Policy: Users can see their own access
|
|
285
|
+
-- RLS Policy: Users can only see their own access
|
|
302
286
|
CREATE POLICY "Users see own access" ON docbuilder_access
|
|
303
287
|
FOR SELECT USING (user_id = auth.uid());
|
|
304
288
|
</code></pre>
|
|
@@ -325,9 +309,8 @@ module.exports = {
|
|
|
325
309
|
},
|
|
326
310
|
|
|
327
311
|
auth: {
|
|
328
|
-
supabaseUrl: 'YOUR_SUPABASE_URL_HERE',
|
|
329
|
-
supabaseAnonKey: 'YOUR_ANON_KEY_HERE'
|
|
330
|
-
siteId: '' // Will be filled in next step
|
|
312
|
+
supabaseUrl: 'YOUR_SUPABASE_URL_HERE', // Optional - has defaults
|
|
313
|
+
supabaseAnonKey: 'YOUR_ANON_KEY_HERE' // Optional - has defaults
|
|
331
314
|
}
|
|
332
315
|
};
|
|
333
316
|
EOF
|
|
@@ -343,18 +326,8 @@ EOF
|
|
|
343
326
|
</code></pre>
|
|
344
327
|
<p>This should prompt you for Supabase credentials and create/update the config.</p>
|
|
345
328
|
<ol start="2">
|
|
346
|
-
<li><strong>
|
|
329
|
+
<li><strong>No site registration needed!</strong> The new system uses domains automatically.</li>
|
|
347
330
|
</ol>
|
|
348
|
-
<pre><code class="language-sql">-- Run in Supabase SQL Editor
|
|
349
|
-
INSERT INTO docbuilder_sites (domain, name)
|
|
350
|
-
VALUES ('localhost:3000', 'Test Site')
|
|
351
|
-
RETURNING id;
|
|
352
|
-
</code></pre>
|
|
353
|
-
<ol start="3">
|
|
354
|
-
<li><strong>Copy the returned site ID</strong> and update your <code>test-config.js</code>:</li>
|
|
355
|
-
</ol>
|
|
356
|
-
<pre><code class="language-javascript">siteId: 'the-uuid-returned-from-above'
|
|
357
|
-
</code></pre>
|
|
358
331
|
<h3>Step 7: Create Test Documentation</h3>
|
|
359
332
|
<ol>
|
|
360
333
|
<li><strong>Create test docs folder</strong>:</li>
|
|
@@ -422,9 +395,9 @@ If you can see this page, authentication is working!" > test-docs/README
|
|
|
422
395
|
</ol>
|
|
423
396
|
<h3>Step 11: Grant Access to Test User</h3>
|
|
424
397
|
<pre><code class="language-sql">-- Run in Supabase SQL Editor
|
|
425
|
-
-- Replace with actual user ID
|
|
426
|
-
INSERT INTO docbuilder_access (user_id,
|
|
427
|
-
VALUES ('USER_ID_FROM_STEP_10', '
|
|
398
|
+
-- Replace with actual user ID from step 10
|
|
399
|
+
INSERT INTO docbuilder_access (user_id, domain)
|
|
400
|
+
VALUES ('USER_ID_FROM_STEP_10', 'localhost:3001');
|
|
428
401
|
</code></pre>
|
|
429
402
|
<h3>Step 12: Test Complete Flow</h3>
|
|
430
403
|
<ol>
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.921Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.921Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/private/supabase-auth-implementation-completed.html"
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
|
|
139
139
|
<div class="header-actions">
|
|
140
140
|
<div class="deployment-info">
|
|
141
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
141
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
142
142
|
</div>
|
|
143
143
|
|
|
144
144
|
|
|
@@ -294,9 +294,9 @@
|
|
|
294
294
|
authentication: 'supabase' // Must explicitly enable
|
|
295
295
|
},
|
|
296
296
|
auth: {
|
|
297
|
-
supabaseUrl: 'https://xxx.supabase.co',
|
|
298
|
-
supabaseAnonKey: 'your-anon-key'
|
|
299
|
-
siteId
|
|
297
|
+
supabaseUrl: 'https://xxx.supabase.co', // Optional - has defaults
|
|
298
|
+
supabaseAnonKey: 'your-anon-key' // Optional - has defaults
|
|
299
|
+
// No siteId needed - uses domain automatically!
|
|
300
300
|
}
|
|
301
301
|
};
|
|
302
302
|
</code></pre>
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"name": "Knowcode Ltd",
|
|
99
99
|
"url": "https://knowcode.tech"
|
|
100
100
|
},
|
|
101
|
-
"datePublished": "2025-07-
|
|
102
|
-
"dateModified": "2025-07-
|
|
101
|
+
"datePublished": "2025-07-26T11:11:45.924Z",
|
|
102
|
+
"dateModified": "2025-07-26T11:11:45.924Z",
|
|
103
103
|
"mainEntityOfPage": {
|
|
104
104
|
"@type": "WebPage",
|
|
105
105
|
"@id": "https://doc-builder-delta.vercel.app/private/supabase-auth-implementation-plan.html"
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
|
|
139
139
|
<div class="header-actions">
|
|
140
140
|
<div class="deployment-info">
|
|
141
|
-
<span class="deployment-date" title="Built with doc-builder v1.8.
|
|
141
|
+
<span class="deployment-date" title="Built with doc-builder v1.8.2">Last updated: Jul 26, 2025, 11:11 AM UTC</span>
|
|
142
142
|
</div>
|
|
143
143
|
|
|
144
144
|
|
|
@@ -278,43 +278,26 @@
|
|
|
278
278
|
|
|
279
279
|
subgraph "Supabase"
|
|
280
280
|
AuthUsers[auth.users]
|
|
281
|
-
|
|
282
|
-
DocAccess[docbuilder_access]
|
|
281
|
+
DocAccess[docbuilder_access with domain]
|
|
283
282
|
AuthUsers -.-> DocAccess
|
|
284
|
-
DocAccess -.-> DocSites
|
|
285
283
|
end</div>
|
|
286
284
|
</div>
|
|
287
285
|
<h2>Database Schema</h2>
|
|
288
|
-
<pre><code class="language-sql">--
|
|
289
|
-
CREATE TABLE docbuilder_sites (
|
|
290
|
-
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
291
|
-
domain TEXT UNIQUE NOT NULL,
|
|
292
|
-
name TEXT NOT NULL,
|
|
293
|
-
created_at TIMESTAMPTZ DEFAULT NOW()
|
|
294
|
-
);
|
|
295
|
-
|
|
296
|
-
-- Table 2: User access mapping
|
|
286
|
+
<pre><code class="language-sql">-- Single table for user access control (simplified!)
|
|
297
287
|
CREATE TABLE docbuilder_access (
|
|
298
288
|
user_id UUID REFERENCES auth.users(id) ON DELETE CASCADE,
|
|
299
|
-
|
|
289
|
+
domain TEXT NOT NULL,
|
|
300
290
|
created_at TIMESTAMPTZ DEFAULT NOW(),
|
|
301
|
-
PRIMARY KEY (user_id,
|
|
291
|
+
PRIMARY KEY (user_id, domain)
|
|
302
292
|
);
|
|
303
293
|
|
|
294
|
+
-- Create index for faster lookups
|
|
295
|
+
CREATE INDEX idx_docbuilder_access_domain ON docbuilder_access(domain);
|
|
296
|
+
|
|
304
297
|
-- Enable Row Level Security
|
|
305
|
-
ALTER TABLE docbuilder_sites ENABLE ROW LEVEL SECURITY;
|
|
306
298
|
ALTER TABLE docbuilder_access ENABLE ROW LEVEL SECURITY;
|
|
307
299
|
|
|
308
|
-
-- RLS
|
|
309
|
-
CREATE POLICY "Users see accessible sites" ON docbuilder_sites
|
|
310
|
-
FOR SELECT USING (
|
|
311
|
-
EXISTS (
|
|
312
|
-
SELECT 1 FROM docbuilder_access
|
|
313
|
-
WHERE site_id = docbuilder_sites.id
|
|
314
|
-
AND user_id = auth.uid()
|
|
315
|
-
)
|
|
316
|
-
);
|
|
317
|
-
|
|
300
|
+
-- RLS Policy: Users can only see their own access
|
|
318
301
|
CREATE POLICY "Users see own access" ON docbuilder_access
|
|
319
302
|
FOR SELECT USING (user_id = auth.uid());
|
|
320
303
|
</code></pre>
|
|
@@ -329,10 +312,10 @@ CREATE POLICY "Users see own access" ON docbuilder_access
|
|
|
329
312
|
<p><strong>File</strong>: <code>lib/config.js</code></p>
|
|
330
313
|
<pre><code class="language-javascript">// Updated auth configuration - REMOVE basic auth fields
|
|
331
314
|
auth: {
|
|
332
|
-
// Only Supabase fields remain
|
|
315
|
+
// Only Supabase fields remain (domain-based, no siteId!)
|
|
333
316
|
supabaseUrl: '',
|
|
334
|
-
supabaseAnonKey: ''
|
|
335
|
-
|
|
317
|
+
supabaseAnonKey: ''
|
|
318
|
+
// Domain is detected automatically from window.location.host
|
|
336
319
|
}
|
|
337
320
|
</code></pre>
|
|
338
321
|
<h4>1.2 Create Supabase Auth Module</h4>
|