- Added 2-minute timeout to psql execution
- Schema failures no longer crash Directus startup
- Directus can start with empty schema if needed
- Prevents infinite hangs on large SQL files
Features:
- Completely standalone (no Directus, no middleware, no redirects)
- Live service status for all 4 containers
- SQL Console for direct database queries
- Quick Actions (check sites, count articles, etc.)
- Table browser with row counts
- Memory & performance metrics
- Auto-refresh option (5s interval)
- Raw health data viewer
Tech:
- Pure React via ESM CDN imports
- Tailwind CDN (no build dependency)
- Dark theme with gold accents
- Works even when everything else is broken
URL: /god
New endpoint: /api/god/[action]
- GET /api/god/health - Full system health (DB, pool, tables)
- GET /api/god/db-status - Database connection test
- GET /api/god/tables - List all tables with row counts
- GET /api/god/logs - Recent work_log entries
- POST /api/god/sql - Execute raw SQL
Features:
- Bypasses Directus entirely, connects directly to PostgreSQL
- Works even when Directus is crashed/frozen
- Validates X-God-Token header
- Added pg package for direct DB access
start.sh:
- Added fallback defaults for DB_USER, DB_HOST, DB_DATABASE, DB_PASSWORD
- Ensures psql always uses 'postgres' user even if env vars missing
- Added debug logging to show which credentials are being used
complete_schema.sql:
- Permissions Protocol now checks if directus_policies table exists first
- Silently skips on first boot (before Directus creates its tables)
- Prevents SQL errors during fresh install
- GOD_MODE_TOKEN is now primary auth (no admin token needed)
- Sends both X-God-Token header AND Authorization Bearer
- Falls back to ADMIN_TOKEN only if no God token set
Features:
- Keep-alive connections (no random disconnects)
- Zero timeout (never cuts off)
- Auto-retry with exponential backoff (5 attempts)
- Works as CLI and Node.js module
Commands:
- health: Check API status
- collections: List all collections
- schema: Export full schema
- read <coll>: Query collection
- count <coll>: Count items
- insert <coll>: Create item from stdin
No yaml edits - pure JS utility
SCHEMA UPDATE:
- Added Permissions Grant Protocol to complete_schema.sql
- Auto-grants Admin role CRUD access to all 13 new collections
- Runs automatically during fresh install
- Uses ON CONFLICT DO NOTHING for safe re-runs
CTO DOCS UPDATE:
- Added Section 9A: Stability Patch & Permissions Protocol
- Documents the Foundation Gap resolution
- Includes manual patch instructions for existing DBs
- Verification checklist after patching
ANALYTICS ENGINE (4 tables):
- site_analytics: GA/Ads/Pixel tracking config
- events: Custom event tracking
- pageviews: Page view analytics
- conversions: Conversion tracking with lead linking
GEO-INTELLIGENCE (3 tables):
- locations_states: 50 US states with codes
- locations_counties: 3,143 counties
- locations_cities: Cities with lat/long, zip codes
LEAD CAPTURE (2 tables):
- forms: Dynamic form builder
- form_submissions: Form data storage
SITE BUILDER (3 tables):
- navigation: Self-referential menu system
- globals: Site-wide settings (singleton per site)
- hub_pages: Hierarchical content hubs
SYSTEM (1 table):
- work_log: Activity logging
Also added Directus UI configs for all new FK fields.
Schema now has 28 tables matching TypeScript types.
NEW CRITICAL ISSUES:
- Issue 0: Auto-SEO not generating for pages/posts (only generated_articles)
- Issue 0.1: SEO status indicators missing from dashboards
- Issue 0.2: Kanban exists but needs data verification
KANBAN ANALYSIS:
- KanbanBoard.tsx exists (180 lines, @dnd-kit)
- Connected to Directus via React Query
- Needs: status field in generated_articles, test data
- Created vite-env.d.ts with proper ImportMetaEnv interface
- Fixed client.ts to use internal Docker URL (http://directus:8055) for SSR
- Removed @ts-ignore directives
- Frontend now compiles cleanly
- Added frontend godMode client library for all admin pages
- Created schema management endpoints (create/edit collections, fields, relations)
- Built automated site provisioning (creates site + homepage + navigation + forms)
- Implemented schema-as-code with start.sh auto-migration script
- Added FORCE_FRESH_INSTALL mode for database wipes
- Integrated work log, error log, and queue management via god-mode
- All admin pages can now use god-mode for seamless operations