INDULGON Blueprint Routes Database Forms Connections Ops Manual Dashboard

Connection Blueprint

The complete map of how every part of the Indulgon platform connects — frontend pages to backend routes, backend routes to PostgreSQL tables, and PostgreSQL to Notion databases.

Use this when moving Notion databases: Each Notion DB section shows exactly which properties are required, which are optional, and what breaks if a property is renamed or removed.
Use this when reconnecting: Follow the "How to Reconnect" instructions at the bottom of each DB section.

Frontend → Backend
New performer creates account (signup-performer.html)New fan/customer creates account (signup-fan.html)User authentication (login.html)Main performer dashboard (dashboard.html)Manage all bookings (bookings.html)Pay-per-message inbox (messages-v2.html)Performer earnings history, payout requests, scene (earnings-v2.html)Payout method setup (payments.html)All user preferences (settings.html)Performer safety (safety.html)Model releases (legal.html)Live cam shows (cam.html)Financial Hub (financial.html)Unified inbox (inbox.html)Scene filmography (filmography.html)
Backend → Notion Databases
Users (USERS_DB_ID)Error Tracking (ERROR_TRACKING_NOTION_DB_ID)Safety Alerts (SAFETY_ALERTS_NOTION_DB_ID)Business Alerts (BUSINESS_ALERTS_NOTION_DB_ID)Bookings & Requests (BOOKINGS_DB_ID)Earnings & Payments (EARNINGS_DB_ID)Notifications (NOTIFICATIONS_DB_ID)Support & Reports (SUPPORT_DB_ID)Legal & Compliance (LEGAL_DB_ID)Payout History (PAYOUT_HISTORY_DB_ID)Platform Stats (PLATFORM_STATS_DB_ID)Connected Accounts (CONNECTED_ACCOUNTS_DB_ID)Activity Log (ACTIVITY_LOG_DB_ID)

Part 1 — Frontend → Backend → Database Connections

How each page connects to the API and which database tables are involved.

