Monorepo for Aesthetic.Computer
aesthetic.computer
1# ATProto Tools Directory Structure
2
3## `/at/scripts/` - Permanent Operational Tools
4
5### `audit-user-creation-sync.mjs` ⭐ KEEP
6**Purpose:** Monitor and verify user creation flow from Auth0 → MongoDB → ATProto
7
8**When to use:**
9- Check that new signups are working correctly
10- Verify ATProto accounts are being created
11- Monitor system health after deployments
12- Troubleshoot user creation issues
13
14**Usage:**
15```bash
16# Check recent aesthetic tenant signups
17node scripts/audit-user-creation-sync.mjs aesthetic 10
18
19# Check sotce tenant
20node scripts/audit-user-creation-sync.mjs sotce 10
21
22# Check both tenants
23node scripts/audit-user-creation-sync.mjs both 10
24```
25
26**Keep this tool!** It's essential for ongoing monitoring.
27
28---
29
30### `check-auth0-webhook-config.mjs` ⭐ KEEP
31**Purpose:** Verify Auth0 webhook configuration and environment variables
32
33**When to use:**
34- After environment changes
35- Debugging webhook delivery issues
36- Verifying configuration in new deployments
37
38**Usage:**
39```bash
40node scripts/check-auth0-webhook-config.mjs
41```
42
43**Keep this tool!** Useful for configuration verification.
44
45---
46
47### `query-auth0-signups.mjs` ⭐ KEEP (Already existed)
48**Purpose:** Query Auth0 for recent user signups
49
50**Keep this tool!** Already part of your toolkit.
51
52---
53
54## `/at/oldtools/` - One-Off Fix Scripts
55
56### `test-user-creation-flow.mjs` 🔧 ARCHIVE
57**Purpose:** Backfill missing user records and create ATProto accounts
58
59**What it does:**
60- Creates missing users records with codes
61- Creates missing ATProto accounts
62- One-time fix for the index conflict issue
63
64**Historical use:** Fixed 5 users on Oct 14, 2025 after index conflict was discovered.
65
66**Keep in oldtools:** May be useful if similar issues happen again, but shouldn't be needed for normal operations.
67
68---
69
70### `diagnose-user-code-generation.mjs` 🔧 ARCHIVE
71**Purpose:** Test user code generation in isolation
72
73**What it does:**
74- Tests `generateUserCode()` function
75- Simulates auth0-events.mjs flow
76- Identifies index conflicts
77
78**Historical use:** Discovered the `code_1` index conflict issue.
79
80**Keep in oldtools:** Good diagnostic tool but not needed for day-to-day operations.
81
82---
83
84### `check-code-1-user.mjs` 🔧 ARCHIVE
85**Purpose:** Verify no user has code "code_1" and list MongoDB indexes
86
87**What it does:**
88- Checks for users with invalid codes
89- Lists all indexes on users collection
90- Confirms index naming conventions
91
92**Historical use:** Confirmed `code_1` was just an index name, not user data.
93
94**Keep in oldtools:** Educational but not needed for operations.
95
96---
97
98## Quick Reference Commands
99
100### Daily/Weekly Monitoring
101```bash
102# Check last 10 signups are properly synced
103cd /workspaces/aesthetic-computer/at
104node scripts/audit-user-creation-sync.mjs aesthetic 10
105```
106
107### After Deployment
108```bash
109# Verify webhook config
110node scripts/check-auth0-webhook-config.mjs
111
112# Check recent signups
113node scripts/audit-user-creation-sync.mjs aesthetic 5
114```
115
116### If Issues Arise
117```bash
118# First, audit to see what's wrong
119node scripts/audit-user-creation-sync.mjs aesthetic 20
120
121# If needed, use one-off fix tool
122node oldtools/test-user-creation-flow.mjs 10 --fix
123
124# Or diagnose specific issues
125node oldtools/diagnose-user-code-generation.mjs
126```
127
128---
129
130## Recommended Monitoring Schedule
131
132**Weekly:** Run audit to spot-check recent signups
133```bash
134node scripts/audit-user-creation-sync.mjs aesthetic 20
135```
136
137**After Auth0/MongoDB changes:** Verify configuration
138```bash
139node scripts/check-auth0-webhook-config.mjs
140node scripts/audit-user-creation-sync.mjs aesthetic 5
141```
142
143**After PDS updates:** Check ATProto account creation
144```bash
145node scripts/audit-user-creation-sync.mjs aesthetic 10
146```
147
148---
149
150## Documentation
151
152- `INVESTIGATION-REPORT.md` - Full investigation details (Oct 14, 2025)
153- `FIX-SUMMARY.md` - Complete fix documentation
154- `QUICK-REFERENCE.md` - Quick command reference
155- `README.md` - This file
156
157---
158
159**Last Updated:** October 14, 2025
160**Issue Fixed:** MongoDB index conflict preventing user creation
161**Status:** ✅ All systems operational