SERVERS
Server :3010 (ai.js)
Server :3001 (app.js)
app.jsMounts (14)
-
/users→ ./routes/user -
/language→ ./routes/language -
/component→ ./routes/component -
/settings→ ./routes/settings -
/tarot→ ./routes/tarot -
/help→ ./routes/help -
/forecasts→ ./routes/forecasts.js -
/products→ ./routes/products.js -
/traits→ ./routes/traits -
/payments→ ./routes/payments -
/journals→ ./routes/journals -
/affiliate→ ./routes/affiliates.js -
/events/metrics→ ./routes/metrics -
/ai→ ./routes/ai
Server :3012 (message.js)
message.jsMounts (1)
-
/messages→ ./routes/messages
Server :3003 (metrics-server.js)
metrics-server.jsServer :3111 (paypal.js)
paypal.jsServer :3008 (user.js)
MOUNTS
/ai
→ ./routes/ai
/ai./routes/aiai.jsRoutes (6)
- GET /
- POST /completion
- POST /getpracticaltips
- POST /calculatereport
- GET /asktarotoracle
- POST /generateDataReport
/admin
→ ./routes/admin
/admin./routes/adminai.jsNo routes found
/users
→ ./routes/user
/users./routes/userapp.jsRoutes (37)
- GET /findUser
- GET /switchAccount
- GET /GetAllUsers
- GET /migratejob
- POST /start-migration
- POST /erase
- DELETE /remove
- DELETE /removeaccount/:id
- DELETE /removeaccount
- GET /update-uids-to-lowercase
- GET /user-count
- GET /find-duplicates
- GET /checkpassword/:id
- PUT /setMainUser/:profileId
- PUT /edit/:id
- POST /user/Login
- POST /adduser
- GET /getUsersID/:profileId
- GET /getUsersID/:profileId
- GET /connectedUsers/:uid
- GET /handle/available
- POST /handle/update
- POST /verifyprofile
- POST /addprofile
- GET /log/error
- POST /IncrementLog
- POST /log/posterror
- GET /find/user
- GET /new/start
- GET /new/complete
- GET /store/user
- GET /count/user
- GET /count/profile
- PUT /toggleProfile/:uid
- POST /send-deletion-code
- POST /confirm-deletion
- GET /
/language
→ ./routes/language
/component
→ ./routes/component
/component./routes/componentapp.jsRoutes (13)
- GET /Delete
- POST /Update
- GET /FlushDelete
- GET /CheckForDuplicateKeys
- GET /UpdateServerComponent
- GET /CleanUpComponents
- GET /GetLanguageTable
- GET /TranslateItems
- GET /GetLanguageItem
- GET /GetComponentTraits/:component/:componentCategory
- GET /GetComponent
- GET /GetCategory
- GET /GetCategoryItems
/settings
→ ./routes/settings
/settings./routes/settingsapp.jsRoutes (6)
- GET /get/:id
- GET /get
- GET /test
- GET /ads-threshold
- GET /ads-interval
- GET /ads-configs
/tarot
→ ./routes/tarot
/tarot./routes/tarotapp.jsRoutes (7)
- GET /get
- POST /addSpread
- POST /updateSpread/:id
- GET /createTarotSpreads
- GET /test2
- GET /test
- GET /getTarotSpreads
/help
→ ./routes/help
/forecasts
→ ./routes/forecasts.js
/forecasts./routes/forecasts.jsapp.jsRoutes (5)
- GET /flush
- GET /get
- GET /getForecasts
- GET /get
- GET /getall
/products
→ ./routes/products.js
/products./routes/products.jsapp.jsRoutes (11)
- GET /flush
- GET /all
- GET /specialvideo
- GET /videos
- GET /allvideos
- GET /getAd
- GET /getVideoAd
- GET /getAdSummary
- GET /getAllAd
- POST /updateAd
- GET /addproducts
/traits
→ ./routes/traits
/traits./routes/traitsapp.jsRoutes (14)
- GET /
- POST /completion
- POST /getpracticaltips
- POST /calculatereport
- GET /asktarotoracle
- POST /generateDataReport
- GET /GetTraits
- GET /GetTraits/:id
- POST /AddTraits
- POST /UpdateTraitsByName
- PUT /UpdateTraits/:id
- DELETE /DeleteTraits/:id
- GET /GetComponentTraits
- POST /AddComponentTraits
/payments
→ ./routes/payments
/payments./routes/paymentsapp.jsNo routes found
/journals
→ ./routes/journals
/affiliate
→ ./routes/affiliates.js
/affiliate./routes/affiliates.jsapp.jsRoutes (10)
- GET /a
- POST /click
- GET /a/resolve
- POST /click/install
- GET /getAffiliateCodes
- GET /getAllAffiliates
- GET /getAffiliateClicks
- POST /saveAffiliate
- GET /getAffiliateStats
- GET /getAffiliatePayments
/events/metrics
→ ./routes/metrics
/events/metrics./routes/metricsapp.jsRoutes (4)
- GET /
- POST /updateMetric
- POST /pingonline
- GET /usersonline
/ai
→ ./routes/ai
/ai./routes/aiapp.jsRoutes (6)
- GET /
- POST /completion
- POST /getpracticaltips
- POST /calculatereport
- GET /asktarotoracle
- POST /generateDataReport
/messages
→ ./routes/messages
/messages./routes/messagesmessage.jsRoutes (6)
/users
→ ./routes/user
/users./routes/useruser.jsRoutes (37)
- GET /findUser
- GET /switchAccount
- GET /GetAllUsers
- GET /migratejob
- POST /start-migration
- POST /erase
- DELETE /remove
- DELETE /removeaccount/:id
- DELETE /removeaccount
- GET /update-uids-to-lowercase
- GET /user-count
- GET /find-duplicates
- GET /checkpassword/:id
- PUT /setMainUser/:profileId
- PUT /edit/:id
- POST /user/Login
- POST /adduser
- GET /getUsersID/:profileId
- GET /getUsersID/:profileId
- GET /connectedUsers/:uid
- GET /handle/available
- POST /handle/update
- POST /verifyprofile
- POST /addprofile
- GET /log/error
- POST /IncrementLog
- POST /log/posterror
- GET /find/user
- GET /new/start
- GET /new/complete
- GET /store/user
- GET /count/user
- GET /count/profile
- PUT /toggleProfile/:uid
- POST /send-deletion-code
- POST /confirm-deletion
- GET /
ROUTES
GET /
Returns a simple health check message to confirm the server is running.
/ai.jsReturns
200
string
GET /
Returns a simple health check message to confirm the server is running.
/app.jsReturns
200
text
- "Node Running"
GET /metrics
Exposes Prometheus metrics for scraping.
/metricsmetrics-server.jsReturns
200
metricsText:string
Throws
- 500
GET /
Exposes Prometheus metrics at the root path for convenience.
/metrics-server.jsReturns
200
metricsText:string
Throws
- 500
POST /metrics/updateMetric
Creates or updates a Prometheus gauge or counter metric.
/metrics/updateMetricmetrics-server.jsParameters
| Name | Type | Description |
|---|---|---|
name |
string, |
type:string, value:number, labels:object |
Returns
200
message:string
Throws
- 400 , 500
POST /metrics/pingonline
Records a user's online heartbeat to track active users.
/metrics/pingonlinemetrics-server.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string |
Returns
200
success:boolean, activeUsers:number
Throws
- 400
GET /metrics/usersonline
Returns the number of currently active users and updates a Prometheus gauge.
/metrics/usersonlinemetrics-server.jsReturns
200
activeUsers:number
GET /health
Simple health check endpoint that reports service is alive.
/healthmetrics-server.jsReturns
200
ok:boolean
GET /check
Sends a test email based on query parameters name and who.
/checkpaypal.jsParameters
| Name | Type | Description |
|---|---|---|
name |
string, |
who:string |
Returns
200
string
- "Paypal IPN Listener"
Throws
- 500
GET /
Returns a basic service status string.
/paypal.jsReturns
200
string
- "Paypal IPN Listener v5.5.0"
GET /sendtarotemails
Sends intro emails to buyers of the Tarot Deck who have no Intro set and marks them as sent.
/sendtarotemailspaypal.jsReturns
200
string
- concatenated names of recipients
Throws
- 500
Models Used
GET /all
Returns all Paypal payment records.
/allpaypal.jsReturns
200
Array<Paypal>
Throws
- 500
Models Used
GET /some
Retrieves Paypal records created within a specific month and year.
/somepaypal.jsParameters
| Name | Type | Description |
|---|---|---|
month |
number, |
year:number |
Returns
200
Array<Paypal>
Throws
- 500
Models Used
GET /get
Finds Paypal records by a custom identifier.
/getpaypal.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Array<Paypal>
Throws
- 500
Models Used
POST /update
Updates a Paypal record by _id and sends confirmation emails to buyer and reader.
/updatepaypal.jsParameters
| Name | Type | Description |
|---|---|---|
_id |
string, |
payer_email:string, from:string, og_email:string |
Returns
200
string
- "OK"
Throws
- 500
Models Used
POST /
Receives Paypal IPN messages, stores a record, and performs basic verification logging.
/paypal.jsParameters
| Name | Type | Description |
|---|---|---|
item_name |
string, |
item_number:string, payment_status:string, mc_gross:string, mc_currency:string, txn_id:string, receiver_email:string, payer_email:string |
Returns
200
string
- "OK"
Throws
- 500
Models Used
GET /check
Responds with a simple health-check message and triggers a test email send for provided name/who query params.
/checkpaypal.jsParameters
| Name | Type | Description |
|---|---|---|
name |
string, |
who:string |
Returns
200
string
Throws
- 500
Models Used
GET /
Root endpoint that returns the service name and version.
/paypal.jsReturns
200
string
Models Used
GET /sendtarotemails
Finds all Paypal records for Tarot Deck preorders that haven't had an intro sent, sends them emails, and marks them as processed.
/sendtarotemailspaypal.jsReturns
200
string
- concatenated names
Throws
- 500
Models Used
GET /all
Returns all Paypal records from the database.
/allpaypal.jsReturns
200
array
Throws
- 500
Models Used
GET /some
Returns Paypal records created within a specific month and year.
/somepaypal.jsParameters
| Name | Type | Description |
|---|---|---|
month |
number, |
year:number |
Returns
200
array
Throws
- 500
Models Used
POST /update
Updates a Paypal record by _id using the posted body and attempts to notify recipient and reader via email.
/updatepaypal.jsParameters
| Name | Type | Description |
|---|---|---|
_id |
string |
Returns
200
string
- 'OK' or error object
Throws
- 500
Models Used
POST /
Main IPN endpoint: accepts PayPal POST notifications, stores a record, responds OK, and attempts to validate the IPN with PayPal.
/paypal.jsParameters
| Name | Type | Description |
|---|---|---|
item_name |
string, |
item_number:string, payment_status:string, mc_gross:string, mc_currency:string, txn_id:string, receiver_email:string, payer_email:string |
Returns
200
string
- 'OK'
Throws
- 500
Models Used
GET /a
Logs an affiliate click when a user opens an affiliate link and redirects them to the appropriate store or web page.
/aaffiliates.jsaffiliate_codeParameters
| Name | Type | Description |
|---|---|---|
r |
string, |
report:string, screen:string, timezone:string, lang:string, platform:string |
Returns
200
unknown
- 200 HTML page that redirects to Play Store, App Store resolver, or web URL
Throws
- 400 (Missing affiliate code), 403 (Bot traffic), 404 (Affiliate not found), 500
Models Used
- Affiliate, AffiliateClick
POST /click
Records a server-side affiliate click when client sends click data (used by mobile SDKs or servers).
/clickaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
code |
string, |
productId:string, install_token:string, device_info:object, device_info.language:string, device_info.timezone:string, device_info.screen:string, device_info.platform:string |
Returns
201
success: true, message: 'Click recorded', clickId: string, install_token: string|null
- or 200 duplicate response
Throws
- 404 (Affiliate not found), 500
Models Used
- Affiliate, AffiliateClick
GET /a/resolve
Shows a small web page that redirects iOS users to the App Store and receives a resolver token.
/a/resolveaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
r_token |
string |
Returns
200
unknown
- 200 HTML page with App Store link
POST /click/install
Matches a received install event to a prior affiliate click using token first, then heuristic scoring (IP, fingerprint, metadata).
/click/installaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
install_token |
string, |
device_info:object, device_info.language:string, device_info.timezone:string, device_info.screen:string, device_info.platform:string |
Returns
200
unknown
- 201 JSON with match details (match: 'token'|'heuristic'|'none', affiliate_code?, installId)
Throws
- 500
Models Used
- AffiliateClick, Affiliate
GET /getAffiliateCodes
Returns a list of active affiliate codes.
/getAffiliateCodesaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
none |
any |
Returns
200
unknown
- 200 JSON array of codes
Throws
- 500
Models Used
GET /getAllAffiliates
Returns all affiliates sorted by creation date (most recent first).
/getAllAffiliatesaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
none |
any |
Returns
200
unknown
- 200 JSON array of affiliate objects
Throws
- 500
Models Used
GET /getAffiliateClicks
Retrieves all clicks for the affiliate owned by the provided email address.
/getAffiliateClicksaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
email |
string |
Returns
200
owner:string, code:string, total:number, clicks:array
Throws
- 400 (Missing email), 404 (Affiliate not found), 500
Models Used
- Affiliate, AffiliateClick
POST /saveAffiliate
Creates or updates an affiliate record for a given email and code.
/saveAffiliateaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
email |
string, |
code:string, status:string |
Returns
200
unknown
- 200 JSON { Success:boolean, Message:string, Data:affiliate }
Throws
- 400 (Email and code required), 500
Models Used
GET /getAffiliateStats
Returns weekly click counts for the affiliate owner identified by email.
/getAffiliateStatsaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
email |
string |
Returns
200
owner:string, code:string, weeklyClicks:array
Throws
- 400 (Missing email), 404 (Affiliate not found), 500
Models Used
- Affiliate, AffiliateClick
GET /getAffiliatePayments
Retrieves payments associated with an affiliate (by owner email) and calculates commission totals.
/getAffiliatePaymentsaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
email |
string |
Returns
200
code:string, totalAmount:number, totalCommission:number, payments:array
Throws
- 400 (Missing email), 404 (Affiliate not found), 500
Models Used
- Affiliate, Payment
POST /completion
Generates a simple AI completion from a prompt.
/completionai.jsParameters
| Name | Type | Description |
|---|---|---|
prompt |
string, |
systemMessage:string (optional), temperature:number (optional), maxTokens:number (optional) |
Returns
200
content:string
- The AI-generated text response.
Throws
- 400 , 500
POST /getpracticaltips
Generates four practical exercise tips for a user's question using OpenAI and returns the parsed JSON tips.
/getpracticaltipsai.jsParameters
| Name | Type | Description |
|---|---|---|
question |
string |
Returns
200
jsonObject:object
- The parsed JSON object returned by the AI containing tips (e.g., tips array).
Throws
- 400 , 500
POST /calculatereport
Calculates an astrological or relocation report based on provided chart data and returns the result.
/calculatereportai.jsParameters
| Name | Type | Description |
|---|---|---|
chart |
object, |
reportType:string, question:string |
Returns
200
reportName:string, question:string, report:object
- The generated report and related metadata.
Throws
- 400 , 500
Models Used
- relocation, reports
GET /asktarotoracle
Fetches a tarot oracle reading for the provided question and returns the oracle's response.
/asktarotoracleai.jsParameters
| Name | Type | Description |
|---|---|---|
question |
string |
Returns
200
object
- The tarot oracle reading returned by the tarot module (structure depends on tarot.getTarotOracleReading).
Throws
- 400 , 500
Models Used
- tarot
POST /generateDataReport
Generates AI-powered data reports (Matrix, Tarot, Transit) with automatic self-rating
/generateDataReportai.jsParameters
| Name | Type | Description |
|---|---|---|
reportType |
string, |
data:object, metadata:object |
Returns
200
report:string, reportType:string, metadata:object
Throws
- 400 , 500
GET /searchapi
Looks up birth locations matching a small town name using an external astrology API and returns them.
/searchapicities.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Array of location objects
Throws
- 500
External APIs Called
GET /getapi/:id
Fetches detailed city information for a town name from an external astrology API.
/getapi/:idcities.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
object
Throws
- 500
External APIs Called
GET /get/:id
Retrieves a city record from the database by its ID.
/get/:idcities.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Cities document
Throws
- 404 , 500
Models Used
- Cities
GET /search
Searches the Cities collection for towns whose full name starts with the given query and returns up to 5 matches.
/searchcities.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Array of objects with FullName
Throws
- 500
Models Used
- Cities
GET /populatecity
Downloads region code data from an external API and inserts them into the Region collection.
/populatecitycities.jsReturns
200
Array of inserted region documents
Throws
- 500
Models Used
External APIs Called
GET /update
Starts a recurring background task to update city FullName fields every 5 seconds.
/updatecities.jsReturns
200
started timer
GET /test
Returns cities whose name matches "Albuquerque" from an in-memory cities array.
/testcities.jsReturns
200
Array
GET /populate
Builds city documents from an in-memory cities array and inserts them into the Cities collection.
/populatecities.jsReturns
200
Array of inserted documents
Models Used
- Cities
GET /Delete
Deletes component items that match the provided ComponentName and Category.
/Deletecomponent.jsParameters
| Name | Type | Description |
|---|---|---|
ComponentName |
string, |
Category:string |
Returns
200
"Ok"
Throws
- 500
Models Used
POST /Update
Updates or creates component entries with the provided fields.
/Updatecomponent.jsParameters
| Name | Type | Description |
|---|---|---|
component |
string, |
category:string, id:string, description:string, image:string, phrase:string |
Returns
200
"OK"
Throws
- 500
Models Used
GET /FlushDelete
Removes all forecast components in English.
/FlushDeletecomponent.jsReturns
200
"Ok"
Throws
- 500
Models Used
GET /CheckForDuplicateKeys
Scans components in a category for reversed-key duplicates and removes the shorter description entry.
/CheckForDuplicateKeyscomponent.jsParameters
| Name | Type | Description |
|---|---|---|
Category |
string |
Returns
200
"Duplicate key check complete"
Throws
- 500
Models Used
GET /UpdateServerComponent
Updates server components by fetching horoscope items and saving descriptions when available.
/UpdateServerComponentcomponent.jsReturns
200
"Update server component process complete"
Throws
- 500
Models Used
GET /CleanUpComponents
Cleans up component collection: removes items with 'Earth' in Component or aligns Component to Key.
/CleanUpComponentscomponent.jsReturns
200
"Cleanup complete"
Throws
- 500
Models Used
GET /GetLanguageTable
Retrieves language tags for the requested language.
/GetLanguageTablecomponent.jsParameters
| Name | Type | Description |
|---|---|---|
Language |
string |
Returns
200
unknown
- 200 [{Name, Value}]
Throws
- 500
Models Used
GET /TranslateItems
Triggers translation checks for items of a specific type into a given language.
/TranslateItemscomponent.jsParameters
| Name | Type | Description |
|---|---|---|
Language |
string, |
type:string |
Returns
200
unknown
- 200
Throws
- 500
Models Used
GET /GetLanguageItem
Returns a translated language item if present, otherwise translates on demand and stores it.
/GetLanguageItemcomponent.jsParameters
| Name | Type | Description |
|---|---|---|
Language |
string, |
Name:string |
Returns
200
Language item
Throws
- 500
Models Used
GET /GetComponentTraits/:component/:componentCategory
Retrieves traits associated with a specific component and component category.
/GetComponentTraits/:component/:componentCategorycomponent.jsParameters
| Name | Type | Description |
|---|---|---|
component |
string, |
componentCategory:string |
Returns
200
Array
Throws
- 500
Models Used
- traits
GET /GetComponent
Retrieves a component by name, category, language, and id — uses cache, DB, or main server and returns enriched object.
/GetComponentcomponent.jsParameters
| Name | Type | Description |
|---|---|---|
Language |
string, |
Id:string, Category:string, uid:string, ComponentName:string |
Returns
200
Component object
Throws
- 404 , 500
Models Used
- Component, traits
GET /GetCategory
Returns all components in the specified category and language.
/GetCategorycomponent.jsParameters
| Name | Type | Description |
|---|---|---|
language |
string, |
category:string |
Returns
200
Array
Throws
- 500
Models Used
GET /GetCategoryItems
Aggregates category items with view counts and image URLs.
/GetCategoryItemscomponent.jsParameters
| Name | Type | Description |
|---|---|---|
language |
string, |
category:string |
Returns
200
Array
Throws
- 500
Models Used
- Component, View
GET /flush
Clears all entries from the in-memory forecast cache.
/flushforecasts.jsReturns
200
string
- "OK"
GET /get
Retrieves forecast items for a supplied date, type, and limit.
/getforecasts.jsParameters
| Name | Type | Description |
|---|---|---|
date |
string, |
limit:number, type:string |
Returns
200
Array
Throws
- 500
Models Used
GET /getForecasts
Retrieves forecasts with caching to reduce database load. If the requested data is not cached, it fetches moon phases and horoscopes and combines them.
/getForecastsforecasts.jsParameters
| Name | Type | Description |
|---|---|---|
date |
string, |
limit:number, type:string |
Returns
200
Array
Throws
- 500
Models Used
GET /get
Retrieves forecast items with caching; older/deprecated version of /get route. This endpoint will check an in-memory cache and otherwise query the forecasts collection.
/getforecasts.jsParameters
| Name | Type | Description |
|---|---|---|
date |
string, |
type:string, limit:number |
Returns
200
Array
Throws
- 500
Models Used
GET /getall
Imports all forecasts from an external API into the local database and clears the cache. This route calls an external service to fetch all forecasts, replaces the local forecasts collection, and stores the items.
/getallforecasts.jsReturns
200
string
- "ok"
Throws
- 500
Models Used
External APIs Called
GET /:userId
Returns a paginated list of accepted friends for a given user and any incoming friend requests on the first page.
/:userIdfriend.jsParameters
| Name | Type | Description |
|---|---|---|
userId |
string, |
page:number, limit:number |
Returns
200
requests: Array, friends: Array, count: number
Throws
- 404 , 500
Models Used
- Profile, Friend
PUT /:id
Updates the status of a friend relationship by its ID.
/:idfriend.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string, |
status:string |
Returns
200
message: string, updatedFriend: Object
Throws
- 404 , 500
Models Used
POST /
Sends a new friend request or re-sends a previously rejected one using the requesting user's UID.
/friend.jsParameters
| Name | Type | Description |
|---|---|---|
user |
string, |
friend:string |
Returns
200
message: string, friend: Object
Throws
- 500
Models Used
- Profile, Friend
GET /get
Fetches help entries filtered by page, section, or type and returns only entries that have a non-empty description.
/gethelp.jsParameters
| Name | Type | Description |
|---|---|---|
page |
string, |
section:string, type:string |
Returns
200
Array of help objects with non-empty Description
Throws
- 400 , 500
Models Used
GET /:id
Retrieves a single help entry by its ID.
/:idhelp.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Help object
Throws
- 500
Models Used
POST /
Creates a new help entry in the database.
/help.jsParameters
| Name | Type | Description |
|---|---|---|
help |
object |
Returns
200
Created help object
Throws
- 500
Models Used
PUT /:id
Updates an existing help entry by its ID with the provided data.
/:idhelp.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string, |
help:object |
Returns
200
Updated help object
Throws
- 500
Models Used
DELETE /:id
Removes a help entry by its ID from the database.
/:idhelp.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Deleted help object
Throws
- 500
Models Used
GET /count
Returns a count of journal entries filtered by user ID and optionally by category. Category logic: - 'reports': componentData.reportType contains 'matrix' - 'charts': componentData.chartType exists
/countjournals.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string, |
category:string (either 'reports' or 'charts') |
Returns
200
count:number
Throws
- 400 , 500
Models Used
GET /list
Returns a list of journal entries, optionally filtered by user ID, category, and component.
/listjournals.jsParameters
| Name | Type | Description |
|---|---|---|
limit |
number, |
uid:string, category:string, component:string |
Returns
200
Array
- Array of journal objects
Throws
- 500
Models Used
GET /get/:id
Retrieves a single journal entry by its ID.
/get/:idjournals.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Object
- Journal object
Throws
- 404 , 500
Models Used
POST /save
Creates a new journal entry for an existing profile.
/savejournals.jsParameters
| Name | Type | Description |
|---|---|---|
profileId |
string |
Returns
201
Object
- Created journal object
Throws
- 404 , 400
Models Used
- Profile, Journal
PUT /edit/:id
Updates an existing journal entry by ID with provided data.
/edit/:idjournals.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Object
- Updated journal object
Throws
- 400
Models Used
DELETE /delete/:id
Deletes a journal entry by its ID.
/delete/:idjournals.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Object
- Deleted journal object
Throws
- 500
Models Used
GET /view/:id
Get journal entry with full component data for viewing
/view/:idjournals.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Object
- Journal with complete component data
Throws
- 404
Models Used
- Journal, TarotReading
GET /
Retrieves all language tag records from the database.
/language.jsReturns
200
Language[]
Throws
- 500
Models Used
GET /:id
Retrieves a single language tag by its ID.
/:idlanguage.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Language
Throws
- 404 , 500
Models Used
POST /
Saves a new language tag document to the database.
/language.jsParameters
| Name | Type | Description |
|---|---|---|
body |
object |
Returns
200
Language
Throws
- 500
Models Used
PUT /:id
Updates an existing language tag by ID and records an update metric.
/:idlanguage.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string, |
body:object |
Returns
200
Language
Throws
- 500
Models Used
DELETE /:id
Placeholder for deleting a language tag by ID (not implemented).
/:idlanguage.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
204
void
Throws
- 500
Models Used
POST /SendMessage
Saves a new support message and triggers a user notification.
/SendMessagemessages.jsParameters
| Name | Type | Description |
|---|---|---|
FromEmail |
string, |
FromUserId:string, ToUserId:string, Content:string |
Returns
200
message:string, data:Message
- or 200 { message:'Message ignored.' } when ignored
Throws
- 500
Models Used
External APIs Called
POST /SendEmail
Sends an email message using the application's message service.
/SendEmailmessages.jsParameters
| Name | Type | Description |
|---|---|---|
FromEmail |
string, |
FromUserId:string, ToUserId:string, Content:string |
Returns
200
success:boolean, ...
- (result from sendEmailMessage)
Throws
- 400 , 500
Models Used
POST /SendNewMessage
Stores a new message and returns automated support responses based on message content.
/SendNewMessagemessages.jsParameters
| Name | Type | Description |
|---|---|---|
FromEmail |
string, |
FromUserId:string, ToUserId:string, Content:string |
Returns
200
question:string, options:array
- or 200 lookIntoIssueResponse / needToLoginResponse
Throws
- 500
Models Used
GET /GetUserMessages/:ToUserId
Retrieves conversation summaries for a user, grouped by conversation partner. Each item includes the latest message, unread count, display name/email/avatar, and reply status.
/GetUserMessages/:ToUserIdmessages.jsParameters
| Name | Type | Description |
|---|---|---|
ToUserId |
string |
Returns
200
unknown
- 200 [ { userId:string, latestMessage:Message, unreadCount:number, replyStatus:string, displayEmail:string, displayName:string, displayAvatar:string, userDetails:{uid:string,name:string,email:string,avatar:string} } ]
Throws
- 500
Models Used
GET /GetMessage/:FromUserId/:ToUserId
Retrieves full chronological message history between two users.
/GetMessage/:FromUserId/:ToUserIdmessages.jsParameters
| Name | Type | Description |
|---|---|---|
FromUserId |
string, |
ToUserId:string |
Returns
200
unknown
- 200 [ Message ]
Throws
- 500
Models Used
GET /GetNewMessage/:FromUserId/:ToUserId
Fetches messages between two users and returns main support options if none exist.
/GetNewMessage/:FromUserId/:ToUserIdmessages.jsParameters
| Name | Type | Description |
|---|---|---|
FromUserId |
string, |
ToUserId:string |
Returns
200
unknown
- 200 [ Message ] or 200 [ mainOptions:string[] ]
Throws
- 500
Models Used
GET /
Retrieves Prometheus-formatted metrics for scraping by Prometheus.
/metrics.jsReturns
200
string
- Prometheus metrics text/plain content
Throws
- 500
POST /updateMetric
Registers or updates a dynamic Prometheus metric (gauge or counter).
/updateMetricmetrics.jsParameters
| Name | Type | Description |
|---|---|---|
name |
string, |
type:string, value:number, labels:object |
Returns
200
string
- Success message indicating metric updated
Throws
- 400 , 500
POST /pingonline
Records a user's heartbeat to mark them as online.
/pingonlinemetrics.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string |
Returns
200
success:boolean, activeUsers:number
Throws
- 400 , 500
GET /usersonline
Returns the current number of active users and reports the value to the external metric endpoint.
/usersonlinemetrics.jsReturns
200
activeUsers:number
Throws
- 500
External APIs Called
GET /flush
Clears the in-memory cache used for video and product lookups.
/flushproducts.jsReturns
200
string
- "OK"
Throws
- 500
Models Used
GET /all
Returns all products that have a ProductID field set.
/allproducts.jsReturns
200
array
- list of products
Throws
- 500
Models Used
GET /specialvideo
Returns active video products filtered by a tag provided in the query string.
/specialvideoproducts.jsParameters
| Name | Type | Description |
|---|---|---|
type |
string |
Returns
200
array
- list of videos
Throws
- 500
Models Used
GET /videos
Returns video products, optionally filtered by a tag type or a title-derived consciousness level. Results are cached in memory keyed by type and title to reduce database queries.
/videosproducts.jsParameters
| Name | Type | Description |
|---|---|---|
type |
string, |
title:string |
Returns
200
array
- list of videos
Throws
- 500
Models Used
GET /allvideos
Returns all products that are videos, sorted by placement.
/allvideosproducts.jsReturns
200
array
- list of all videos
Throws
- 500
Models Used
GET /getAd
Fetches active advertisement content for a given tag type.
/getAdproducts.jsParameters
| Name | Type | Description |
|---|---|---|
type |
string |
Returns
200
array
- list of ads
Throws
- 500
Models Used
GET /getVideoAd
Fetches active advertisement video content for a given tag type.
/getVideoAdproducts.jsParameters
| Name | Type | Description |
|---|---|---|
type |
string |
Returns
200
array
- list of video ads
Throws
- 500
Models Used
GET /getAdSummary
Fetches active advertisement content that includes a promo image for a given tag type.
/getAdSummaryproducts.jsParameters
| Name | Type | Description |
|---|---|---|
type |
string |
Returns
200
array
- list of ad summaries with images
Throws
- 500
Models Used
GET /getAllAd
Returns all advertisement records from the products collection.
/getAllAdproducts.jsReturns
200
array
- list of ads and ad videos
Throws
- 500
Models Used
POST /updateAd
Updates an existing ad document by _id using the request body data.
/updateAdproducts.jsParameters
| Name | Type | Description |
|---|---|---|
_id |
string |
Returns
200
string
- "OK"
Throws
- 500
Models Used
GET /addproducts
Placeholder endpoint intended to add products; currently has no implementation.
/addproductsproducts.jsReturns
200
empty
Models Used
GET /get/:id
Retrieves a configuration record by its CID, creating a default one if none exists.
/get/:idsettings.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
CID:string, Amount:number, Value:number
Throws
- 404 , 500
Models Used
GET /get
Immediately responds with a small test JSON object to confirm the route is working.
/getsettings.jsReturns
200
test:string
Throws
- 404 , 500
GET /test
Returns a short identifier string "sdk" to confirm the test endpoint is reachable.
/testsettings.jsReturns
200
string
Throws
- 404 , 500
GET /ads-threshold
Returns the ads threshold value for the application. This endpoint can be called by anyone without authentication. Reads from ADS_THRESHOLD environment variable (default: 50)
/ads-thresholdsettings.jsReturns
200
adsThreshold:number, message:string
Throws
- 500
GET /ads-interval
Returns the minimum number of minutes allowed between full-screen interstitial ads. This endpoint can be called by anyone without authentication. Reads from ADS_INTERVAL environment variable (default: 3)
/ads-intervalsettings.jsReturns
200
Success:boolean, adsInterval:number
Throws
- 500
GET /ads-configs
Returns all ad configuration values from a single MongoDB configs doc.
/ads-configssettings.jsReturns
200
adRefreshMs:number, useRewardAds:boolean, adsThreshold:number, rewardTiers:Array
Throws
- 500
POST /AddSurvey
Saves a new survey document to the surveys collection.
/AddSurveysurvey.jsReturns
200
object
- Created survey document
Throws
- 500
Models Used
POST /AddRating
Saves a new rating to the ratings collection and increments a statsd metric.
/AddRatingsurvey.jsReturns
200
object
- Created rating document
Throws
- 500
Models Used
POST /IncrementLog
Increments a DogStatsD metric based on the Type field in the request body.
/IncrementLogsurvey.jsParameters
| Name | Type | Description |
|---|---|---|
Type |
string |
Returns
200
string
- "OK"
Throws
- 500
POST /AIPromptText
Accepts a textual AI prompt request and returns OK (endpoint is currently a placeholder).
/AIPromptTextsurvey.jsReturns
200
string
- "OK"
GET /get
Retrieves a tarot card entry by key and type, translating from English if needed.
/gettarot.jsParameters
| Name | Type | Description |
|---|---|---|
key |
string, |
type:string, language:string, reversed:string |
Returns
200
Tarot document or translated object with Key, Category, Type, Language, Name, Description
Throws
- 500
Models Used
POST /addSpread
Saves a new tarot spread document to the database.
/addSpreadtarot.jsParameters
| Name | Type | Description |
|---|---|---|
Group |
string, |
Title:string, Cards:string, CardTotal:number, Active:boolean |
Returns
200
created TarotSpread document
Throws
- 500
Models Used
POST /updateSpread/:id
Updates the Active flag of an existing tarot spread by ID.
/updateSpread/:idtarot.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string, |
Active:boolean |
Returns
200
string
- "OK"
Throws
- 500
Models Used
GET /createTarotSpreads
Builds a sample tarot spread object in memory (not saved to the database).
/createTarotSpreadstarot.jsParameters
| Name | Type | Description |
|---|---|---|
none |
any |
Returns
200
sample spread object, not persisted
GET /test2
Simple health-check endpoint.
/test2tarot.jsReturns
200
string
- "OK"
GET /test
Simple health-check endpoint.
/testtarot.jsReturns
200
string
- "OK"
GET /getTarotSpreads
Retrieves all tarot spread documents, sorted by the Order field ascending.
/getTarotSpreadstarot.jsParameters
| Name | Type | Description |
|---|---|---|
none |
any |
Returns
200
Array
- list of tarot spread documents
Throws
- 500
Models Used
GET /GetTraits
Provides endpoints to list all trait records in the "Facets" category.
/GetTraitstraits.jsReturns
200
Success:boolean, Message:string, Data:array
Throws
- 500
Models Used
GET /GetTraits/:id
Retrieves a single trait record by its ID.
/GetTraits/:idtraits.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Success:boolean, Message:string, Data:object|string
Throws
- 500
Models Used
POST /AddTraits
Adds a new trait record using the JSON body provided in the request.
/AddTraitstraits.jsReturns
200
Success:boolean, Message:string, Data:object
Throws
- 500
Models Used
POST /UpdateTraitsByName
Updates a trait's Value by matching Component, ComponentCategory and TraitsCategory fields.
/UpdateTraitsByNametraits.jsParameters
| Name | Type | Description |
|---|---|---|
component |
string, |
category:string, traitsCategory:string, newValue:string |
Returns
200
message:string, modifiedCount?:number
- or 500 { message:string, error:string }
Throws
- 500
Models Used
PUT /UpdateTraits/:id
Updates a trait by its ID using the JSON body provided.
/UpdateTraits/:idtraits.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Success:boolean, Message:string, Data:object
Throws
- 500
Models Used
DELETE /DeleteTraits/:id
Deletes a trait by its ID.
/DeleteTraits/:idtraits.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
Success:boolean, Message:string, Data:object
Throws
- 500
Models Used
GET /GetComponentTraits
Retrieves component traits based on query string parameters Component, Category, and TraitsCategory.
/GetComponentTraitstraits.jsParameters
| Name | Type | Description |
|---|---|---|
Component |
string, |
Category:string, TraitsCategory:string |
Returns
200
Success:boolean, Message:string, Data:array
Throws
- 500
Models Used
POST /AddComponentTraits
Accepts a request body with component, category, traitsCategory and value fields to add or update a trait.
/AddComponentTraitstraits.jsParameters
| Name | Type | Description |
|---|---|---|
component |
string, |
category:string, traitsCategory:string, value:string |
Returns
200
Success:boolean, Message:string, Data:object
Throws
- 500
Models Used
GET /findUser
Finds users by birth date and location and returns a simplified list.
/findUseruser.jsParameters
| Name | Type | Description |
|---|---|---|
day |
string, |
month:string, year:string, location:string, key:string |
Returns
200
array of {ID, Name, UID, BirthDay, BirthMonth, BirthYear, BirthTime, BirthTown, Lat, Lng, TimeZone, Famous
- }
Throws
- 400 , 403, 500
Models Used
GET /switchAccount
Switches account IDs across profiles and users, and notifies a legacy API.
/switchAccountuser.jsParameters
| Name | Type | Description |
|---|---|---|
key |
string, |
oldID:string, newID:string |
Returns
200
message:string, profile:{updated:number, skipped:number
- , user:{updated:number, skipped:number}, legacyResponse:object|string}
Throws
- 400 , 403, 500
Models Used
- Profile, User
External APIs Called
GET /GetAllUsers
Returns a paginated list of public profiles matching a search query.
/GetAllUsersuser.jsskipParameters
| Name | Type | Description |
|---|---|---|
page |
number, |
limit:number, uid:string, searchQuery:string |
Returns
200
users:array, totalUsers:number, totalPages:number, currentPage:number
Throws
- 500
Models Used
GET /migratejob
Triggers a background migration job through the migration service.
/migratejobuser.jsParameters
| Name | Type | Description |
|---|---|---|
none |
any |
Returns
200
message:string
Throws
- 500
POST /start-migration
Starts a migration for a specific user id (uid).
/start-migrationuser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string |
Returns
200
message:string
Throws
- 400
POST /erase
Deletes a single user by uid and profileId using post
/eraseuser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string, |
profileId:string |
Returns
200
message:string, user:object
Throws
- 400 , 404
Models Used
DELETE /remove
Deletes a single user by uid and profileId. ( deprecated )
/removeuser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string, |
profileId:string |
Returns
200
message:string, user:object
Throws
- 400 , 404
Models Used
DELETE /removeaccount/:id
Marks a user account and related records as deleted by profile ObjectId.
/removeaccount/:iduser.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
message:string
Throws
- 400 , 404, 500
Models Used
- User, Profile, Friend
DELETE /removeaccount
Deletes a user account and all associated personal data (GDPR compliant). Also calls the legacy RemoveAllData endpoint to purge SQL-side data. Note: Payment records are retained for tax/legal compliance.
/removeaccountuser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string, |
birthday:number, birthmonth:number, birthyear:number |
Returns
200
message:string, deletedCollections:array
Throws
- 400 , 403, 404, 500
Models Used
- User, Profile, Friend, Journal, Message, Device, Rating, CrucibleChat
GET /update-uids-to-lowercase
Converts any non-lowercase user uids to lowercase across the users collection.
/update-uids-to-lowercaseuser.jsParameters
| Name | Type | Description |
|---|---|---|
none |
any |
Returns
200
message:string, updatedCount:number
Throws
- 500
Models Used
GET /user-count
Counts how many user documents exist for a given uid.
/user-countuser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string |
Returns
200
uid:string, count:number
Throws
- 400
Models Used
GET /find-duplicates
Finds duplicate users by profileId and removes non-lowercase duplicates.
/find-duplicatesuser.jsParameters
| Name | Type | Description |
|---|---|---|
none |
any |
Returns
200
message:string, deletedIds:array
Throws
- 500
Models Used
GET /checkpassword/:id
Checks whether a supplied password matches the stored profile password.
/checkpassword/:iduser.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string, |
password:string |
Returns
200
success:boolean, message:string
Throws
- 500
Models Used
PUT /setMainUser/:profileId
Sets a user as the main user for their profile. Only one user per uid can be the main user.
/setMainUser/:profileIduser.jsParameters
| Name | Type | Description |
|---|---|---|
profileId |
string |
Returns
200
message:string, user:object
Throws
- 400 , 404, 500
Models Used
- User, Profile
PUT /edit/:id
Updates a user document identified by profileId with provided body fields (uid/profileId/mainUserId cannot be changed).
/edit/:iduser.jsParameters
| Name | Type | Description |
|---|---|---|
id |
string |
Returns
200
message:string, user:object
Throws
- 400 , 404, 500
Models Used
POST /user/Login
Authenticates a user and returns their profileId (obfuscated). Looks up user by uid (email) in profiles collection, validates password, and returns profileId instead of _id to obscure email/uid mapping.
/user/Loginuser.jsParameters
| Name | Type | Description |
|---|---|---|
{string} uid - Email/username identifier |
any |
|
{string} password - User password |
any |
Returns
200
success: true, message: "OK", data: {id: profileId
- }
Throws
- 400 {success: false, message: "InvalidEmail|NotFound|IncorrectPassword"}
- 500 {success: false, message: "Error message"}
Models Used
- User, Profile
POST /adduser
Adds a new user document to the users collection using request body fields.
/adduseruser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string, |
mainUser:string, name:string, day:number, month:number, year:number, time:string, timeOffset:string, town:string, lat:number, lng:number, noTime:boolean |
Returns
200
unknown
- 200 savedUser (object)
Throws
- 500
Models Used
GET /getUsersID/:profileId
Returns user record(s) associated with a given profileId. Replaces connectedusers
/getUsersID/:profileIduser.jsParameters
| Name | Type | Description |
|---|---|---|
profileId |
string |
Returns
200
unknown
- 200 array of simplified user objects
Throws
- 500
Models Used
GET /getUsersID/:profileId
Returns user records associated with a given profileId or uid. First tries to find Profile by profileId to get uid. If not found, assumes input is a uid.
/getUsersID/:profileIduser.jsParameters
| Name | Type | Description |
|---|---|---|
profileId |
string |
(can also be uid) |
Returns
200
unknown
- 200 array of simplified user objects
Throws
- 500
GET /connectedUsers/:uid
Returns all user records associated with a given uid. DEPRECATED ONLY FOR LEGACY USE
/connectedUsers/:uiduser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string, |
isFamous:string |
Returns
200
unknown
- 200 array of simplified user objects
Throws
- 500
Models Used
GET /handle/available
Quick availability check for a user-chosen handle. Used by the profile editor to give live "available / taken" feedback as the user types.
/handle/availableuser.jshandleParameters
| Name | Type | Description |
|---|---|---|
handle |
string |
(query), uid:string (query, optional — caller's own uid) |
Returns
200
handle, valid, available, reason?
Models Used
POST /handle/update
Sets a user-chosen handle. Enforces format + case-insensitive uniqueness.
/handle/updateuser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string, |
handle:string |
Returns
200
success:true, handle
Throws
- 400 invalid format, 404 no profile, 409 taken
Models Used
POST /verifyprofile
Verifies or updates a profile entry and returns the saved profile.
/verifyprofileuser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string, |
verify:boolean, profileId:string, name:string, handle:string |
Returns
200
unknown
- 200 updatedProfile (object)
Throws
- 400 , 500
Models Used
POST /addprofile
DEPRECATED: Adds a profile by fetching details from a legacy API if not present locally.
/addprofileuser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string, |
profileId:string, profile:string |
Returns
200
unknown
- 200 profile object or "NOT COMPLETE" / "Select Main User"
Throws
- 500
Models Used
External APIs Called
GET /log/error
Logs a simple error record using query parameters (uid, msg, url).
/log/erroruser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string, |
msg:string, url:string |
Returns
200
unknown
- 200 "OK"
Models Used
POST /IncrementLog
Increments a log/error entry using the request body 'Type' field.
/IncrementLoguser.jsParameters
| Name | Type | Description |
|---|---|---|
Type |
string |
Returns
200
unknown
- 200 on success or 500 on create error
Models Used
POST /log/posterror
Logs an error using POST body parameters.
/log/posterroruser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string, |
msg:string, info:string |
Returns
200
message:"OK"
- or 500
Models Used
GET /find/user
Finds a device by uuid and returns the most used device or "Not Found". DEPRECATED JAN 24.
/find/useruser.jsParameters
| Name | Type | Description |
|---|---|---|
uuid |
string |
Returns
200
unknown
- 200 device object or "Not Found"
Models Used
GET /new/start
Increments the metric counter for new user start and returns OK.
/new/startuser.jsParameters
| Name | Type | Description |
|---|---|---|
none |
any |
Returns
200
unknown
- 200 "OK"
GET /new/complete
Increments the metric counter for new user completion and returns OK.
/new/completeuser.jsParameters
| Name | Type | Description |
|---|---|---|
none |
any |
Returns
200
unknown
- 200 "OK"
GET /store/user
Stores or updates a device session record using query params (uid, uuid, sessions) and request body as update.
/store/useruser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string, |
uuid:string, sessions:string |
Returns
200
unknown
- 200 "OK"
Models Used
GET /count/user
Returns the count of non-deleted users and sends a metric; requires a static key '24kk$$5'.
/count/useruser.jsParameters
| Name | Type | Description |
|---|---|---|
key |
string |
Returns
200
userCount:number
Throws
- 403 , 500
Models Used
GET /count/profile
Returns the count of profiles and sends a metric; requires a static key '24kk$$5'.
/count/profileuser.jsParameters
| Name | Type | Description |
|---|---|---|
key |
string |
Returns
200
profileCount:number
Throws
- 403 , 500
Models Used
PUT /toggleProfile/:uid
Toggles a profile's privacy flag (isPrivate) for a given uid.
/toggleProfile/:uiduser.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string |
Returns
200
success:boolean, message:string, isPrivate:boolean
Throws
- 404 , 500
Models Used
POST /send-deletion-code
Step 1 — verify credentials + DOB, then email a 6-digit code.
/send-deletion-codeuser.jsPOST /confirm-deletion
Step 2 — verify the code then delete the account.
/confirm-deletionuser.jsGET /
Returns a simple health-check string indicating the server is running.
/user.jsReturns
200
string
Throws
- 500
MODELS
Affiliate (affiliates)
Represents an affiliate account used to track referrals and identify partners.
AffiliateaffiliatesAffiliate.jsSchema
| Field | Type |
|---|---|
code |
String |
owner |
String |
email |
String |
status |
String |
created_at |
Date |
Indexes
code (unique)
Used By Routes (3)
- GET /getAffiliateCodes (affiliates.js)
- GET /getAllAffiliates (affiliates.js)
- POST /saveAffiliate (affiliates.js)
AffiliateClick (affiliateclicks)
Records individual clicks or installs attributed to an affiliate for tracking conversions.
AffiliateClickaffiliateclicksAffiliate.jsSchema
| Field | Type |
|---|---|
affiliate |
ObjectId |
ip_address |
String |
user_agent |
String |
device_fingerprint |
String |
device_info |
Object |
type |
String |
status |
String |
meta |
Object |
clicked_at |
Date |
Indexes
ip_address+type+clicked_at (compound)
Relations
- Affiliate (affiliate)
Location (locations)
Stores geographic location details such as name, coordinates, region codes, and population.
LocationlocationsCities.jsSchema
| Field | Type |
|---|---|
Name |
String |
Country |
String |
Lat |
String |
Lng |
String |
RegionCode |
String |
CountryCode |
String |
Province |
String |
FullName |
String |
Population |
Number |
Component (components)
Stores component records with fields like Key, Category, Language and content, and prevents duplicate entries using a unique index.
ComponentcomponentsComponent.jsSchema
| Field | Type |
|---|---|
Key |
String |
Component |
String |
Category |
String |
Description |
String |
ShortDesc |
String |
Language |
String |
Id |
String |
Phrase |
String |
Image |
String |
DescriptionCount |
Number |
Views |
Number |
AI |
String |
Concept |
String |
Indexes
Key+Category+Language+Id (unique)
Used By Routes (7)
- GET /Delete (component.js)
- POST /Update (component.js)
- GET /FlushDelete (component.js)
- GET /CheckForDuplicateKeys (component.js)
- GET /UpdateServerComponent (component.js)
- GET /CleanUpComponents (component.js)
- GET /GetCategory (component.js)
Device (devices)
Stores device identifiers, session counts, optional UUIDs, and timestamps for when the record was created.
DevicedevicesDevice.jsSchema
| Field | Type |
|---|---|
uid |
String |
sessions |
Number |
uuid |
String |
date |
Date |
Used By Routes (2)
- GET /find/user (user.js)
- GET /store/user (user.js)
Error (errors)
Stores error logs with a user identifier, message, additional info, and a timestamp.
ErrorerrorsError.jsSchema
| Field | Type |
|---|---|
uid |
String |
msg |
String |
info |
String |
timestamp |
Date |
Used By Routes (3)
- GET /log/error (user.js)
- POST /IncrementLog (user.js)
- POST /log/posterror (user.js)
Forecasts (forecasts)
Stores forecasts and horoscope event information for each forecast entry.
ForecastsforecastsForecasts.jsSchema
| Field | Type |
|---|---|
EventID |
Number |
Begins |
Date |
Ends |
Date |
Title |
String |
Sign |
String |
Degree |
Number |
Type |
String |
Description |
String |
Image |
String |
Phrase |
String |
Blurb |
String |
Url |
String |
FullTitle |
String |
SubType |
String |
Report |
String |
PreShadow |
Date |
PostShadow |
Date |
EndDegree |
Number |
Indexes
none
Used By Routes (4)
- GET /get (forecasts.js)
- GET /getForecasts (forecasts.js)
- GET /get (forecasts.js)
- GET /getall (forecasts.js)
Used By Functions (1)
- getForecast (forecasts.js)
Friend (friends)
Stores friendship relationships between user profiles and their current status.
FriendfriendsFriend.jsSchema
| Field | Type |
|---|---|
user |
ObjectId |
friend |
ObjectId |
status |
String |
createdAt |
Date |
updatedAt |
Date |
Indexes
user+friend (unique)
Relations
- Profile (user), Profile (friend)
Used By Routes (1)
- PUT /:id (friend.js)
Help (helps)
Stores help articles and their metadata for the application's help pages.
HelphelpsHelp.jsSchema
| Field | Type |
|---|---|
HelpId |
Number |
Page |
String |
Section |
String |
Type |
String |
Description |
String |
Used By Routes (5)
- GET /get (help.js)
- GET /:id (help.js)
- POST / (help.js)
- PUT /:id (help.js)
- DELETE /:id (help.js)
Used By Functions (1)
- tryTypeQuery (help.js)
Journal (journals)
Stores journal entries created by users, including metadata and content.
JournaljournalsJournal.jsSchema
| Field | Type |
|---|---|
profileId |
String |
journalId |
String |
created |
Date |
type |
String |
name |
String |
category |
String |
comment |
String |
details |
String |
description |
String |
cards |
Number |
Indexes
none
Used By Routes (5)
- GET /count (journals.js)
- GET /list (journals.js)
- GET /get/:id (journals.js)
- PUT /edit/:id (journals.js)
- DELETE /delete/:id (journals.js)
JournalPrompt (journalprompts)
Stores journal prompts linked to astrological events, houses, language, and category.
JournalPromptjournalpromptsJournalPrompt.jsSchema
| Field | Type |
|---|---|
event |
String |
house |
String |
language |
String |
reflection |
String |
implementation |
String |
ritualMethods |
String |
category |
String |
Indexes
event+house+category+language (unique)
Language (languages)
Stores localized language entries with their name, category, type, value and language.
LanguagelanguagesLanguage.jsSchema
| Field | Type |
|---|---|
Name |
String |
Category |
String |
Type |
String |
Value |
String |
Language |
String |
Used By Routes (8)
- GET /GetLanguageTable (component.js)
- GET /TranslateItems (component.js)
- GET /GetLanguageItem (component.js)
- GET / (language.js)
- GET /:id (language.js)
- POST / (language.js)
- PUT /:id (language.js)
- DELETE /:id (language.js)
Message (messages)
Stores chat message details between users including sender, recipient, content, time and delivery status.
MessagemessagesMessage.jsSchema
| Field | Type |
|---|---|
FromEmail |
String |
FromUserId |
String |
ToUserId |
String |
Content |
String |
Timestamp |
Date |
Status |
String |
Used By Routes (6)
- POST /SendMessage (messages.js)
- POST /SendEmail (messages.js)
- POST /SendNewMessage (messages.js)
- GET /GetUserMessages/:ToUserId (messages.js)
- GET /GetMessage/:FromUserId/:ToUserId (messages.js)
- GET /GetNewMessage/:FromUserId/:ToUserId (messages.js)
Used By Functions (3)
- saveMessage (messageService.js)
- markMessagesAsSeen (messageService.js)
- sendEmailMessage (messageService.js)
Payments (payments)
Stores payment records for users including pricing, timestamps, and platform details.
PaymentspaymentsPayment.jsSchema
| Field | Type |
|---|---|
uid |
String |
email |
String |
type |
String |
createdAt |
Date |
updatedAt |
Date |
expiredAt |
Date |
price |
String |
priceMicros |
String |
purchaseTime |
String |
currency |
String |
platform |
String |
info |
String |
affiliate_code |
String |
Indexes
type+uid (compound, unique)
Paypal (paypals)
Stores PayPal payment and payer information for each transaction.
PaypalpaypalsPaypal.jsSchema
| Field | Type |
|---|---|
item_name |
String |
residence_country |
String |
payment_gross |
String |
payer_id |
String |
payer_email |
String |
first_name |
String |
last_name |
String |
address_name |
String |
address_country |
String |
address_city |
String |
address_state |
String |
address_street |
String |
address_zip |
String |
address_status |
String |
userid |
String |
selectedid |
String |
custom |
String |
createdAt |
Date |
Assigned |
String |
Status |
String |
Return |
String |
Intro |
String |
Used By Routes (11)
- GET /sendtarotemails (paypal.js)
- GET /all (paypal.js)
- GET /some (paypal.js)
- GET /get (paypal.js)
- POST /update (paypal.js)
- POST / (paypal.js)
- GET /sendtarotemails (paypal.js)
- GET /all (paypal.js)
- GET /some (paypal.js)
- POST /update (paypal.js)
- ...and 1 more
Products (products)
Defines the product records stored in the database, including price, images, and metadata for each product.
ProductsproductsProducts.jsSchema
| Field | Type |
|---|---|
Active |
Boolean |
Description |
String |
Discount |
Number |
Image |
String |
Placement |
Number |
Price |
Number |
ProductID |
Number |
Title |
String |
Tag |
String |
Url |
String |
PromoImage |
String |
Text |
String |
ProductType |
String |
Used By Routes (11)
- GET /flush (products.js)
- GET /all (products.js)
- GET /specialvideo (products.js)
- GET /videos (products.js)
- GET /allvideos (products.js)
- GET /getAd (products.js)
- GET /getVideoAd (products.js)
- GET /getAdSummary (products.js)
- GET /getAllAd (products.js)
- POST /updateAd (products.js)
- ...and 1 more
Profile (profiles)
Stores user profile information and securely saves passwords for login.
ProfileprofilesProfile.jsSchema
| Field | Type |
|---|---|
uid |
String |
profileId |
String |
name |
String |
profile |
String |
location |
String |
handle |
String |
password |
String |
dateCreated |
Date |
verified |
Boolean |
dateLastAccessed |
Date |
isPrivate |
Boolean |
isDeleted |
Boolean |
isMigrated |
Boolean |
Indexes
uid+profileId (compound, unique)
Used By Routes (8)
- GET /GetAllUsers (user.js)
- GET /checkpassword/:id (user.js)
- GET /handle/available (user.js)
- POST /handle/update (user.js)
- POST /verifyprofile (user.js)
- POST /addprofile (user.js)
- GET /count/profile (user.js)
- PUT /toggleProfile/:uid (user.js)
Prompts (prompts)
Stores prompt records including component, category, prompt text, job and upscale links for use by the application.
PromptspromptsPrompt.jsSchema
| Field | Type |
|---|---|
Component |
String |
Category |
String |
Prompt |
String |
JobID |
String |
JobUrl |
String |
UpscaleID |
String |
UpscaleUrl |
String |
UpscaleNum |
String |
FinalUrl |
String |
Indexes
Component+Category (compound, unique)
Ratings (ratings)
Stores user-submitted ratings for specific components within categories.
RatingsratingsRating.jsSchema
| Field | Type |
|---|---|
UserID |
String |
Category |
String |
Component |
String |
Type |
String |
Rating |
String |
Used By Routes (1)
- POST /AddRating (survey.js)
Region (regions)
Stores regional geographic names and identifiers for countries and regions.
RegionregionsRegion.jsSchema
| Field | Type |
|---|---|
codeid |
Number |
country |
String |
region |
String |
name2 |
String |
name3 |
String |
Used By Routes (1)
- GET /populatecity (cities.js)
Settings (settings)
Defines a Settings data model that stores a customer identifier (CID), an amount, and a value.
SettingssettingsSettings.jsSchema
| Field | Type |
|---|---|
CID |
String |
Amount |
Number |
Value |
Number |
Stripe (stripes)
Stores Stripe payment configuration and product details used by the application.
StripestripesStripe.jsSchema
| Field | Type |
|---|---|
useStripe |
Number |
platform |
String |
paymentMethod |
String |
stripeProducts |
String |
stripeProducts |
[{id |
price |
Number |
link |
String}] |
Indexes
none
Survey (surveys)
Stores survey records with a flexible schema so any fields can be saved.
SurveysurveysSurvey.jsSchema
| Field | Type |
|---|---|
dynamic (no fixed fields; strict |
false) |
Indexes
none
Used By Routes (1)
- POST /AddSurvey (survey.js)
Tarot (tarots)
Defines the Tarot card structure stored in MongoDB, describing fields like Key, Name, Type, and whether the card is reversed.
TarottarotsTarot.jsSchema
| Field | Type |
|---|---|
Key |
String |
Name |
String |
Type |
String |
Category |
String |
Phrase |
String |
Description |
String |
Language |
String |
Reversed |
Boolean |
Used By Routes (1)
- GET /get (tarot.js)
Used By Functions (1)
- doTranslate (tarot.js)
TarotReading (tarotreadings)
Stores tarot reading entries including drawn cards, the user's question, the AI response, timing, and basic metadata.
TarotReadingtarotreadingsTarotReading.jsSchema
| Field | Type |
|---|---|
cards |
String[] |
prompt |
String |
question |
String |
response |
String |
timer |
Number |
createdAt |
Date |
userIp |
String |
TarotSpread (tarotspreads)
Stores tarot spread templates including title, group, cards, and ordering info.
TarotSpreadtarotspreadsTarotSpread.jsSchema
| Field | Type |
|---|---|
Group |
String |
Title |
String |
Cards |
String |
CardTotal |
Number |
Index |
Number |
Order |
Number |
Active |
Number |
Featured |
String |
Indexes
none
Used By Routes (3)
- POST /addSpread (tarot.js)
- POST /updateSpread/:id (tarot.js)
- GET /getTarotSpreads (tarot.js)
Traits (Traits)
Stores personality trait records with category, component, value, language, and rating.
TraitsTraitsTraits.jsSchema
| Field | Type |
|---|---|
TraitsID |
Number |
Component |
String |
ComponentCategory |
String |
TraitsCategory |
String |
Value |
String |
Language |
String |
Rating |
Number |
Indexes
none
Used By Routes (9)
- GET /GetComponentTraits/:component/:componentCategory (component.js)
- GET /GetTraits (traits.js)
- GET /GetTraits/:id (traits.js)
- POST /AddTraits (traits.js)
- POST /UpdateTraitsByName (traits.js)
- PUT /UpdateTraits/:id (traits.js)
- DELETE /DeleteTraits/:id (traits.js)
- GET /GetComponentTraits (traits.js)
- POST /AddComponentTraits (traits.js)
User (users)
Stores user birth and account details for each person in the database.
UserusersUser.jsSchema
| Field | Type |
|---|---|
uid |
String |
profileId |
String |
name |
String |
day |
Number |
month |
Number |
year |
Number |
time |
String |
timezone |
String |
birthLocation |
String |
lat |
Number |
lng |
Number |
manual |
Boolean |
mainUser |
Boolean |
compatibility |
String |
data |
String |
isDeleted |
Boolean |
mainUserId |
String |
isMigrated |
Boolean |
Indexes
uid+profileId (compound, unique, collation: en, strength: 2)
Used By Routes (11)
- GET /findUser (user.js)
- POST /erase (user.js)
- DELETE /remove (user.js)
- GET /update-uids-to-lowercase (user.js)
- GET /user-count (user.js)
- GET /find-duplicates (user.js)
- PUT /edit/:id (user.js)
- POST /adduser (user.js)
- GET /getUsersID/:profileId (user.js)
- GET /connectedUsers/:uid (user.js)
- ...and 1 more
Views (views)
Records how many times a UI component has been viewed, organized by category and language.
ViewsviewsViews.jsSchema
| Field | Type |
|---|---|
Component |
String |
Category |
String |
Language |
String |
Views |
Number |
Used By Functions (1)
- updateItemView (views.js)
Views (views)
Exports the Mongoose model so other parts of the application can read and write view counts.
ViewsviewsViews.jsUsed By Functions (1)
- updateItemView (views.js)
Seo (seos)
Stores SEO metadata like title, description and keywords for site components and categories.
Seoseosseo.jsSchema
| Field | Type |
|---|---|
Component |
String |
Category |
String |
Title |
String |
Description |
String |
Keywords |
String |
Seo (seos)
Provides the Mongoose model for SEO entries so other files can read and write SEO data.
Seoseosseo.jsSchema
| Field | Type |
|---|---|
Component |
String |
Category |
String |
Title |
String |
Description |
String |
Keywords |
String |
Paypal (paypals)
Loads the Paypal Mongoose model used to read and write payment records.
Paypalpaypalspaypal.jsSchema
| Field | Type |
|---|---|
item_name |
string |
Intro |
string |
first_name |
string |
last_name |
string |
_id |
ObjectId |
custom |
string |
createdAt |
Date |
payer_email |
string |
from |
string |
subject |
string |
address_street |
string |
address_city |
string |
address_state |
string |
address_zip |
string |
payment_gross |
string |
og_email |
string |
Assigned |
string |
Used By Routes (11)
- GET /sendtarotemails (paypal.js)
- GET /all (paypal.js)
- GET /some (paypal.js)
- GET /get (paypal.js)
- POST /update (paypal.js)
- POST / (paypal.js)
- GET /sendtarotemails (paypal.js)
- GET /all (paypal.js)
- GET /some (paypal.js)
- POST /update (paypal.js)
- ...and 1 more
Paypal (paypals)
Declares and loads the Paypal model used to read and write payment records.
Paypalpaypalspaypal.jsSchema
| Field | Type |
|---|---|
item_name |
String |
Assigned |
String |
first_name |
String |
last_name |
String |
payer_email |
String |
address_street |
String |
address_city |
String |
address_state |
String |
address_zip |
String |
Intro |
String |
createdAt |
Date |
_id |
ObjectId |
Used By Routes (11)
- GET /sendtarotemails (paypal.js)
- GET /all (paypal.js)
- GET /some (paypal.js)
- GET /get (paypal.js)
- POST /update (paypal.js)
- POST / (paypal.js)
- GET /sendtarotemails (paypal.js)
- GET /all (paypal.js)
- GET /some (paypal.js)
- POST /update (paypal.js)
- ...and 1 more
Config (configs)
Stores configuration entries that track an identifier, an amount, and a numeric value.
Configconfigssettings.jsSchema
| Field | Type |
|---|---|
CID |
String |
Amount |
Number |
Value |
Number |
Used By Routes (1)
- GET /get/:id (settings.js)
Survey (surveys)
Handles survey documents stored in MongoDB; used to create and query surveys.
Surveysurveyssurvey.jsSchema
| Field | Type |
|---|---|
fields depend on Survey model (stored in MongoDB) |
String |
Used By Routes (1)
- POST /AddSurvey (survey.js)
Rating (ratings)
Handles rating documents stored in MongoDB; used to create and query ratings.
Ratingratingssurvey.jsSchema
| Field | Type |
|---|---|
fields depend on Rating model (stored in MongoDB) |
String |
Used By Routes (1)
- POST /AddRating (survey.js)
Component (components)
Manages component metadata stored in MongoDB; used to create and update component documents.
Componentcomponentssurvey.jsSchema
| Field | Type |
|---|---|
fields depend on Component model (stored in MongoDB) |
String |
Used By Routes (7)
- GET /Delete (component.js)
- POST /Update (component.js)
- GET /FlushDelete (component.js)
- GET /CheckForDuplicateKeys (component.js)
- GET /UpdateServerComponent (component.js)
- GET /CleanUpComponents (component.js)
- GET /GetCategory (component.js)
SEO (seo)
Manages SEO metadata stored in MongoDB; used to create SEO documents for components.
SEOseosurvey.jsSchema
| Field | Type |
|---|---|
fields depend on SEO model (stored in MongoDB) |
String |
AuraSoma (auraSomas)
Stores AuraSoma bottle details including colors, themes and spiritual information.
AuraSomaauraSomasaurasoma.jsSchema
| Field | Type |
|---|---|
bottleName |
String |
plants |
String |
bottleNumber |
String |
colors |
String |
gemsCrystals |
String |
bodyArea |
String |
belongsTo |
String |
relatedPomander |
String |
relatedQuintessence |
String |
mainTheme |
String |
affirmation |
String |
apply |
String |
angelsOfKabbalah |
String |
angelsPrincipalQuality |
String |
description |
String |
dominantCharacteristics |
String |
spiritualLevel |
String |
possibleChallengeAspects |
String |
mentalLevel |
String |
emotionalLevel |
String |
Used By Functions (1)
- scrapeAuraSoma (aurasoma.js)
Message (messages)
Stores user messages and chat content exchanged between users.
MessagemessagesmessageService.jsSchema
| Field | Type |
|---|---|
FromEmail |
String |
FromUserId |
String |
ToUserId |
String |
Content |
String |
Timestamp |
Date |
Status |
String |
Indexes
FromUserId (non-unique), ToUserId (non-unique)
Relations
- User (FromUserId), User (ToUserId)
Used By Routes (6)
- POST /SendMessage (messages.js)
- POST /SendEmail (messages.js)
- POST /SendNewMessage (messages.js)
- GET /GetUserMessages/:ToUserId (messages.js)
- GET /GetMessage/:FromUserId/:ToUserId (messages.js)
- GET /GetNewMessage/:FromUserId/:ToUserId (messages.js)
Used By Functions (3)
- saveMessage (messageService.js)
- markMessagesAsSeen (messageService.js)
- sendEmailMessage (messageService.js)
User (users)
Stores user account information and authentication details.
UserusersmessageService.jsSchema
| Field | Type |
|---|---|
_id |
ObjectId |
Email |
String |
Name |
String |
PasswordHash |
String |
Indexes
Email (unique)
Relations
- Message (FromUserId), Message (ToUserId)
Used By Routes (11)
- GET /findUser (user.js)
- POST /erase (user.js)
- DELETE /remove (user.js)
- GET /update-uids-to-lowercase (user.js)
- GET /user-count (user.js)
- GET /find-duplicates (user.js)
- PUT /edit/:id (user.js)
- POST /adduser (user.js)
- GET /getUsersID/:profileId (user.js)
- GET /connectedUsers/:uid (user.js)
- ...and 1 more
EXTERNAL APIS
api.openai.com
(1 endpoint)
Endpoints
POST https://api.openai.com/v1/chat/completions
Configures the OpenAI client used to generate AI-written relocation profiles.
Used By (5)
-
file-level(relocation.js) - loadPrompt (relocation.js)
- callAI (reports.js)
- generateMonthlyReading (reports.js)
- generateAssistantResponse (survey.js)
astromatrix.org
(11 endpoints)
Endpoints
POST https://astromatrix.org/API/Astrology/CalculateHoroscopes
Sends chart data to the Astromatrix API to compute horoscope data.
Used By (2)
- calculate (reports.js)
- calculateReport (reports.js)
GET http://astromatrix.org/API/Utility/GetBirthLocations
Looks up birth locations matching a small town name using an external astrology API and returns them.
Used By (1)
- file-level (cities.js)
GET https://astromatrix.org/API/Utility/GetBirthCityInfo
Fetches detailed city information for a town name from an external astrology API.
Used By (1)
- file-level (cities.js)
GET http://astromatrix.org/API/Utility/GetRegionCodes
Downloads region code data from an external API and inserts them into the Region collection.
Used By (1)
- file-level (cities.js)
GET https://astromatrix.org/API/Astrology/GetAllForecasts
Imports all forecasts from an external API into the local database and clears the cache. This route calls an external service to fetch all forecasts, replaces the local forecasts collection, and stores the items.
Used By (1)
- file-level (forecasts.js)
GET https://astromatrix.org/Api/notification/SendUserNotification
GET https://astromatrix.org/API/Utility/AddComponentTraits
Sends a GET request to add traits for a specific component to an external astromatrix service.
Used By (1)
- AddComponentTraits (survey.js)
GET https://astromatrix.org/API/Utility/HasComponentTraits
Checks whether a component already has traits by querying the astromatrix service.
Used By (1)
- checkComponentTraits (survey.js)
GET https://astromatrix.org/API/User/SwitchUserAccount
Switches account IDs across profiles and users, and notifies a legacy API.
Used By (1)
- file-level (user.js)
GET https://astromatrix.org/api/user/GetProfile
DEPRECATED: Adds a profile by fetching details from a legacy API if not present locally.
Used By (1)
- file-level (user.js)
POST https://astromatrix.org/API/Utility/GetFriends
Migrates users for a single profile UID by calling an external API and saving returned users locally. This function checks if users for the given mainUserId are already migrated, fetches friends from the external API, saves each user into the local users collection, and marks the profile as migrated.
Used By (1)
- migrateUsers (migrationService.js)
club.astromatrix.org
(1 endpoint)
Endpoints
POST https://club.astromatrix.org/events/metrics/updateMetric
Sends a metric payload to a remote metric ingestion endpoint.
Used By (2)
- sendMetric (metrics.js)
- file-level (metrics.js)
translation.googleapis.com
(1 endpoint)
Endpoints
GET https://translation.googleapis.com/language/translate/v2
Helper that translates a tarot entry into another language and saves the translated entry.
Used By (1)
- file-level (tarot.js)
email.us-west-2.amazonaws.com
(1 endpoint)
Endpoints
POST https://email.us-west-2.amazonaws.com
Sends an HTML email via AWS Simple Email Service (SES).
Used By (2)
- sendAWSEmail (messageService.js)
- sendEmailMessage (messageService.js)
FUNCTIONS
ErrorHandler [Utility]
Mounts metrics-related API endpoints under /events/metrics.
ErrorHandlerapp.jsErrorHandler [Utility]
Mounts AI-related API endpoints under /ai.
ErrorHandlerapp.jsemailTemplate [Utility]
Connects to MongoDB with the configured host and database.
emailTemplatepaypal.jsemailTemplate [Utility]
Builds a friendly email body and sets sender/subject based on order details. This function prepares the message text for different readers and products.
emailTemplatepaypal.jsParameters
| Name | Type | Description |
|---|---|---|
obj |
Object |
(uses obj.Assigned, obj.item_name, obj.first_name, obj.last_name, obj.payer_email, obj.address_street, obj.address_city, obj.address_state, obj.address_zip, obj.from) |
Returns
unknown
- string HTML email body
sendEmail [Utility]
Sends an email by calling the external SendAWSEmail utility. This function sends a prepared email object to the email-sending microservice.
sendEmailpaypal.jsParameters
| Name | Type | Description |
|---|---|---|
obj |
Object |
(uses obj.payer_email, obj.from, obj.subject, obj.item_name and emailTemplate output) |
Returns
unknown
- void
getAsn [Utility]
Looks up ASN and organization for an IP address and caches the result to speed future lookups.
getAsnaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
{string} ip - IP address to lookup |
any |
Returns
Promise<{asn:number, org:string, country:string|null
- >}
getClientIp [Utility]
Extracts the client's IP address from request headers and connection info, normalizing common proxies.
getClientIpaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
{import('express').Request} req - Express request object |
any |
Returns
string
- normalized IP address
normalizeIp [Utility]
Cleans and normalizes an IP address string (removes IPv4-mapped prefix, brackets, zone identifiers).
normalizeIpaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
{string} ip - raw IP string |
any |
Returns
string
- cleaned IP
getIPv6Prefix [Utility]
Returns a short IPv6 prefix (first 4 hextets) useful for coarse matching.
getIPv6Prefixaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
{string} ip - IPv6 address |
any |
Returns
string
- IPv6 prefix (first 4 segments)
isBot [Utility]
Heuristically determines whether a user-agent string likely belongs to a bot or crawler.
isBotaffiliates.jsParameters
| Name | Type | Description |
|---|---|---|
{string} ua - user-agent string |
any |
Returns
boolean
- true if agent appears to be a bot
prepareCategoryData [Utility]
Combines individual category calculators into a single object for easy access.
prepareCategoryDatarelocation.jsParameters
| Name | Type | Description |
|---|---|---|
planets |
array |
Array of planet objects with properties like planet, house, degree, extra. |
angles |
object |
Object of angle points (asc, mc, ic, dc) with extra metadata. |
Returns
unknown
- object - Object with wellness, roots, career, love, transformation scoring objects.
grade [Utility]
Converts a numeric score into a human-friendly letter grade and short label.
graderelocation.jsParameters
| Name | Type | Description |
|---|---|---|
score |
number |
The numeric score to grade. |
positive |
number |
(optional) Total positive points for polarity context. |
negative |
number |
(optional) Total negative points for polarity context. |
Returns
unknown
- string - A short human-readable grade like "A: Excellent" or "D: Challenging".
createScoreObject [Utility]
Creates a fresh score object used by category calculators to collect factors and totals.
createScoreObjectrelocation.jsReturns
unknown
- object - Score object with positive, negative, net, factor lists, and a grade.
addPositive [Utility]
Records a positive contribution into a score object and notes the reason.
addPositiverelocation.jsParameters
| Name | Type | Description |
|---|---|---|
scoreObj |
object |
Score object returned from createScoreObject. |
value |
number |
Numeric positive value to add. |
reason |
string |
Short human-readable reason for the boost. |
addNegative [Utility]
Records a negative contribution into a score object and notes the reason.
addNegativerelocation.jsParameters
| Name | Type | Description |
|---|---|---|
scoreObj |
object |
Score object returned from createScoreObject. |
value |
number |
Numeric negative value to add (should be positive number but is stored negative in context). |
reason |
string |
Short human-readable reason for the penalty. |
finalizeScore [Utility]
Finalizes a score object by applying small boosts/penalties, computing net and grade.
finalizeScorerelocation.jsParameters
| Name | Type | Description |
|---|---|---|
scoreObj |
object |
Score object with collected positives and negatives. |
Returns
unknown
- object - Mutated score object with net, score, and grade fields computed.
weightCurve [Utility]
Applies a gentle non-linear adjustment to a numeric score to emphasize extremes.
weightCurverelocation.jsParameters
| Name | Type | Description |
|---|---|---|
s |
number |
The raw net score. |
Returns
unknown
- number - Adjusted score after curve applied.
scorePlanet [Utility]
Gives a simple numeric weight to a planet based on whether it is considered benefic or malefic.
scorePlanetrelocation.jsParameters
| Name | Type | Description |
|---|---|---|
planet |
object |
Planet object with a "planet" property naming the body. |
Returns
unknown
- number - Weight value (positive for benefic, negative for malefic, 0 otherwise).
calculateCategoryScores [Utility]
Produces raw category tallies (positive/negative factors) across all planets.
calculateCategoryScoresrelocation.jsParameters
| Name | Type | Description |
|---|---|---|
planets |
array |
Array of planet objects with properties planet and house. |
Returns
unknown
- object - Object with categories wellness, roots, career, love, transformation each containing tallies.
pushScore [Utility]
Helper that pushes a numeric score into a category object and records a readable factor.
pushScorerelocation.jsParameters
| Name | Type | Description |
|---|---|---|
cat |
object |
Category tallies object with positive, negative, factorsPositive, factorsNegative. |
score |
number |
The score to apply (positive or negative). |
factor |
string |
Human-readable factor description. |
addVirtueBonusFromAngles [Utility]
Adds small "virtue" bonuses to categories when an angle's extra metadata indicates virtue.
addVirtueBonusFromAnglesrelocation.jsParameters
| Name | Type | Description |
|---|---|---|
categoryData |
object |
Object with category score objects (wellness, roots, career, love, transformation). |
angles |
object |
Angle points object with asc, ic, mc, dc which may have .extra.virtue flags. |
checkConj [Utility]
Checks if an angle has conjunct planets matching a list and records them as positive/negative on a score object.
checkConjrelocation.jsParameters
| Name | Type | Description |
|---|---|---|
angle |
object |
Angle object that may contain axisConjunct array. |
planetList |
array |
List of planet names to look for (e.g., ['Jupiter','Venus']). |
value |
number |
Numeric amount to add if a match is found. |
label |
string |
Label for the angle used in reason text. |
d |
object |
Score object (from createScoreObject) to mutate via addPositive/addNegative. |
polarity |
string |
'pos' or 'neg' to decide whether to add positive or negative. |
prepareWellnessData [Utility]
Builds the wellness score object by scanning planets for placements and conjunctions relevant to health and vitality.
prepareWellnessDatarelocation.jsParameters
| Name | Type | Description |
|---|---|---|
planets |
array |
Array of planet objects with properties planet, house, degree, axisConjunct. |
angles |
object |
Angle objects for asc, mc, ic, dc possibly containing axisConjunct and extra. |
Returns
unknown
- object - Finalized score object with grade and factors for wellness.
prepareRootsData [Utility]
Builds the roots/home score by scanning for planets in 2nd/4th houses and IC conjunctions.
prepareRootsDatarelocation.jsParameters
| Name | Type | Description |
|---|---|---|
planets |
array |
Array of planet objects. |
angles |
object |
Angle objects potentially containing IC data. |
Returns
unknown
- object - Finalized score object for roots (home, security).
prepareCareerData [Utility]
Builds the career score by scanning for planets in 10th/6th/2nd houses and MC conjunctions.
prepareCareerDatarelocation.jsParameters
| Name | Type | Description |
|---|---|---|
planets |
array |
Array of planet objects. |
angles |
object |
Angle objects potentially containing MC data. |
Returns
unknown
- object - Finalized score object for career.
prepareLoveData [Utility]
Builds the love/relationship score by scanning planets in 5th/7th/11th houses and DC conjunctions.
prepareLoveDatarelocation.jsParameters
| Name | Type | Description |
|---|---|---|
planets |
array |
Array of planet objects. |
angles |
object |
Angle objects potentially containing DC data. |
Returns
unknown
- object - Finalized score object for love and partnerships.
prepareTransformationData [Utility]
Builds the transformation/deep-change score by scanning 8th/12th houses and angle conjunctions.
prepareTransformationDatarelocation.jsParameters
| Name | Type | Description |
|---|---|---|
planets |
array |
Array of planet objects. |
angles |
object |
Angle objects for ic, mc, asc, dc that may trigger transformation. |
Returns
unknown
- object - Finalized score object for transformation potential.
generatePromptWithExtras [Utility]
Generates a rich prompt (HTML-like) for the AI using location, planets, and computed category data. The prompt includes formatted angles, category summaries, tone guidance, and an action plan request.
generatePromptWithExtrasrelocation.jsParameters
| Name | Type | Description |
|---|---|---|
location |
string |
Name of the place being analyzed. |
planets |
array |
Array of planet objects (used for angle extraction). |
categoryData |
object |
Scored category objects for wellness, roots, career, love, transformation. |
extraData |
array|string |
Additional textual data to include (like sabian, HD gates) - optional. |
Returns
unknown
- string - The assembled prompt to send to the OpenAI API.
getExtra [Utility]
Retrieves extra textual metadata for a single planet or axis, formatted for logging or prompts.
getExtrarelocation.jsParameters
| Name | Type | Description |
|---|---|---|
planets |
array |
Array of planet objects (with possible extra and axisConjunct fields). |
planet |
string |
Name of the planet or axis to fetch (e.g., "Ascendant", "Sun"). |
Returns
unknown
- string - Human-readable block of text describing the planet/axis, or a not-found message.
withinOrb [Utility]
Determines whether a planet degree lies within a given orb of an axis degree, accounting for wrap-around.
withinOrbrelocation.jsParameters
| Name | Type | Description |
|---|---|---|
pDegree |
number |
The absolute degree of the planet (0-360). |
axisDegree |
number |
The absolute degree of the axis point (0-360). |
orb |
number |
Acceptable orb in degrees (default 5). |
Returns
unknown
- boolean - True if the difference is within the orb, false otherwise.
tagAxisConjunctions [Utility]
Tags planets and axes with nearby axis conjunctions so other routines can react to those close contacts.
tagAxisConjunctionsrelocation.jsParameters
| Name | Type | Description |
|---|---|---|
planets |
array |
Array of planet objects, some of which may represent axes like "Ascendant". |
Returns
unknown
- array - New array of planet objects where each item may include axisConjunct: array|null.
loadPrompt [API Integration]
Main entry: creates a relocation report by calculating scores, assembling a prompt, and calling the OpenAI API. This returns the AI-written relocation profile as text.
loadPromptrelocation.jsParameters
| Name | Type | Description |
|---|---|---|
chart |
object |
The input chart object used by reports.calculate to produce planetary positions and metadata. |
Returns
unknown
- string - Text response from the AI describing relocation considerations for the computed location.
Throws
- Error - Propagates errors from report calculation or OpenAI API calls.
External APIs Called
calculate [API Integration]
Sends chart data to the Astromatrix API to compute horoscope data.
calculatereports.jsParameters
| Name | Type | Description |
|---|---|---|
chartData |
object |
Returns
object
- Raw API response data
Throws
- Error if the external API call fails
External APIs Called
calculateReport [API Integration]
Runs a monthly horoscope calculation, logs raw transit/forecast lines, and optionally generates a monthly AI reading.
calculateReportreports.jsParameters
| Name | Type | Description |
|---|---|---|
chartData |
object |
Returns
object
- Cleaned data or generated monthly reading (if type === "self")
Throws
- Error if underlying calculation fails
External APIs Called
clean [Utility]
Normalizes raw API result into structured transits, forecasts, natal info, and metadata.
cleanreports.jsParameters
| Name | Type | Description |
|---|---|---|
result |
array |
Returns
object
- { transits:[], forecasts:[], natal:{}, metadata:{} }
cleanTransits [Utility]
Cleans raw transit entries and extracts key fields like planet, house, aspect, dates, and priority.
cleanTransitsreports.jsParameters
| Name | Type | Description |
|---|---|---|
transits |
array |
Returns
array
- Cleaned transit objects
cleanForecasts [Utility]
Cleans raw forecast entries and classifies them as lunations, retrogrades, ingresses, or general transits.
cleanForecastsreports.jsParameters
| Name | Type | Description |
|---|---|---|
forecasts |
array |
Returns
array
- Cleaned forecast objects
cleanNatal [Utility]
Extracts natal chart points and houses into a consistent structure for later matching.
cleanNatalreports.jsParameters
| Name | Type | Description |
|---|---|---|
birthData |
object |
Returns
object
- natal { aspects, chakras, facets, points, houses }
calculatePriority [Utility]
Computes a priority score for a transit based on planet, target, house, aspect, and duration.
calculatePriorityreports.jsParameters
| Name | Type | Description |
|---|---|---|
planet |
string, |
targetPlanet:string, house:string, aspect:string, duration:number |
Returns
number
- priority (higher = more important)
calculateForecastPriority [Utility]
Assigns a priority for forecast events like lunations, retrogrades, and ingress-like items.
calculateForecastPriorityreports.jsParameters
| Name | Type | Description |
|---|---|---|
type |
string, |
retroInfo:object |
Returns
number
- priority
classifyTerm [Utility]
Classifies an event term length as 'short', 'medium', or 'long' based on duration in days.
classifyTermreports.jsParameters
| Name | Type | Description |
|---|---|---|
duration |
number |
Returns
string
- 'short'|'medium'|'long'
aspectTone [Utility]
Maps an aspect name to an overall tone label: harmonious, challenging, or neutral.
aspectTonereports.jsParameters
| Name | Type | Description |
|---|---|---|
aspect |
string |
Returns
string
- tone
filterByMonth [Utility]
Filters cleaned horoscope data to include only events relevant to a given month and computes facet scores, key dates, and highlight groupings.
filterByMonthreports.jsParameters
| Name | Type | Description |
|---|---|---|
data |
object, |
year:number, month:number, minPriority:number |
Returns
object
- filtered result with grouped events, facet scores, facet_tone, key_dates, and summaries
toWeight [Utility]
Converts a priority score into a numeric weight used for summing facet importance.
toWeightreports.jsParameters
| Name | Type | Description |
|---|---|---|
item |
object |
Returns
number
- weight
addFacetScore [Utility]
Adds a weighted score to a facet's running total.
addFacetScorereports.jsParameters
| Name | Type | Description |
|---|---|---|
facetScores |
object, |
facet:string, weight:number |
bumpFacetTone [Utility]
Increments the harmonious/challenging counters for a facet based on an aspect tone.
bumpFacetTonereports.jsParameters
| Name | Type | Description |
|---|---|---|
facet |
string, |
tone:string, facetTone:object |
addKeyDate [Utility]
Records an event under a specific date if it meets the minimum priority threshold for key dates.
addKeyDatereports.jsParameters
| Name | Type | Description |
|---|---|---|
keyDates |
object, |
date:string, item:object |
logRawTransitForecasts [Utility]
Logs raw transit and forecast entries in a compact, grouped-by-facet format for QA.
logRawTransitForecastsreports.jsParameters
| Name | Type | Description |
|---|---|---|
cleaned |
object |
printSummary [Utility]
Prints a human-friendly summary of the filtered data including sections, facets, and weights for debugging.
printSummaryreports.jsParameters
| Name | Type | Description |
|---|---|---|
data |
object, |
year:number, month:number, minPriority:number |
buildAIPayload [Utility]
Builds a compact, weighted payload of top facets, highlights, timeline, and forecast notes for AI summarization.
buildAIPayloadreports.jsParameters
| Name | Type | Description |
|---|---|---|
filteredData |
object, |
{year:number, month:number}:object |
Returns
object
- payload structured for AI input
buildBasePrompt [Utility]
Builds the textual prompt to send to the AI using the month string and structured payload.
buildBasePromptreports.jsParameters
| Name | Type | Description |
|---|---|---|
monthStr |
string, |
payload:object |
Returns
string
- prompt text
callAI [API Integration]
Calls the OpenAI chat completions API using the configured OpenAI client to generate horoscope text.
callAIreports.jsParameters
| Name | Type | Description |
|---|---|---|
prompt |
string |
Returns
string
- AI-generated text (or an error placeholder)
External APIs Called
generateMonthlyReading [API Integration]
Runs the complete AI generation pipeline: build payload, log inputs, prompt AI, log output, and return full result for storage or A/B testing.
generateMonthlyReadingreports.jsParameters
| Name | Type | Description |
|---|---|---|
filteredData |
object, |
{year:number, month:number}:object |
Returns
object
- { month, ai_input, prompt, result, filteredData }
External APIs Called
categorizeQuestion [Utility]
Categorizes a question by analyzing keywords
categorizeQuestiontarotreading.jsgetRandomTarotCards [Utility]
Draws three random tarot cards using seedrandom for consistency
getRandomTarotCardstarotreading.jscleanAndParseJson [Utility]
Cleans and parses JSON response from OpenAI
cleanAndParseJsontarotreading.jsloadPrompt [Utility]
Load prompt template from file
loadPrompttarotreading.jsreplaceVariables [Utility]
Replace template variables in prompt
replaceVariablestarotreading.jslogReading [Utility]
Log reading to monthly log file
logReadingtarotreading.jsgetCurrentPromptVersion [Utility]
Get current prompt version from logs
getCurrentPromptVersiontarotreading.jsgetTarotOracleReading [Utility]
Main function to generate a tarot oracle reading
getTarotOracleReadingtarotreading.jsParameters
| Name | Type | Description |
|---|---|---|
{string} question - The user's question |
any |
Returns
Promise<Object>
- Reading result with cards, positions, and interpretation
escapeSingleQuotes [Utility]
Escapes single quotes in a string to make the string safe for embedding in HTML or attributes.
escapeSingleQuotesai.jsParameters
| Name | Type | Description |
|---|---|---|
{string} jsonString - The input string which may contain single quotes. |
any |
Returns
string
- The input string with all single quotes replaced by the HTML entity '.
cleanAndParseJson [Utility]
Parses a raw AI response and extracts a JSON object while logging helpful debug information. This function attempts to remove markdown code fences, find the JSON substring, parse it, and validate an expected TarotReading structure.
cleanAndParseJsonai.jsParameters
| Name | Type | Description |
|---|---|---|
{string} prompt - The prompt sent to the AI (kept for logging/debug). |
any |
|
{string} question - The user's question (kept for logging/debug). |
any |
|
{string} rawResponse - The raw text response returned by the AI that should contain JSON. |
any |
Returns
Object
- The parsed JSON object from the AI response.
Throws
- {Error} When JSON cannot be found, parsed, or does not match the expected structure (e.g., no TarotReading or wrong card count).
tokenise [Utility]
Tokenises an aspect name into sections, treating multi-word bodies (e.g. "Part of Fortune") as single tokens.
tokeniseastro-naming.jsParameters
| Name | Type | Description |
|---|---|---|
{string} name |
any |
Returns
string[]
- tokens
reverseAspectKey [Utility]
Reverses an aspect component name, correctly handling multi-word planet/point names. Strips any leading category prefix (Draconic/Composite/Progressed/Natal) before reversing and re-attaches it afterward. Examples: "Mars Square Uranus" -> "Uranus Square Mars" "North Node Conjunct Part of Fortune" -> "Part of Fortune Conjunct North Node" "Draconic Mars Square Uranus" -> "Draconic Uranus Square Mars"
reverseAspectKeyastro-naming.jsParameters
| Name | Type | Description |
|---|---|---|
{string} name |
any |
Returns
string
insertNatalBeforeTarget [Utility]
Inserts "Natal" before the second body (the target planet/point) of an aspect, respecting multi-word bodies so the word is never inserted inside a body. This is the canonical Transit Aspect form. "Mars Square Uranus" -> "Mars Square Natal Uranus" "Neptune Opposition Part of Fortune" -> "Neptune Opposition Natal Part of Fortune" "North Node Sextile Jupiter" -> "North Node Sextile Natal Jupiter"
insertNatalBeforeTargetastro-naming.jsParameters
| Name | Type | Description |
|---|---|---|
{string} name - Aspect name without "Natal". |
any |
Returns
string
updateTitle [Utility]
Ensures a transit component title includes "Natal" and removes "Transit" for Transit Aspects. Also ensures Draconic/Composite Aspects have the correct prefix on the component name.
updateTitleastro-naming.jsParameters
| Name | Type | Description |
|---|---|---|
{string} component - The component title to adjust. |
any |
|
{string} category - The category name to inspect. |
any |
Returns
string
- Adjusted component title.
normalizeComponentName [Utility]
Normalises the SURFACE FORM of a component name (abbreviations + casing) without touching the aspect/prefix structure. This is the single shared abbreviation normaliser used by BOTH the read path (component.js findComponent) and the write path (canonicaliseName below + admin.js), so the two can never drift. Merged from the formerly-duplicated copy that lived in component.js (Ic/Dc/Ac/Mc) plus the node/fortune shorthands handled here previously. - "Part Of Fortune" / "Part of fortune" -> "Part of Fortune" - angle abbreviations all-caps: Ic->IC, Dc->DC, Ac->AC, Mc->MC (DC=Descendant, IC=Imum Coeli, AC=Ascendant, MC=Midheaven); word boundaries so "Inconjunct" is safe - node shorthand: Nn->North Node, Sn->South Node
normalizeComponentNameastro-naming.jsParameters
| Name | Type | Description |
|---|---|---|
{string} name |
any |
Returns
string
canonicaliseName [Utility]
Normalises a raw component name to its canonical stored form: - normalizeComponentName (abbreviations + Part of Fortune casing) - updateTitle (strips "Transit ", inserts "Natal", adds Draconic/Composite prefix) This is what the AI-write path runs so the stored key always matches what a lookup resolves to.
canonicaliseNameastro-naming.jsParameters
| Name | Type | Description |
|---|---|---|
{string} name |
any |
|
{string} category |
any |
Returns
string
run [Utility]
Run a single support task. Designed to be called from an HTTP handler.
runautosupport-core.jsParameters
| Name | Type | Description |
|---|---|---|
{object} opts |
any |
|
{string} opts.mode one of VALID_MODES (e.g. 'write', 'validate') |
any |
|
{boolean} opts.dry if true, forces dry/preview behaviour |
any |
|
{number} [opts.limit] optional thread limit |
any |
|
{function} [opts.log] optional (line |
string)=>void |
sink; defaults to console |
Returns
Promise<{mode,dry,limit,ok,error?
- >}
generateReply [Utility]
Generate a reply for a normalized review.
generateReplyreviews-common.jsParameters
| Name | Type | Description |
|---|---|---|
{object} review { rating |
number, |
text:string } |
{object} opts { platform |
string, |
replyMax:number } |
listTasks [Utility]
List all task names that have a log file, by scanning the logs dir. Lets the viewer auto-discover new tasks without code changes.
listTasksrunlog.jsclearTask [Utility]
Clear (truncate) a single task's log file. Returns true if the file existed.
clearTaskrunlog.jsappendRun [Utility]
Append one run record to the task's log file.
appendRunrunlog.jsParameters
| Name | Type | Description |
|---|---|---|
{string} task e.g. 'support' |
any |
|
{object} record arbitrary JSON-serialisable run summary |
any |
readRuns [Utility]
Read the most recent N runs for a task, newest first.
readRunsrunlog.jsParameters
| Name | Type | Description |
|---|---|---|
{string} task |
any |
|
{number} limit max runs to return (default 20) |
any |
updateLocation [Utility]
Updates a single city document by looking up the province name from the Region collection and saving it.
updateLocationcities.jsParameters
| Name | Type | Description |
|---|---|---|
{Object} loc - City document to update |
any |
updateLocations [Utility]
Finds up to 1000 city documents with empty FullName and queues them for updating.
updateLocationscities.jsdoTranslate [Utility]
Translates a component object into the requested language and inserts it into the database.
doTranslatecomponent.jsParameters
| Name | Type | Description |
|---|---|---|
{Object} obj - Component object to translate (must include Description). |
any |
|
{Object} req - Express request object (reads req.query.Language). |
any |
|
{Object} res - Express response object used to send results or errors. |
any |
addItem [Utility]
Adds a language item to the language collection for non-English entries if missing.
addItemcomponent.jsParameters
| Name | Type | Description |
|---|---|---|
{Object} obj - Source component object (uses obj.Language, obj.Key, obj.Category, obj.Component, obj.Phrase). |
any |
|
{string} type - The type of language entry to add ("Item" or "Phrase"). |
any |
translateItem [Utility]
Translates and stores a language item if not already present for a given language.
translateItemcomponent.jsParameters
| Name | Type | Description |
|---|---|---|
{Object} obj - Language item object (expects obj.Value and obj.Type). |
any |
|
{string} lang - Target language code. |
any |
checkTranslate [Utility]
Iterates English language items of a given type and ensures translations exist for the target language.
checkTranslatecomponent.jsParameters
| Name | Type | Description |
|---|---|---|
{string} lang - Target language code. |
any |
|
{string} type - Type of language items to check (e.g., "Tag"). |
any |
splitCombinedComponent [Utility]
Splits a combined "Planet in Sign in House" component name into its atomic parts. Mirrors the read-side sign+house split logic so generation stays consistent with lookup. Returns null if the name is not a combined sign+house name.
splitCombinedComponentcomponent.jsParameters
| Name | Type | Description |
|---|---|---|
{string} name - Component name e.g. "Venus in Aries in 12th House". |
any |
Returns
{ planet:string, signPart:string, housePart:string
- | null}
ensureAtomicComponent [Utility]
Generates and stores a single ATOMIC component only if it doesn't already exist with a real description. Never writes combined keys.
ensureAtomicComponentcomponent.jsParameters
| Name | Type | Description |
|---|---|---|
{string} name - Atomic component name e.g. "Venus in Aries". |
any |
|
{string} category - Category for this atomic part. |
any |
createComponentAI [Utility]
Attempts to generate AI content for components that lack meaningful descriptions. For combined "Planet in Sign in House" lookups it generates only the missing ATOMIC parts (the sign part and the house part) and NEVER writes a combined-key doc -- the read path reconstructs combined descriptions from the atomic parts.
createComponentAIcomponent.jsParameters
| Name | Type | Description |
|---|---|---|
{Object} obj - Component object (uses obj.Description, obj.Component, obj.Category). |
any |
findComponent [Utility]
Finds a component document by exact or reversed Key to support lookups.
findComponentcomponent.jsParameters
| Name | Type | Description |
|---|---|---|
{string} Id - The item Id to search for. |
any |
|
{string} lang - Language code (e.g., "en"). |
any |
|
{string} componentName - Component name to search. |
any |
|
{string} category - Category to constrain search. |
any |
Returns
Promise<Array>
- Array of matching component documents.
findLatestForecast [Utility]
For Forecasts requested without a valid Id (0 or null), find the most recent matching doc by Key, ignoring Id. Also tries a decan-stripped key for lunar/eclipse events (e.g. "Full Moon in Sagittarius Decan 2" -> "Full Moon in Sagittarius"). "Most recent" = highest Id, then newest _id (ObjectId carries a creation timestamp).
findLatestForecastcomponent.jsParameters
| Name | Type | Description |
|---|---|---|
{string} lang - Language code (e.g. "en"). |
any |
|
{string} componentName - Component/key name to search. |
any |
|
{string} category - Category to constrain search (expected "Forecasts"). |
any |
Returns
Promise<Object|null>
- The most recent matching forecast doc, or null.
updateDescription [Utility]
Removes a specific phrase and everything after it from the description string.
updateDescriptioncomponent.jsParameters
| Name | Type | Description |
|---|---|---|
{Object} obj - Object containing Description field. |
any |
|
{string} phrase - Phrase indicating where to cut off the description. |
any |
Returns
string
- The cleaned description.
handleLanguageSpecificReplacements [Utility]
Adjusts the query for language-specific category and component formatting.
handleLanguageSpecificReplacementscomponent.jsParameters
| Name | Type | Description |
|---|---|---|
{Object} query - The request query object (mutated by this function). |
any |
detectCollapseRisk [Utility]
Run BEFORE any AI call. Fast, deterministic, safety-critical.
detectCollapseRiskcrucible-detection.jsParameters
| Name | Type | Description |
|---|---|---|
{string} query |
any |
Returns
{ detected, state, level, isCrisis, isWithdrawal, isOffering, categories
- }
applyOrientSignals [Utility]
Apply signals from orient classifier to profile. Increases confidence based on what was detected.
applyOrientSignalscrucible-profile.jsParameters
| Name | Type | Description |
|---|---|---|
{Object} profile |
any |
|
{Object} signals — from orient classifier |
any |
Returns
Object
- updated profile
buildContextString [Utility]
Builds a compact context string to inject into classifier and responder prompts. Gracefully degrades when data is missing.
buildContextStringcrucible-profile.jsgetPrompt [Utility]
Get a prompt by phase name with variable substitution.
getPromptcrucible-prompt-loader.jsParameters
| Name | Type | Description |
|---|---|---|
{string} name - Phase name or COLLAPSE_SEVERE / COLLAPSE_EXISTENTIAL / COLLAPSE_MODERATE |
any |
|
{Object} variables - {{key}} replacements |
any |
Returns
Promise<string>
updateUserState [Utility]
Update state after each interaction
updateUserStatecrucible-state.jsParameters
| Name | Type | Description |
|---|---|---|
{string} userId |
any |
|
{string} sessionId |
any |
|
{Object} update |
any |
getSessionContext [Utility]
Build minimal session context for classifier prompt Only behavioral signals — no content
getSessionContextcrucible-state.jsParameters
| Name | Type | Description |
|---|---|---|
{string} userId |
any |
|
{string} sessionId |
any |
Returns
Promise<Object>
addDays [Utility]
Adds a number of days to a given date and returns the new date.
addDaysforecasts.jsParameters
| Name | Type | Description |
|---|---|---|
date |
Date, |
days:number |
Returns
unknown
- Date
getForecast [Data Service]
Fetches forecasts from the database that match the provided date and type. This helper queries the forecasts collection using different filters depending on the requested type.
getForecastforecasts.jsParameters
| Name | Type | Description |
|---|---|---|
date |
Date, |
type:string, limit:number |
Returns
unknown
- Promise<Array>
Models Used
tryTypeQuery [Data Service]
Chooses the appropriate fallback query when page is not provided and returns help entries with non-empty descriptions.
tryTypeQueryhelp.jsParameters
| Name | Type | Description |
|---|---|---|
section |
string, |
type:string |
Returns
Array of help objects with non-empty Description
Throws
- 400
Models Used
findMatchingQuestion [Utility]
Finds a corresponding support question or response object in the astromatrixIssue map.
findMatchingQuestionmessages.jsParameters
| Name | Type | Description |
|---|---|---|
{string} content - The incoming message content to check against known issues/options. |
any |
Returns
object|null
- The matching question/response object or null if none found.
checkRequireLogin [Utility]
Checks whether a given support issue requires the user to be logged in.
checkRequireLoginmessages.jsParameters
| Name | Type | Description |
|---|---|---|
{string} type - The issue type or message content to evaluate. |
any |
Returns
boolean
- True if the issue requires login, otherwise false.
sendAWSEmail [Utility]
Sends an email using AWS SES.
sendAWSEmailmessages.jsParameters
| Name | Type | Description |
|---|---|---|
{string} to - Recipient email address. |
any |
|
{string} from - Sender email address. |
any |
|
{string} subject - Email subject line. |
any |
|
{string} htmlBody - HTML content of the email. |
any |
Returns
Promise<object>
- Returns { success:true, messageId } on success or { success:false, error } on failure.
sendMetric [API Integration]
Sends a metric payload to a remote metric ingestion endpoint.
sendMetricmetrics.jsParameters
| Name | Type | Description |
|---|---|---|
name |
string, |
type:string, value:number, labels:object, endpoint:string |
External APIs Called
getConsciousnessLevel [Utility]
Maps a video title to a simple human-readable "consciousness level" label.
getConsciousnessLevelproducts.jsParameters
| Name | Type | Description |
|---|---|---|
title |
string |
Returns
unknown
- string
AddComponentTraits [API Integration]
Sends a GET request to add traits for a specific component to an external astromatrix service.
AddComponentTraitssurvey.jsParameters
| Name | Type | Description |
|---|---|---|
component |
string, |
category:string, traitsCategory:string, value:string |
External APIs Called
generateAssistantResponse [API Integration]
Generates AI content using OpenAI and updates or creates component and SEO documents depending on the type.
generateAssistantResponsesurvey.jsParameters
| Name | Type | Description |
|---|---|---|
type |
string, |
component:string, category:string, promp:string, temperature:number |
Returns
string|null
- Assistant response (text) or null
Throws
- 500
External APIs Called
Models Used
- Component, SEO
checkComponentTraits [API Integration]
Checks whether a component already has traits by querying the astromatrix service.
checkComponentTraitssurvey.jsParameters
| Name | Type | Description |
|---|---|---|
component |
string, |
category:string, traitcategory:string, callback:function |
Returns
unknown
- void (calls callback with the response body)
External APIs Called
countWords [Utility]
Counts words in a string by splitting on whitespace.
countWordssurvey.jsParameters
| Name | Type | Description |
|---|---|---|
str |
string |
Returns
unknown
- number Number of words in the provided string
generateAI [Utility]
Builds a textual prompt for different AI tasks based on the provided type and inputs. This creates human-friendly instructions used to request AI-generated content.
generateAIsurvey.jsParameters
| Name | Type | Description |
|---|---|---|
type |
string, |
title:string, item:string, pre:string, words:string |
Returns
unknown
- string The prompt text to send to the AI
doTranslate [Data Service]
Translates an English tarot entry into the requested language and saves it. Returns null (never throws) so callers can always safely res.json(response).
doTranslatetarot.jsParameters
| Name | Type | Description |
|---|---|---|
obj |
object, |
req.query.language:string, req.query.key:string, res:object |
Models Used
containsZodiacSign [Utility]
Checks whether a given text contains any zodiac sign phrase (like "in Aries").
containsZodiacSigntraits.jsParameters
| Name | Type | Description |
|---|---|---|
{string} str - The text to check. |
any |
Returns
boolean
removeZodiacSign [Utility]
Removes the first matching zodiac sign phrase from the given text, if present.
removeZodiacSigntraits.jsParameters
| Name | Type | Description |
|---|---|---|
{string} str - The text to modify. |
any |
Returns
string
switchAspect [Utility]
Swaps the first and third word in a short phrase to try an alternate aspect wording.
switchAspecttraits.jsParameters
| Name | Type | Description |
|---|---|---|
{string} str - The phrase to switch. |
any |
Returns
string
getComponentTraits [Utility]
Retrieves trait entries that match a component, category, and optional traitsCategory.
getComponentTraitstraits.jsParameters
| Name | Type | Description |
|---|---|---|
{string|undefined} component - The component to filter by (optional). |
any |
|
{string} category - The component category to filter by. |
any |
|
{string|undefined} traitsCategory - The traits category to filter by (optional). |
any |
Returns
Promise<Array>
- Array of matching trait documents.
Throws
- Error
updateComponentTraitsByID [Utility]
Updates the Value of a trait entry given its ID.
updateComponentTraitsByIDtraits.jsParameters
| Name | Type | Description |
|---|---|---|
{string} id - The MongoDB document ID to update. |
any |
|
{any} value - The new value to set. |
any |
Returns
Promise<{Success:boolean,Message:string,Data:array
- >}
updateItemView [Data Service]
Increments the view counter for a given component/category/language, or creates a new record with Views = 1 if none exists.
updateItemViewviews.jsParameters
| Name | Type | Description |
|---|---|---|
ComponentName |
string, |
Category:string, Language:string, Views:number |
Returns
unknown
- void
Models Used
scrapeAuraSoma [Data Service]
Scrapes a single Aura-Soma product page and saves its details to the database.
scrapeAuraSomaaurasoma.jsParameters
| Name | Type | Description |
|---|---|---|
url |
string |
Returns
unknown
- void
Throws
- Error
Models Used
scrapeProductLinks [Utility]
Loads the Aura-Soma product listing page, extracts product links, and scrapes each product page.
scrapeProductLinksaurasoma.jsParameters
| Name | Type | Description |
|---|---|---|
none |
any |
Returns
unknown
- void
Throws
- Error
MONGO_URI [Utility]
finalize-crystals.js --------------------------------------------------------------------------- Post-processes the generated transparent crystal PNGs into the web tiers: - keeps <Name>.png (full-quality transparent master) - writes <Name>.webp (1024, transparent, ~80-120KB -- the served image) - writes <Name>-sm.webp (500px transparent thumbnail) No regeneration / no API cost — pure sharp re-encode. With --apply, points each crystal component's Image at /images/Crystals/<Name>.webp (all languages of that Key). Flags: (default) make webp files + preview DB match counts --apply also update components.Image --only S only files whose name contains S ---------------------------------------------------------------------------
MONGO_URIfinalize-crystals.jsMONGO_URI [Utility]
generatecrystals.js --------------------------------------------------------------------------- The 96 Crystals components currently borrow random unrelated images. This generates a clean, named-correct, TRANSPARENT image for each crystal: 1. Nano Banana renders the crystal as a photoreal specimen on plain white. 2. @imgly/background-removal-node cuts the background to alpha. 3. Trim + centre on a square transparent canvas -> Crystals/<Name>.png. Saves under OUTPUT_DIR/Crystals (mirrors the host /images/Crystals tree). Idempotent: skips a crystal whose .png already exists (unless --force). Flags: (default) list only (no spend) --generate render + cut + save PNGs --apply point the components' Image at /images/Crystals/<Name>.png --force redo even if the PNG exists --limit N first N (counts only ones actually done) --only STR crystals whose name contains STR --out DIR output dir (default scripts/astro-images) --img-model M OpenRouter image model (default google/gemini-2.5-flash-image) ---------------------------------------------------------------------------
MONGO_URIgeneratecrystals.jsMONGO_URI [Utility]
requeue-regenerated.js --------------------------------------------------------------------------- After regenerating images, send the NEW ones back through the original QA reviewer. imageQA.js skips any URL already in image-reviews, so to force a fresh review we remove the stale review docs for images we've regenerated. imageQA (run afterwards, without --all) then re-scores them and re-flags any that are still bad. "Regenerated" = a review doc flagged needs_update (no reuse suggestion) whose output file now exists under scripts/astro-images. So this only requeues images we've actually remade — deploy them first so QA scores the NEW art. Flags: (default) dry run — report what would be requeued, by folder --apply delete those review docs so imageQA re-reviews them --category STR limit to one folder ---------------------------------------------------------------------------
MONGO_URIrequeue-regenerated.jsbuildMongoUri [Utility]
Triggers migration for all accounts that lost significant profiles (>= 50 lost). Calls the migration service directly (not via HTTP) so it runs with the fixed code. Run: node scripts/recovery-sweep-migration.js
buildMongoUrirecovery-sweep-migration.jsbuildMongoUri [Utility]
Top-up from June 11 backup: inserts profiles that existed in temp_june11 but are now missing from the live DB (native MongoDB profiles not in SQL). Run AFTER recovery-sweep-migration.js (SQL profiles restored first). Run: node scripts/recovery-topup-june11.js Dry-run by default. Pass --write to actually insert.
buildMongoUrirecovery-topup-june11.jsgateBase [Utility]
Base type for a gate: Element/Modality from its sign, Circuit from gate circuitry.
gateBasebase-types.jsgateFromDegree [Utility]
The gate (1-64) occupying an ABSOLUTE ecliptic degree (0 = 0° Aries), via the fixed gate wheel. Inverse of the GATE_SIGN computation -- used to map a Sabian symbol's degree to its I Ching gate.
gateFromDegreebase-types.jsgateLineDegree [Utility]
Midpoint absolute degree of a given gate's line (1-6) -- inverse of gateLineFromDegree. Used to measure degree-proximity between an I Ching hexagram.line and a Sabian degree.
gateLineDegreebase-types.jsgateLineFromDegree [Utility]
The gate AND line (1-6) at an absolute degree. Each gate spans GATE_WIDTH and divides into 6 lines of GATE_WIDTH/6 (0.9375°). Maps a zodiac degree -> hexagram.line.
gateLineFromDegreebase-types.jscenterOf [Utility]
Energetic center for a decomposed part. A gate is EXACT (GATE_CENTER); a bare planet uses the approximate PLANET_CENTER_FALLBACK. Never falls back if a gate exists.
centerOfbase-types.jschannelBase [Utility]
Structural base for a channel: its two gates, the centers it bridges, and its circuit (the shared circuit of its gates, else 'Mixed'). All derived.
channelBasebase-types.jsbodyPartOf [Utility]
Anatomical body region(s) for a part, via its sign (medical astrology).
bodyPartOfbase-types.jschakraOf [Utility]
Resolve any decomposed part {type,name} to its body-zone chakra, or null.
chakraOfbase-types.jshouseBase [Utility]
Element/Modality for a house, from its natural sign (1st->Aries ... 12th->Pisces).
houseBasebase-types.jsbaseOf [Utility]
Resolve any decomposed part {type,name} to its base type, or null if unknown.
baseOfbase-types.jsisAmplifier [Utility]
Is this part an amplifier body (asteroid / Vertex / Part of Fortune)?
isAmplifierbase-types.jsclassifyBody [Utility]
Classify a single decomposed part into {domain, expression} via its base type.
classifyBodyclassify.jscontextFor [Utility]
Decide the context flag from the component category (synastry/composite = relationship).
contextForclassify.jsplacementOverride [Utility]
PLACEMENT-level overrides -- depend on the sign/house and classify the whole component (short-circuit). Self context only. First match wins.
placementOverrideclassify.jsbodyOverride [Utility]
BODY-level override -- a single body's intrinsic classification, applied to ITS pole only (so in an aspect it does not hijack the whole component). Self context only. Evolution here is EARNED by specific bodies, and (per the headline ranking in classify) only leads when no element pole outranks it.
bodyOverrideclassify.jsclassify [Utility]
Classify a component into the Matrix taxonomy. LOOKUP-FIRST: if a stored Facet (the existing balanced per-component attribution) is supplied, it IS the expression and decides the domain. Base-type derivation only runs as the fallback for components without a stored Facet.
classifyclassify.jsParameters
| Name | Type | Description |
|---|---|---|
{string} name |
any |
|
{string} [category] |
any |
|
{object} [opts] |
any |
|
{string} [opts.storedFacet] - the component's stored Facets value, if any |
any |
|
{string} [opts.context] - force 'self' | 'relationship' |
any |
Returns
{context, domain, expression, source, classifications, parts, layer, override?, reason?
- }
classifyFromBase [Utility]
Classify directly from a raw Element + Modality (no component name needed). Used for nodes whose base type is known structurally rather than by decomposition -- e.g. Tarot court cards (suit element + rank-as-modality).
classifyFromBaseclassify.jsReturns
{context, domain, expression, coordinate
- }
classifyGate [Utility]
Classify an I Ching gate (number 1-64) into the Matrix taxonomy. Element + Modality (from the gate's sign) drive domain + expression -- the same law as planets. Circuit (social-function layer) is METADATA only: it is NOT a domain driver (no Evolution override), mirroring the fix that tamed Evolution dominance.
classifyGateclassify.jsReturns
{context, domain, expression, coordinate, gate, sign, circuit, boundary
- }
classifyChannel [Utility]
Classify a channel (two gates) -- a COMPOSITE that surfaces BOTH gates' poles, like an aspect. Returns the bridged centers + circuit (structural), the primary coordinate, and `coordinates` = both poles' coordinates (deduped) for the graph.
classifyChannelclassify.jsReturns
{context, gates, key, centers, circuit, coordinate, coordinates, domain, expression
- }
deriveClassify [Utility]
Base-type derivation (the fallback path).
deriveClassifyclassify.jscanonBody [Utility]
Map a body alias onto its canonical stored name, or null if not a known body.
canonBodysymbolism-engine.jscanonHouse [Utility]
"5th House" / "5th" / "in 5th" -> "5th House" (canonical), else null.
canonHousesymbolism-engine.jsdecompose [Utility]
Decompose a component name into typed atomic parts. Returns [] when the name is not a recognised symbol composition.
decomposesymbolism-engine.jsParameters
| Name | Type | Description |
|---|---|---|
{string} name |
any |
|
{string} [category] |
any |
Returns
Array<{type:'planet'|'sign'|'house'|'aspect', name:string
- >}
buildSourceIndex [Utility]
Build a fast atom -> traits lookup from raw `traits` docs. Only docs in the four SOURCE_CATEGORIES whose Component is a canonical atom are indexed. Single-value categories keep the first seen value; multi-value categories accumulate a deduped array.
buildSourceIndexsymbolism-engine.jsParameters
| Name | Type | Description |
|---|---|---|
{Array<{Component,ComponentCategory,TraitsCategory,Value}>} traitsDocs |
any |
Returns
{planet:Map, sign:Map, house:Map, aspect:Map
- }
lookup [Utility]
Look up an atom's profile from the index, or null.
lookupsymbolism-engine.jschakraFor [Utility]
Body-zone Chakra for a component, derived from the sign->chakra graph (base-types) rather than the sparse stored data -- even by construction. Prefers the explicit placement (sign > house), else the primary planet's ruling-sign zone. Returns {value, from} or null.
chakraForsymbolism-engine.jscenterFor [Utility]
Energetic center (the body-FUNCTION layer that supersedes chakra). Prefers a GATE part -- the exact gate -> center path -- and only falls back to a bare planet's approximate center when no gate is present. Returns {value, label, from, exact} or null. Signs/houses carry no center (they map to a medical body region instead -- see baseTypes.bodyPartOf).
centerForsymbolism-engine.jsderiveFacetTraced [Utility]
Derive the single Facet from the primary body of a component, with provenance.
deriveFacetTracedsymbolism-engine.jsReturns
{facet:string, from:string
- |null}
deriveFacet [Utility]
Derive the single Facet from the primary body of a component.
deriveFacetsymbolism-engine.jscombine [Utility]
Combine atomic parts into a composite trait set.
combinesymbolism-engine.jsReturns
unknown
- {{Facets?:string[], Crystals?:string[], Essences?:string[],
explain [Utility]
Like combine(), but returns full provenance so you can SEE what is being connected: every produced value carries the atom (and rule) it came from. Pure inspection helper -- not used by the writer.
explainsymbolism-engine.jsReturns
unknown
- {{
checkRequireLogin [Utility]
Lists actions that require the user to be logged in before proceeding.
checkRequireLoginmessageService.jssendAWSEmail [API Integration]
Sends an HTML email via AWS Simple Email Service (SES).
sendAWSEmailmessageService.jsParameters
| Name | Type | Description |
|---|---|---|
to |
string, |
from:string, subject:string, htmlBody:string |
Returns
success:boolean, messageId?:string, error?:object
Throws
- returns { success:false, error } on failure
External APIs Called
saveMessage [Data Service]
Saves a message to the Message collection and handles support auto-responses.
saveMessagemessageService.jsParameters
| Name | Type | Description |
|---|---|---|
FromEmail |
string, |
FromUserId:string, ToUserId:string, Content:string, isSupport:boolean |
Returns
message:string, data:object
- | 200 automated support response object
Throws
- 500
Models Used
markMessagesAsSeen [Data Service]
Marks all messages from one user to another as "Seen" in the Message collection.
markMessagesAsSeenmessageService.jsParameters
| Name | Type | Description |
|---|---|---|
FromUserId |
string, |
ToUserId:string |
Returns
success:boolean, message:string, data?:object
Throws
- returns { success:false, message:string, error } on failure
Models Used
sendEmailMessage [API Integration]
Saves a message in MongoDB and sends it as an email to the recipient via AWS SES.
sendEmailMessagemessageService.jsParameters
| Name | Type | Description |
|---|---|---|
FromEmail |
string, |
FromUserId:string, ToUserId:string, Content:string |
Returns
success:boolean, message:string, data?:object, error?:object
Throws
- returns { success:false, message:'Error sending email message.' } on failure
External APIs Called
Models Used
migrateJob [Utility]
Waits for a given number of milliseconds before continuing.
migrateJobmigrationService.jsParameters
| Name | Type | Description |
|---|---|---|
ms |
number |
Returns
unknown
- Promise<void>
migrateUsers [API Integration]
Migrates users for a single profile UID by calling an external API and saving returned users locally. This function checks if users for the given mainUserId are already migrated, fetches friends from the external API, saves each user into the local users collection, and marks the profile as migrated.
migrateUsersmigrationService.jsParameters
| Name | Type | Description |
|---|---|---|
uid |
string |
Returns
unknown
- 'ALREADYMIGRATED' | 'MIGRATEDSUCCESS' | undefined Returns 'ALREADYMIGRATED' if users already exist, 'MIGRATEDSUCCESS' on success, or undefined if an error occurred
Throws
- Error when an unexpected error occurs during the migration process
External APIs Called
Models Used
- User, Profile
buildHandleStem [Service Method]
Builds a handle stem from a Big Three object.
buildHandleStemprofileservice.jsParameters
| Name | Type | Description |
|---|---|---|
{{ sun |
{sign,degree}, |
moon:{sign,degree}, ascendant:{sign,degree} }} big3 |
Returns
string|null
coerceBig3 [Service Method]
Coerces a stored field (object or JSON string) into a { sun, moon, ascendant } object.
coerceBig3profileservice.jsReturns
Object|null
readBig3ForUid [Service Method]
Reads the Big Three for a uid from the User collection. Prefers the main user doc, falls back to any doc with big3. Also checks by profileId (_id) to handle write-timing races.
readBig3ForUidprofileservice.jsParameters
| Name | Type | Description |
|---|---|---|
{string} uid |
any |
|
{string=} profileId |
any |
Returns
Promise<Object|null>
escapeRegex [Service Method]
Escapes a string for safe use inside a RegExp.
escapeRegexprofileservice.jsvalidateHandle [Service Method]
Validates a user-chosen handle's format.
validateHandleprofileservice.jsParameters
| Name | Type | Description |
|---|---|---|
{string} handle |
any |
Returns
{ valid: boolean, reason?: string
- }
isHandleAvailable [Service Method]
Checks whether a handle is free (case-insensitive), ignoring the caller's own profile so re-saving the same handle reads as available.
isHandleAvailableprofileservice.jsParameters
| Name | Type | Description |
|---|---|---|
{string} handle |
any |
|
{string=} ownUid |
any |
Returns
Promise<boolean>
setHandle [Service Method]
Validates, checks uniqueness, then sets a user-chosen handle. Re-checks availability immediately before saving to narrow the race window.
setHandleprofileservice.jsParameters
| Name | Type | Description |
|---|---|---|
{string} uid |
any |
|
{string} handle |
any |
Returns
Promise<{ ok: boolean, status: number, handle?: string, reason?: string
- >}
ensureUniqueHandle [Service Method]
Ensures a handle is unique in the profiles collection. Appends an incrementing counter on collision: fierceLion, fierceLion2, ...
ensureUniqueHandleprofileservice.jsParameters
| Name | Type | Description |
|---|---|---|
{string} desired |
any |
|
{string=} ownUid |
any |
Returns
Promise<string>
addOrUpdateProfile [Service Method]
Adds or updates a profile document. Creates if not found, updates otherwise. Assigns a handle exactly once (never overwrites an existing one).
addOrUpdateProfileprofileservice.jsParameters
| Name | Type | Description |
|---|---|---|
{Object} profileData |
any |
|
{string} profileData.uid |
any |
|
{string=} profileData.profileId |
any |
|
{boolean=} profileData.verify |
any |
|
{string=} profileData.name |
any |
|
{string=} profileData.profile |
any |
|
{Date=} profileData.dateCreated |
any |
|
{string=} profileData.handle - client-sent fallback |
any |
|
{Object=} profileData.big3 - pre-extracted Big Three |
any |
Returns
Promise<Object|undefined>
initSocket [Utility]
Starts a Socket.IO server on the provided HTTP server and manages real-time chat events.
initSocketsocketService.jsParameters
| Name | Type | Description |
|---|---|---|
{http.Server} server - The HTTP server instance to attach Socket.IO to. |
any |
Returns
SocketIOServer
- io - The initialized Socket.IO server instance.
wrappedInit [Utility]
Exports the socket initializer so the main server can enable real-time messaging.
wrappedInitsocketService.jsDATABASES
astromatrix
astromatrix127.0.0.1:23516adminUsed In Files (6)
ai.jsapp.jsmessage.jspaypal.jsaurasoma.jsuser.js
CLUSTERS
master (cpuCount workers)
masterUsed In Files (3)
ai.jsapp.jsmessage.js
worker (1 workers)
workerUsed In Files (3)
ai.jsapp.jsmessage.js
SOCKETS
connection, message
connection, messagemessage.js
typing, register_user, new_message, disconnect, error, headers, connection_error, connect_error
typing, register_user, new_message, disconnect, error, headers, connection_error, connect_errorsocketService.jsinitSocket