New performer creates account Open page →
API Calls
POST /api/auth/register
firstNamelastNamedisplayNameemailpasswordrole=performer
Creates row in users table → syncs to USERS_DB_ID Notion
GET /api/auth/oauth/config
no required fields
Gets Google OAuth client ID for Google signup button
PostgreSQL Tables
usersage_verificationuser_settings
Notion Sync
USERS_DB_ID
New fan/customer creates account Open page →
API Calls
POST /api/auth/register
firstNamelastNameusernameemailpasswordrole=fan
Creates row in users table → syncs to USERS_DB_ID Notion
PostgreSQL Tables
usersuser_credits
Notion Sync
USERS_DB_ID
User authentication Open page →
API Calls
POST /api/auth/login
emailpassword
Returns JWT token stored in localStorage
GET /api/auth/me
Authorization header
Validates token, returns user object
POST /api/auth/oauth
provider=googleaccess_token
Verifies Google token → creates/finds user → returns JWT
PostgreSQL Tables
userssessionsuser_activity_log
Notion Sync
ACTIVITY_LOG_DB_ID
Main performer dashboard — overview of all activity Open page →
API Calls
GET /api/earnings/summary
no required fields
Earnings widget data
GET /api/notifications
no required fields
Notification bell count
GET /api/bookings
no required fields
Upcoming bookings
GET /api/earnings/platform-stats
no required fields
Admin only: platform revenue
PostgreSQL Tables
transactionsbookingsnotificationsuser_credits
Notion Sync
No Notion sync
Manage all bookings — requests, confirmed, completed Open page →
API Calls
GET /api/bookings
no required fields
List all bookings
POST /api/bookings/:id/confirm-payment
amount_received
Creates scene + earnings + costar detection → syncs to BOOKINGS_DB_ID
POST /api/bookings/:id/generate-callsheet
no required fields
Creates call sheet record
PUT /api/booking-system/requests/:id/respond
action=accept|decline
Updates booking status → notifies requester
PostgreSQL Tables
bookingsbooking_requestscall_sheetsscenestransactionsnotifications
Notion Sync
BOOKINGS_DB_IDBUSINESS_ALERTS_NOTION_DB_ID
Pay-per-message inbox — fans pay to send messages Open page →
API Calls
GET /api/dm/conversations
no required fields
List all conversations
POST /api/dm/check-cost
recipient_idmessage_type
Returns cost before fan sends
POST /api/dm/messages
recipient_idcontentmessage_type
Sends message, deducts fan credits
PostgreSQL Tables
messagesconversationsuser_creditstransactionsnotifications
Notion Sync
No Notion sync
Performer earnings history, payout requests, scene breakdown Open page →
API Calls
GET /api/earnings/comparison
no required fields
SextPanther-style earnings widget
GET /api/bookings/scenes/summary
no required fields
Breakdown by mainstream/self/funded
POST /api/payouts/request
amountmethod
Creates payout request → syncs to PAYOUT_HISTORY_DB_ID
GET /api/earnings/platform-stats
no required fields
Admin: platform fee revenue
PostgreSQL Tables
transactionsearningspayout_requestspayout_transferspayout_periods
Notion Sync
EARNINGS_DB_IDPAYOUT_HISTORY_DB_ID
Payout method setup — Stripe Connect bank account Open page →
API Calls
POST /api/payments/stripe/connect-link
no required fields
Generates Stripe Connect onboarding URL
GET /api/payments/stripe/status
no required fields
Checks if charges/payouts enabled
PostgreSQL Tables
userspayment_methods
Notion Sync
No Notion sync
All user preferences — pricing, privacy, notifications, payout Open page →
API Calls
GET /api/settings
no required fields
Load all settings (JSONB from users table)
PUT /api/settings
any settings fields
Deep merge save to users.settings JSONB
GET/PUT /api/settings/pricing
all rate fields
Dedicated pricing columns on users table
GET/PUT /api/settings/online-status
online_modeindustry_status
Saves to users.online_mode + users.industry_status columns
PostgreSQL Tables
usersuser_settingsnotification_preferences
Notion Sync
No Notion sync
Performer safety — check-in, panic button, trip logging, geo-blocking Open page →
API Calls
POST /api/safety-v2/trips
tripNametripFlighttripHoteltripEvent
Creates trip record for safety tracking
POST /api/safety-v2/panic
no required fields
CRITICAL: sends alert to emergency contacts + SAFETY_ALERTS_NOTION_DB_ID + [email protected]
POST /api/safety-v2/emergency-contacts
namephoneemail
Saves emergency contact
PostgreSQL Tables
safety_check_instravel_tripsemergency_contactssafety_incidents
Notion Sync
SAFETY_ALERTS_NOTION_DB_ID
Live cam shows — setup, start, manage viewers, tips Open page →
API Calls
POST /api/cam/rooms
titleratetype
Creates cam room
POST /api/video-calls/start
session_id
Creates Daily.co room → returns join URL with tokens
PostgreSQL Tables
cam_roomscam_viewer_sessionscam_tipsvideo_call_sessions
Notion Sync
No Notion sync
Financial Hub — transaction history, Notion sync, expense tracking Open page →
API Calls
GET /api/financial/transactions
no required fields
All transactions from PostgreSQL
POST /api/financial/sync-database
database_id
Syncs a user-connected Notion DB into transactions table
GET /api/fee-splits
no required fields
Payments owed to agents/studios
POST /api/fee-splits/:id/send
no required fields
Stripe transfer to agent Connect account
PostgreSQL Tables
transactionsexpensesconnected_notion_databasesfee_splits
Notion Sync
EARNINGS_DB_IDuser-connected DBs (variable)
Unified inbox — requests, bookings, messages, system alerts Open page →
API Calls
GET /api/inbox
no required fields
All inbox items across types
GET /api/error-tracking/all
no required fields
System tab: all platform errors since launch
PUT /api/error-tracking/resolve
error_id
Mark error resolved → updates Notion error DB
PostgreSQL Tables
notificationsbooking_requestscustom_requestsmessagesclient_errors
Notion Sync
NOTIFICATIONS_DB_IDERROR_TRACKING_NOTION_DB_ID
Scene filmography — mainstream, self-produced, funded scenes Open page →
API Calls
GET /api/filmography
no required fields
All scenes/films for user
PUT /api/filmography/:id/correct
titlestudiodescription
Corrects scene info → logs to change_trail → notifies tagged performers
POST /api/scenes/flag-tube-site
tube_site_urlissue_type
Logs to content_reports → alerts admin
GET /api/scenes/:id/comments
no required fields
Fan comments on this scene
PostgreSQL Tables
filmsfilm_performerssceneschange_trailcontent_reportscomments
Notion Sync
No Notion sync

