Overview
Directus CMS serves as the primary data layer for Genie Helper, providing:- Headless CMS: RESTful API for all application data
- Authentication: User management, JWT tokens, role-based access control
- Collections: 11 core collections for creators, media, jobs, and platform data
- Flows: Low-code automation workflows (scraping, media processing, notifications)
- Admin Panel: Visual interface for data management and debugging
- Port: 8055 (proxied to
/api/directus/in production) - Process:
pm2 agentx-cms - Admin URL:
https://geniehelper.com/admin(iframe in dashboard)
Architecture Integration
Data Flow
MCP Integration
The Directus MCP Server exposes 17 tools to the AnythingLLM agent: Location:/home/daytona/workspace/source/scripts/directus-mcp-server.mjs:1
Tools:
Agent Use Case:
Key Collections
Genie Helper uses 11 core Directus collections:1. creator_profiles
Purpose: Platform account credentials and scrape configuration
Encryption: The
credentials field uses server-side AES-256-GCM encryption via credentialsCrypto.js.
2. scraped_media
Purpose: Content library with engagement metrics
Taxonomy Integration: See
taxonomy_dimensions collection for concept definitions.
3. scheduled_posts
Purpose: Cross-platform post queue
Worker Integration: The
post_scheduler worker polls this collection every 60s for pending posts where scheduled_for <= NOW().
4. media_jobs
Purpose: BullMQ job tracking for media operations
Dashboard Polling: Dashboard uses this collection to show real-time job progress.
5. hitl_sessions
Purpose: Human-in-the-loop login requests
Trigger: Created when scraping fails due to missing cookies. See Browser Extension for HITL flow.
6. platform_sessions
Purpose: Encrypted browser cookies for automated login
Security: Cookies encrypted with same
credentialsCrypto.js module as creator_profiles.credentials.
7. taxonomy_dimensions
Purpose: 6 super-concept content classification system
Current Dimensions (from README):
- Intimacy Level
- Production Quality
- Content Type
- Audience Appeal
- Platform Fit
- Engagement Potential
8. taxonomy_mapping
Purpose: 3,208 classified tags across 6 concepts
AI Classification: The
taxonomy-tag Action Runner flow uses this mapping to auto-classify new content.
9. fan_profiles
Purpose: Fan engagement data10. action_flows
Purpose: Action Runner flow definitions
Action Runner: When agent outputs
[ACTION:slug:{"params"}], the action-runner plugin executes the matching flow.
Seeded Flows (from README):
scout-analyze: Scrape URL + AI analysistaxonomy-tag: Auto-classify contentpost-create: Draft platform-specific postmessage-generate: Fan engagement messagememory-recall: Search stored data + summarizemedia-process: Queue media job (watermark, teaser, compress)
11. agent_audits
Purpose: Action execution logs
Debugging: Use this collection to debug why actions failed or missed.
Directus Flows
Directus Flows are low-code automation workflows triggered by:- Webhooks: External HTTP POST triggers
- Schedule: Cron-based triggers
- Events: Collection CRUD events (insert, update, delete)
- Manual: Triggered via
trigger-flowMCP tool or API
Example Flow: Platform Scraping
Flow Name:platform_scrape_flow
Trigger: Manual (via trigger-flow MCP tool or dashboard button)
Steps:
- stagehand_cookie_login: Inject cookies from
platform_sessions+ navigate to creator profile - stagehand_extract: Extract profile stats (followers, earnings, recent posts)
- create-item (Directus): Insert/update
scraped_mediarecords - stagehand_close: End browser session
/home/daytona/workspace/source/scripts/hitl/seed_platform_scrape_flow.mjs:1
Creating Custom Flows
Directus admin panel provides a visual flow builder:- Navigate to
https://geniehelper.com/admin→ Flows - Click “Create Flow”
- Select trigger type
- Add operations:
- Webhook / HTTP Request: Call external APIs
- Run Script: Execute Node.js code
- Condition: Branching logic
- Create/Update/Delete Data: Directus CRUD
- Send Notification: Email, push, webhook
- Trigger Another Flow: Flow chaining
Authentication & RBAC
User Roles
Genie Helper uses Directus roles:RBAC Sync
User creation in dashboard automatically syncs to Directus: Sync Endpoint:/api/rbacSync (webhook triggered by Directus user creation)
Flow:
- User registers in dashboard
/register - Dashboard calls
/api/register(proxy to Directus/userswith admin token) - Directus creates user + triggers RBAC sync webhook
- Sync webhook creates
user_personascollection record - User can now log in and access dashboard
/home/daytona/workspace/source/server/endpoints/api/register.js:1/home/daytona/workspace/source/server/endpoints/api/rbacSync.js:1
JWT Tokens
Directus uses JWT for authentication:- Access Token: Short-lived (15 min), used for API requests
- Refresh Token: Long-lived (7 days), used to renew access token
- Access token:
localStorage.getItem('directus_token') - Refresh token: Auto-refreshed via Directus SDK
DIRECTUS_ADMIN_TOKEN env var for elevated permissions.
API Proxy
Production traffic routes through nginx proxy: Nginx Config (Plesk):Environment Variables
Directus requires these env vars:Debugging
Check Directus Logs
Restart Directus
Query Collections via CLI
Access Admin Panel
URL:https://geniehelper.com/admin
Credentials:
- Email:
admin@geniehelper.com - Password: (see README admin credentials section)
- Browse collections
- Edit records
- View flows
- Monitor activity logs
- Manage users and roles
Performance Tips
Enable Caching
Directus supports Redis caching for improved performance: Env Vars:Optimize Queries
Usefields parameter to reduce payload size:
Indexed Fields
Ensure frequently queried fields have database indexes:creator_profiles.user_idscraped_media.creator_profile_idscheduled_posts.scheduled_formedia_jobs.statusplatform_sessions.platform
Related Documentation
- Browser Extension - Cookie capture for platform authentication
- Stagehand Automation - Browser automation workflows
- Platform Connections - Managing creator credentials
