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.
Part 1 — Frontend → Backend → Database Connections
How each page connects to the API and which database tables are involved.
API Calls
POST /api/auth/registerfirstNamelastNameusernameemailpasswordrole=fan
Creates row in users table → syncs to USERS_DB_ID Notion
PostgreSQL Tables
usersuser_credits
Notion Sync
USERS_DB_ID
API Calls
POST /api/auth/loginemailpassword
Returns JWT token stored in localStorage
GET /api/auth/meAuthorization header
Validates token, returns user object
POST /api/auth/oauthprovider=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/summaryno required fields
Earnings widget data
GET /api/notificationsno required fields
Notification bell count
GET /api/bookingsno required fields
Upcoming bookings
GET /api/earnings/platform-statsno 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/bookingsno required fields
List all bookings
POST /api/bookings/:id/confirm-paymentamount_received
Creates scene + earnings + costar detection → syncs to BOOKINGS_DB_ID
POST /api/bookings/:id/generate-callsheetno required fields
Creates call sheet record
PUT /api/booking-system/requests/:id/respondaction=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/conversationsno required fields
List all conversations
POST /api/dm/check-costrecipient_idmessage_type
Returns cost before fan sends
POST /api/dm/messagesrecipient_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/comparisonno required fields
SextPanther-style earnings widget
GET /api/bookings/scenes/summaryno required fields
Breakdown by mainstream/self/funded
POST /api/payouts/requestamountmethod
Creates payout request → syncs to PAYOUT_HISTORY_DB_ID
GET /api/earnings/platform-statsno 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-linkno required fields
Generates Stripe Connect onboarding URL
GET /api/payments/stripe/statusno 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/settingsno required fields
Load all settings (JSONB from users table)
PUT /api/settingsany settings fields
Deep merge save to users.settings JSONB
GET/PUT /api/settings/pricingall rate fields
Dedicated pricing columns on users table
GET/PUT /api/settings/online-statusonline_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/tripstripNametripFlighttripHoteltripEvent
Creates trip record for safety tracking
POST /api/safety-v2/panicno required fields
CRITICAL: sends alert to emergency contacts + SAFETY_ALERTS_NOTION_DB_ID +
[email protected]
POST /api/safety-v2/emergency-contactsnamephoneemail
Saves emergency contact
PostgreSQL Tables
safety_check_instravel_tripsemergency_contactssafety_incidents
Notion Sync
SAFETY_ALERTS_NOTION_DB_ID
Model releases — bilateral 2257 compliance between performers
Open page →
API Calls
GET /api/model-releasesno required fields
List model releases
POST /api/model-releasescostar_idcontent_typenotes
Creates bilateral release → notifies costar → syncs to LEGAL_DB_ID
PUT /api/model-releases/:id/signno required fields
Costar signs → fully executed → both notified
PostgreSQL Tables
model_releasesnotificationsrecords_2257
Notion Sync
LEGAL_DB_ID
Live cam shows — setup, start, manage viewers, tips
Open page →
API Calls
POST /api/cam/roomstitleratetype
Creates cam room
POST /api/video-calls/startsession_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/transactionsno required fields
All transactions from PostgreSQL
POST /api/financial/sync-databasedatabase_id
Syncs a user-connected Notion DB into transactions table
GET /api/fee-splitsno required fields
Payments owed to agents/studios
POST /api/fee-splits/:id/sendno 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/inboxno required fields
All inbox items across types
GET /api/error-tracking/allno required fields
System tab: all platform errors since launch
PUT /api/error-tracking/resolveerror_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/filmographyno required fields
All scenes/films for user
PUT /api/filmography/:id/correcttitlestudiodescription
Corrects scene info → logs to change_trail → notifies tagged performers
POST /api/scenes/flag-tube-sitetube_site_urlissue_type
Logs to content_reports → alerts admin
GET /api/scenes/:id/commentsno 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
| Property Name | Type | Required? | Data Source |
| Full Name | title | REQUIRED | users.display_name |
| Email | email | REQUIRED | users.email |
| User Type | select | REQUIRED | users.role Values: performer, fan, agent, studio, admin |
| Status | select | REQUIRED | users.is_active Values: active, inactive |
| Joined Date | date | REQUIRED | users.created_at |
| Permanent Profile URL | url | optional | users.permanent_profile_url |
| Username URL | url | optional | users.username |
| Birthday | date | optional | users.birthday |
| Phone | phone | optional | users.phone |
| Stage Name / Business Name | rich_text | optional | users.bio |
| Website | url | optional | users.website |
| Address | rich_text | optional | users.address |
| City | rich_text | optional | users.city |
| State | select | optional | users.state |
| ZIP Code | rich_text | optional | users.zip_code |
| Country | select | optional | users.country |
| Last Contact Date | date | optional | users.last_login |
| Credit Balance | number | optional | calculated earnings |
| Social Media Links | rich_text | optional | social_accounts table |
| Password Hash | rich_text | optional | users.password_hash (truncated, admin only) |
How to Reconnect After Moving This Database
- In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
- On the server, edit
/home/work/.openclaw/workspace/platform-server/.env
- Find the line:
USERS_DB_ID=<old-id>
- Replace with:
USERS_DB_ID=<new-id>
- The new Notion database must have these exact property names (critical ones marked above)
- Run:
pm2 restart platform-server
- 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 Name | Type | Required? | Data Source |
| Date | title | REQUIRED | today date string |
| Total Errors | number | REQUIRED | client_errors count |
| Auto-Fixed | number | optional | auto_fix_successful count |
| Needs Attention | number | optional | open errors count |
| Not Attempted | number | optional | unresolved count |
| Status | select | REQUIRED | computed Values: All Clear, Issues |
| Summary | rich_text | optional | error summary text |
| Last Updated | date | optional | NOW() |
| Top Errors | rich_text | optional | top error messages |
| Platform URL | url | optional | PLATFORM_URL env var |
How to Reconnect After Moving This Database
- In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
- On the server, edit
/home/work/.openclaw/workspace/platform-server/.env
- Find the line:
ERROR_TRACKING_NOTION_DB_ID=<old-id>
- Replace with:
ERROR_TRACKING_NOTION_DB_ID=<new-id>
- The new Notion database must have these exact property names (critical ones marked above)
- Run:
pm2 restart platform-server
- 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 Name | Type | Required? | Data Source |
| Name | title | REQUIRED | auto-generated: type + performer + datetime |
| Type | select | REQUIRED | alert type Values: Panic Button, Check-in Missed, Location Alert |
| Status | select | REQUIRED | computed Values: Active, Resolved |
| Performer | rich_text | REQUIRED | user display_name |
| Location | rich_text | optional | booking location |
| Severity | select | REQUIRED | computed Values: Critical, High, Medium, Low |
| Email Sent | checkbox | optional | whether email fired |
| Date | date | REQUIRED | NOW() |
| Notes | rich_text | optional | alert details |
How to Reconnect After Moving This Database
- In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
- On the server, edit
/home/work/.openclaw/workspace/platform-server/.env
- Find the line:
SAFETY_ALERTS_NOTION_DB_ID=<old-id>
- Replace with:
SAFETY_ALERTS_NOTION_DB_ID=<new-id>
- The new Notion database must have these exact property names (critical ones marked above)
- Run:
pm2 restart platform-server
- 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 Name | Type | Required? | Data Source |
| Name | title | REQUIRED | auto-generated: type + user + datetime |
| Type | select | REQUIRED | alert type Values: Booking Request, New Order, Earning, Payout |
| Status | select | REQUIRED | computed Values: New, Actioned, Dismissed |
| Amount | number | optional | transaction amount |
| User | rich_text | optional | user display_name or email |
| Email Sent | checkbox | optional | whether email fired |
| Date | date | REQUIRED | NOW() |
| Details | rich_text | optional | alert detail text |
How to Reconnect After Moving This Database
- In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
- On the server, edit
/home/work/.openclaw/workspace/platform-server/.env
- Find the line:
BUSINESS_ALERTS_NOTION_DB_ID=<old-id>
- Replace with:
BUSINESS_ALERTS_NOTION_DB_ID=<new-id>
- The new Notion database must have these exact property names (critical ones marked above)
- Run:
pm2 restart platform-server
- 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 Name | Type | Required? | Data Source |
| Name | title | REQUIRED | booking title or type |
| Type | select | REQUIRED | bookings.booking_type |
| Status | select | REQUIRED | bookings.status Values: Pending, Confirmed, Completed, Cancelled |
| Fan/Client | rich_text | optional | requester name |
| Amount | number | optional | bookings.rate |
| Date | date | optional | bookings.event_date |
| Notes | rich_text | optional | booking notes/description |
How to Reconnect After Moving This Database
- In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
- On the server, edit
/home/work/.openclaw/workspace/platform-server/.env
- Find the line:
BOOKINGS_DB_ID=<old-id>
- Replace with:
BOOKINGS_DB_ID=<new-id>
- The new Notion database must have these exact property names (critical ones marked above)
- Run:
pm2 restart platform-server
- 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 Name | Type | Required? | Data Source |
| Name | title | REQUIRED | auto-generated: type + user + datetime |
| Type | select | REQUIRED | transaction type Values: New Order, Stripe Payment, Payout Processed |
| Amount | number | REQUIRED | transaction amount |
| Status | select | REQUIRED | computed Values: Pending, Received, Actioned |
| Platform | rich_text | optional | source platform name |
| Date | date | REQUIRED | transaction date |
| Details | rich_text | optional | earning detail text |
How to Reconnect After Moving This Database
- In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
- On the server, edit
/home/work/.openclaw/workspace/platform-server/.env
- Find the line:
EARNINGS_DB_ID=<old-id>
- Replace with:
EARNINGS_DB_ID=<new-id>
- The new Notion database must have these exact property names (critical ones marked above)
- Run:
pm2 restart platform-server
- 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 Name | Type | Required? | Data Source |
| Name | title | REQUIRED | notification title |
| Type | select | REQUIRED | notification type |
| Status | select | REQUIRED | computed Values: Unread, Read |
| Body | rich_text | optional | notification body text |
| Date | date | REQUIRED | NOW() |
How to Reconnect After Moving This Database
- In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
- On the server, edit
/home/work/.openclaw/workspace/platform-server/.env
- Find the line:
NOTIFICATIONS_DB_ID=<old-id>
- Replace with:
NOTIFICATIONS_DB_ID=<new-id>
- The new Notion database must have these exact property names (critical ones marked above)
- Run:
pm2 restart platform-server
- 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 Name | Type | Required? | Data Source |
| Name | title | REQUIRED | ticket subject |
| Type | select | REQUIRED | ticket category |
| Status | select | REQUIRED | ticket status Values: Open, In Progress, Resolved, Closed |
| User | rich_text | optional | submitter email/name |
| Priority | select | optional | computed Values: Low, Medium, High, Critical |
| Details | rich_text | optional | ticket description |
| Date | date | REQUIRED | NOW() |
How to Reconnect After Moving This Database
- In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
- On the server, edit
/home/work/.openclaw/workspace/platform-server/.env
- Find the line:
SUPPORT_DB_ID=<old-id>
- Replace with:
SUPPORT_DB_ID=<new-id>
- The new Notion database must have these exact property names (critical ones marked above)
- Run:
pm2 restart platform-server
- 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
Legal & Compliance
Current ID: 36bb8641-18fc-8170-a5ac-eb21c10c1f03
ENV VAR: LEGAL_DB_ID
SAFE TO MOVE
Written by: db/alert-sync.js → legal(), routes/model-releases.js
Triggered by: Model release signed, legal document created
| Property Name | Type | Required? | Data Source |
| Name | title | REQUIRED | document title |
| Type | select | REQUIRED | document type Values: Model Release, Contract, DMCA, TOS |
| Status | select | REQUIRED | computed Values: Pending, Signed, Expired |
| Parties | rich_text | optional | performer names involved |
| Date | date | REQUIRED | document date |
| Notes | rich_text | optional | document notes |
How to Reconnect After Moving This Database
- In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
- On the server, edit
/home/work/.openclaw/workspace/platform-server/.env
- Find the line:
LEGAL_DB_ID=<old-id>
- Replace with:
LEGAL_DB_ID=<new-id>
- The new Notion database must have these exact property names (critical ones marked above)
- Run:
pm2 restart platform-server
- Test by triggering the action that writes to this DB (e.g. create a test user for USERS_DB_ID)
LEGAL_DB_ID=36bb8641-18fc-8170-a5ac-eb21c10c1f03
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 Name | Type | Required? | Data Source |
| Name | title | REQUIRED | auto-generated: Payout + amount + date |
| Amount | number | REQUIRED | payout_requests.amount |
| Net Amount | number | optional | payout_requests.net_amount |
| Fee | number | optional | payout_requests.fee |
| Status | select | REQUIRED | payout status Values: Pending, Completed, Failed |
| Transaction ID | rich_text | optional | Stripe transfer ID |
| Date | date | REQUIRED | payout date |
How to Reconnect After Moving This Database
- In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
- On the server, edit
/home/work/.openclaw/workspace/platform-server/.env
- Find the line:
PAYOUT_HISTORY_DB_ID=<old-id>
- Replace with:
PAYOUT_HISTORY_DB_ID=<new-id>
- The new Notion database must have these exact property names (critical ones marked above)
- Run:
pm2 restart platform-server
- 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
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 Name | Type | Required? | Data Source |
| Name | title | REQUIRED | auto: user + platform |
| User | rich_text | REQUIRED | users.email |
| Platform | select | REQUIRED | platform name |
| Platform Username | rich_text | optional | platform handle |
| Platform User ID | rich_text | optional | platform user id |
| Connected Date | date | optional | connection date |
| Status | select | REQUIRED | active/inactive |
How to Reconnect After Moving This Database
- In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
- On the server, edit
/home/work/.openclaw/workspace/platform-server/.env
- Find the line:
CONNECTED_ACCOUNTS_DB_ID=<old-id>
- Replace with:
CONNECTED_ACCOUNTS_DB_ID=<new-id>
- The new Notion database must have these exact property names (critical ones marked above)
- Run:
pm2 restart platform-server
- 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 Name | Type | Required? | Data Source |
| Activity | title | REQUIRED | action description |
| User | rich_text | REQUIRED | users.email |
| Activity Type | select | REQUIRED | login/signup/action |
| Timestamp | date | REQUIRED | NOW() |
How to Reconnect After Moving This Database
- In Notion, open the new database and copy its ID from the URL (the 32-character hex string)
- On the server, edit
/home/work/.openclaw/workspace/platform-server/.env
- Find the line:
ACTIVITY_LOG_DB_ID=<old-id>
- Replace with:
ACTIVITY_LOG_DB_ID=<new-id>
- The new Notion database must have these exact property names (critical ones marked above)
- Run:
pm2 restart platform-server
- 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)