Part 2 — Notion Database Property Maps

For each Notion database: the exact property names, types, and what data they hold.
Red rows = CRITICAL — renaming or deleting these properties will break the sync route.
Green rows = optional — can be renamed or removed without breaking anything.

Users

Current ID: 263b8641-18fc-8077-8823-e7b4a8354c78
ENV VAR: USERS_DB_ID
CRITICAL DB
Written by: db/comprehensive-sync.js → syncCompleteUserData()
Triggered by: Every new signup (POST /api/auth/register), every login
Breaking the ID in .env will stop all syncs to this DB
Property NameTypeRequired?Data Source
Full NametitleREQUIREDusers.display_name
EmailemailREQUIREDusers.email
User TypeselectREQUIREDusers.role
Values: performer, fan, agent, studio, admin
StatusselectREQUIREDusers.is_active
Values: active, inactive
Joined DatedateREQUIREDusers.created_at
Permanent Profile URLurloptionalusers.permanent_profile_url
Username URLurloptionalusers.username
Birthdaydateoptionalusers.birthday
Phonephoneoptionalusers.phone
Stage Name / Business Namerich_textoptionalusers.bio
Websiteurloptionalusers.website
Addressrich_textoptionalusers.address
Cityrich_textoptionalusers.city
Stateselectoptionalusers.state
ZIP Coderich_textoptionalusers.zip_code
Countryselectoptionalusers.country
Last Contact Datedateoptionalusers.last_login
Credit Balancenumberoptionalcalculated earnings
Social Media Linksrich_textoptionalsocial_accounts table
Password Hashrich_textoptionalusers.password_hash (truncated, admin only)

How to Reconnect After Moving This Database

  1. In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
  2. On the server, edit /home/work/.openclaw/workspace/platform-server/.env
  3. Find the line: USERS_DB_ID=<old-id>
  4. Replace with: USERS_DB_ID=<new-id>
  5. The new Notion database must have these exact property names (critical ones marked above)
  6. Run: pm2 restart platform-server
  7. Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
USERS_DB_ID=263b8641-18fc-8077-8823-e7b4a8354c78

Error Tracking

Current ID: 36ab8641-18fc-81a6-9c49-d073412d8453
ENV VAR: ERROR_TRACKING_NOTION_DB_ID
CRITICAL DB
Written by: db/notion-error-sync.js, db/alert-sync.js
Triggered by: Error tracking endpoints, cron error digest
Property NameTypeRequired?Data Source
DatetitleREQUIREDtoday date string
Total ErrorsnumberREQUIREDclient_errors count
Auto-Fixednumberoptionalauto_fix_successful count
Needs Attentionnumberoptionalopen errors count
Not Attemptednumberoptionalunresolved count
StatusselectREQUIREDcomputed
Values: All Clear, Issues
Summaryrich_textoptionalerror summary text
Last UpdateddateoptionalNOW()
Top Errorsrich_textoptionaltop error messages
Platform URLurloptionalPLATFORM_URL env var

How to Reconnect After Moving This Database

  1. In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
  2. On the server, edit /home/work/.openclaw/workspace/platform-server/.env
  3. Find the line: ERROR_TRACKING_NOTION_DB_ID=<old-id>
  4. Replace with: ERROR_TRACKING_NOTION_DB_ID=<new-id>
  5. The new Notion database must have these exact property names (critical ones marked above)
  6. Run: pm2 restart platform-server
  7. Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
ERROR_TRACKING_NOTION_DB_ID=36ab8641-18fc-81a6-9c49-d073412d8453

Safety Alerts

Current ID: 36bb8641-18fc-81cf-98d4-ec9c581b95aa
ENV VAR: SAFETY_ALERTS_NOTION_DB_ID
CRITICAL DB
Written by: db/alert-sync.js → safety()
Triggered by: POST /api/safety-v2/panic, safety check-in issues
Property NameTypeRequired?Data Source
NametitleREQUIREDauto-generated: type + performer + datetime
TypeselectREQUIREDalert type
Values: Panic Button, Check-in Missed, Location Alert
StatusselectREQUIREDcomputed
Values: Active, Resolved
Performerrich_textREQUIREDuser display_name
Locationrich_textoptionalbooking location
SeverityselectREQUIREDcomputed
Values: Critical, High, Medium, Low
Email Sentcheckboxoptionalwhether email fired
DatedateREQUIREDNOW()
Notesrich_textoptionalalert details

How to Reconnect After Moving This Database

  1. In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
  2. On the server, edit /home/work/.openclaw/workspace/platform-server/.env
  3. Find the line: SAFETY_ALERTS_NOTION_DB_ID=<old-id>
  4. Replace with: SAFETY_ALERTS_NOTION_DB_ID=<new-id>
  5. The new Notion database must have these exact property names (critical ones marked above)
  6. Run: pm2 restart platform-server
  7. Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
SAFETY_ALERTS_NOTION_DB_ID=36bb8641-18fc-81cf-98d4-ec9c581b95aa

Business Alerts

Current ID: 36bb8641-18fc-818b-a097-ccf3a94ec7ed
ENV VAR: BUSINESS_ALERTS_NOTION_DB_ID
SAFE TO MOVE
Written by: db/alert-sync.js → business(), earning()
Triggered by: New booking requests, earnings confirmed, payment events
Property NameTypeRequired?Data Source
NametitleREQUIREDauto-generated: type + user + datetime
TypeselectREQUIREDalert type
Values: Booking Request, New Order, Earning, Payout
StatusselectREQUIREDcomputed
Values: New, Actioned, Dismissed
Amountnumberoptionaltransaction amount
Userrich_textoptionaluser display_name or email
Email Sentcheckboxoptionalwhether email fired
DatedateREQUIREDNOW()
Detailsrich_textoptionalalert detail text

How to Reconnect After Moving This Database

  1. In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
  2. On the server, edit /home/work/.openclaw/workspace/platform-server/.env
  3. Find the line: BUSINESS_ALERTS_NOTION_DB_ID=<old-id>
  4. Replace with: BUSINESS_ALERTS_NOTION_DB_ID=<new-id>
  5. The new Notion database must have these exact property names (critical ones marked above)
  6. Run: pm2 restart platform-server
  7. Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
BUSINESS_ALERTS_NOTION_DB_ID=36bb8641-18fc-818b-a097-ccf3a94ec7ed

Bookings & Requests

Current ID: 36bb8641-18fc-8155-bdc6-ee5917b317a1
ENV VAR: BOOKINGS_DB_ID
SAFE TO MOVE
Written by: db/alert-sync.js → booking(), routes/notion-writeback.js
Triggered by: New booking requests, booking status changes
Property NameTypeRequired?Data Source
NametitleREQUIREDbooking title or type
TypeselectREQUIREDbookings.booking_type
StatusselectREQUIREDbookings.status
Values: Pending, Confirmed, Completed, Cancelled
Fan/Clientrich_textoptionalrequester name
Amountnumberoptionalbookings.rate
Datedateoptionalbookings.event_date
Notesrich_textoptionalbooking notes/description

How to Reconnect After Moving This Database

  1. In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
  2. On the server, edit /home/work/.openclaw/workspace/platform-server/.env
  3. Find the line: BOOKINGS_DB_ID=<old-id>
  4. Replace with: BOOKINGS_DB_ID=<new-id>
  5. The new Notion database must have these exact property names (critical ones marked above)
  6. Run: pm2 restart platform-server
  7. Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
BOOKINGS_DB_ID=36bb8641-18fc-8155-bdc6-ee5917b317a1

Earnings & Payments

Current ID: 36bb8641-18fc-819f-9d66-f72326818d4c
ENV VAR: EARNINGS_DB_ID
SAFE TO MOVE
Written by: db/alert-sync.js → earning(), scripts/sync-platform-stats.js
Triggered by: Payment confirmed, payout processed, Stripe webhook events
Property NameTypeRequired?Data Source
NametitleREQUIREDauto-generated: type + user + datetime
TypeselectREQUIREDtransaction type
Values: New Order, Stripe Payment, Payout Processed
AmountnumberREQUIREDtransaction amount
StatusselectREQUIREDcomputed
Values: Pending, Received, Actioned
Platformrich_textoptionalsource platform name
DatedateREQUIREDtransaction date
Detailsrich_textoptionalearning detail text

How to Reconnect After Moving This Database

  1. In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
  2. On the server, edit /home/work/.openclaw/workspace/platform-server/.env
  3. Find the line: EARNINGS_DB_ID=<old-id>
  4. Replace with: EARNINGS_DB_ID=<new-id>
  5. The new Notion database must have these exact property names (critical ones marked above)
  6. Run: pm2 restart platform-server
  7. Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
EARNINGS_DB_ID=36bb8641-18fc-819f-9d66-f72326818d4c

Notifications

Current ID: 36bb8641-18fc-8182-beec-d9a04151ec3f
ENV VAR: NOTIFICATIONS_DB_ID
SAFE TO MOVE
Written by: db/alert-sync.js → notification()
Triggered by: System notifications, user-facing alerts
Property NameTypeRequired?Data Source
NametitleREQUIREDnotification title
TypeselectREQUIREDnotification type
StatusselectREQUIREDcomputed
Values: Unread, Read
Bodyrich_textoptionalnotification body text
DatedateREQUIREDNOW()

How to Reconnect After Moving This Database

  1. In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
  2. On the server, edit /home/work/.openclaw/workspace/platform-server/.env
  3. Find the line: NOTIFICATIONS_DB_ID=<old-id>
  4. Replace with: NOTIFICATIONS_DB_ID=<new-id>
  5. The new Notion database must have these exact property names (critical ones marked above)
  6. Run: pm2 restart platform-server
  7. Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
NOTIFICATIONS_DB_ID=36bb8641-18fc-8182-beec-d9a04151ec3f

Support & Reports

Current ID: 36bb8641-18fc-8110-ac47-dc4e98492402
ENV VAR: SUPPORT_DB_ID
SAFE TO MOVE
Written by: db/alert-sync.js → support()
Triggered by: Support ticket creation, user reports, DMCA
Property NameTypeRequired?Data Source
NametitleREQUIREDticket subject
TypeselectREQUIREDticket category
StatusselectREQUIREDticket status
Values: Open, In Progress, Resolved, Closed
Userrich_textoptionalsubmitter email/name
Priorityselectoptionalcomputed
Values: Low, Medium, High, Critical
Detailsrich_textoptionalticket description
DatedateREQUIREDNOW()

How to Reconnect After Moving This Database

  1. In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
  2. On the server, edit /home/work/.openclaw/workspace/platform-server/.env
  3. Find the line: SUPPORT_DB_ID=<old-id>
  4. Replace with: SUPPORT_DB_ID=<new-id>
  5. The new Notion database must have these exact property names (critical ones marked above)
  6. Run: pm2 restart platform-server
  7. Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
SUPPORT_DB_ID=36bb8641-18fc-8110-ac47-dc4e98492402

Payout History

Current ID: 36bb8641-18fc-8124-ba24-e373f4c2b319
ENV VAR: PAYOUT_HISTORY_DB_ID
SAFE TO MOVE
Written by: routes/payouts.js, Stripe webhook handler
Triggered by: Payout requested, Stripe transfer.paid, payout.failed
Property NameTypeRequired?Data Source
NametitleREQUIREDauto-generated: Payout + amount + date
AmountnumberREQUIREDpayout_requests.amount
Net Amountnumberoptionalpayout_requests.net_amount
Feenumberoptionalpayout_requests.fee
StatusselectREQUIREDpayout status
Values: Pending, Completed, Failed
Transaction IDrich_textoptionalStripe transfer ID
DatedateREQUIREDpayout date

How to Reconnect After Moving This Database

  1. In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
  2. On the server, edit /home/work/.openclaw/workspace/platform-server/.env
  3. Find the line: PAYOUT_HISTORY_DB_ID=<old-id>
  4. Replace with: PAYOUT_HISTORY_DB_ID=<new-id>
  5. The new Notion database must have these exact property names (critical ones marked above)
  6. Run: pm2 restart platform-server
  7. Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
PAYOUT_HISTORY_DB_ID=36bb8641-18fc-8124-ba24-e373f4c2b319

Platform Stats

Current ID: 36bb8641-18fc-81f9-a98c-f1afd463c32e
ENV VAR: PLATFORM_STATS_DB_ID
SAFE TO MOVE
Written by: scripts/sync-platform-stats.js
Triggered by: Daily cron, morning summary
Property NameTypeRequired?Data Source
NametitleREQUIREDPeriod + date string
PeriodselectREQUIREDDaily/Monthly/All-Time
DatedateREQUIREDstat date
Customer Spentnumberoptionaltransactions sum
Your Earnings (Performer)numberoptionalperformer net earnings
Your Platform Fees (Admin)numberoptionalplatform 15% fees
Total to Younumberoptionalperformer + admin total
To Other Performersnumberoptionalother performers payouts
Transactionsnumberoptionaltransaction count
Tipsnumberoptionaltips sum
Subscriptionsnumberoptionalsubscriptions sum
Bookingsnumberoptionalbookings sum
Custom Videosnumberoptionalcustom requests sum
Active Performersnumberoptionalusers with earnings
New Customersnumberoptionalnew paying users
Platform Linkurloptionalearnings page URL

How to Reconnect After Moving This Database

  1. In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
  2. On the server, edit /home/work/.openclaw/workspace/platform-server/.env
  3. Find the line: PLATFORM_STATS_DB_ID=<old-id>
  4. Replace with: PLATFORM_STATS_DB_ID=<new-id>
  5. The new Notion database must have these exact property names (critical ones marked above)
  6. Run: pm2 restart platform-server
  7. Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
PLATFORM_STATS_DB_ID=36bb8641-18fc-81f9-a98c-f1afd463c32e

Connected Accounts

Current ID: 367b8641-18fc-8198-8f58-d8af5e9d99ab
ENV VAR: CONNECTED_ACCOUNTS_DB_ID
SAFE TO MOVE
Written by: db/notion-tracking-sync.js → syncConnectedAccount()
Triggered by: User connects an external platform (OnlyFans, SextPanther, etc.)
Property NameTypeRequired?Data Source
NametitleREQUIREDauto: user + platform
Userrich_textREQUIREDusers.email
PlatformselectREQUIREDplatform name
Platform Usernamerich_textoptionalplatform handle
Platform User IDrich_textoptionalplatform user id
Connected Datedateoptionalconnection date
StatusselectREQUIREDactive/inactive

How to Reconnect After Moving This Database

  1. In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
  2. On the server, edit /home/work/.openclaw/workspace/platform-server/.env
  3. Find the line: CONNECTED_ACCOUNTS_DB_ID=<old-id>
  4. Replace with: CONNECTED_ACCOUNTS_DB_ID=<new-id>
  5. The new Notion database must have these exact property names (critical ones marked above)
  6. Run: pm2 restart platform-server
  7. Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
CONNECTED_ACCOUNTS_DB_ID=367b8641-18fc-8198-8f58-d8af5e9d99ab

Activity Log

Current ID: 367b8641-18fc-8191-9706-e905b99d5438
ENV VAR: ACTIVITY_LOG_DB_ID
SAFE TO MOVE
Written by: db/notion-tracking-sync.js → syncActivityToNotion()
Triggered by: User login, key user actions
Property NameTypeRequired?Data Source
ActivitytitleREQUIREDaction description
Userrich_textREQUIREDusers.email
Activity TypeselectREQUIREDlogin/signup/action
TimestampdateREQUIREDNOW()

How to Reconnect After Moving This Database

  1. In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
  2. On the server, edit /home/work/.openclaw/workspace/platform-server/.env
  3. Find the line: ACTIVITY_LOG_DB_ID=<old-id>
  4. Replace with: ACTIVITY_LOG_DB_ID=<new-id>
  5. The new Notion database must have these exact property names (critical ones marked above)
  6. Run: pm2 restart platform-server
  7. Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
ACTIVITY_LOG_DB_ID=367b8641-18fc-8191-9706-e905b99d5438

Part 3 — Backend → Backend Connections

Internal service connections between server components.

Key Internal Dependencies
server.js → loads all routes via routes/_register.js
routes/_register.js → registers all 190+ route files, passes db + notion client to each
db/client.js → PostgreSQL pool, exported as getDb(req) or app.locals.db
db/comprehensive-sync.js → called by routes/auth.js on every signup → writes to USERS_DB_ID
db/alert-sync.js → called by 10+ routes when events occur → writes to 7 Notion DBs
db/notion-error-sync.js → called by cron (every 6h) → writes to ERROR_TRACKING_NOTION_DB_ID
db/notion-tracking-sync.js → called on login + connected account actions → writes to ACTIVITY_LOG_DB_ID, CONNECTED_ACCOUNTS_DB_ID
scripts/sync-platform-stats.js → cron daily → writes to PLATFORM_STATS_DB_ID + EARNINGS_DB_ID
scripts/morning-summary.js → cron 8am → creates Notion page + sends email
middleware/notion-client.js → Notion API wrapper used by all routes

Stripe: routes/payments.js + routes/payouts.js → Stripe API → webhooks received at POST /api/payments/stripe/webhook
Daily.co: routes/video-calls.js → creates rooms + tokens per session
Twilio: routes/phone-notifications.js → SMS for safety alerts
Google OAuth: routes/auth.js → Google userinfo API for token verification

Part 4 — What Can Safely Change vs What Will Break

WILL BREAK if changed:
— Notion DB property names marked REQUIRED in Part 2 above
— .env variable names (USERS_DB_ID, ERROR_TRACKING_NOTION_DB_ID, etc.) — these are hardcoded references
— PostgreSQL table names (users, transactions, bookings, notifications, etc.)
— PostgreSQL column names that routes query directly (users.email, users.role, transactions.amount, etc.)
— The route prefix paths in routes/_register.js (e.g. /api/auth, /api/bookings)

SAFE to change:
— Notion DB IDs (just update the .env file with the new ID and restart)
— Optional Notion property names (marked optional above) — sync will skip them gracefully
— Adding NEW properties to Notion DBs — the sync code ignores unknown properties
— Moving a Notion DB to a different Notion page/section — ID stays the same
— Duplicating a Notion DB template — the duplicate gets a new ID, update .env
— Adding new PostgreSQL tables (won't affect existing routes)
— Adding new columns to PostgreSQL tables (old routes ignore new columns)