SERVERS

Server :3010 (ai.js)
File:
ai.js
Port:
3010
Protocol:
http
Workers:
cpuCount

Mounts (2)

Server :3001 (app.js)
File:
app.js
Port:
3001
Protocol:
http
Workers:
cpuCount

Mounts (12)

Server :3009 (components.js)
File:
components.js
Port:
3009
Protocol:
http
Workers:
1

Mounts (1)

Server :3012 (message.js)
File:
message.js
Port:
3012
Protocol:
http
Workers:
cpuCount

Mounts (1)

Server :3009 (metrics-server.js)
File:
metrics-server.js
Port:
3009
Protocol:
http
Workers:
1
Server :3111 (paypal.js)
File:
paypal.js
Port:
3111
Protocol:
http
Workers:
1
Server :3008 (user.js)
File:
user.js
Port:
3008
Protocol:
http
Workers:
1

Mounts (1)

MOUNTS

/ai → ./routes/ai
Mount Path:
/ai
Router:
./routes/ai
File:
ai.js

Routes (6)

/admin → ./routes/admin
Mount Path:
/admin
Router:
./routes/admin
File:
ai.js

No routes found

/users → ./routes/user
/language → ./routes/language
Mount Path:
/language
Router:
./routes/language
File:
app.js

Routes (5)

/component → ./routes/component
/settings → ./routes/settings
Mount Path:
/settings
Router:
./routes/settings
File:
app.js

Routes (3)

/tarot → ./routes/tarot
Mount Path:
/tarot
Router:
./routes/tarot
File:
app.js

Routes (7)

/help → ./routes/help
Mount Path:
/help
Router:
./routes/help
File:
app.js

Routes (5)

/forecasts → ./routes/forecasts.js
Mount Path:
/forecasts
Router:
./routes/forecasts.js
File:
app.js

Routes (5)

/products → ./routes/products.js
Mount Path:
/products
Router:
./routes/products.js
File:
app.js

Routes (11)

/traits → ./routes/traits
Mount Path:
/traits
Router:
./routes/traits
File:
app.js

Routes (14)

/payments → ./routes/payments
Mount Path:
/payments
Router:
./routes/payments
File:
app.js

No routes found

/journals → ./routes/journals
Mount Path:
/journals
Router:
./routes/journals
File:
app.js

Routes (6)

/affiliate → ./routes/affiliates.js
Mount Path:
/affiliate
Router:
./routes/affiliates.js
File:
app.js

Routes (10)

/metrics → ./routes/metrics
Mount Path:
/metrics
Router:
./routes/metrics
File:
components.js

Routes (4)

/messages → ./routes/messages
Mount Path:
/messages
Router:
./routes/messages
File:
message.js

Routes (6)

/users → ./routes/user

ROUTES

GET /

Returns a simple health check message to confirm the server is running.

Method:
GET
Path:
/
File:
ai.js

Returns

200 string

GET /

Returns a simple health check message to confirm the server is running.

Method:
GET
Path:
/
File:
app.js

Returns

200 text - "Node Running"

GET /health

Checks if the metrics server is running and returns a simple status message.

Method:
GET
Path:
/health
File:
components.js

Returns

200 string

Throws

  • 500
GET /metrics

Exposes Prometheus metrics for scraping.

Method:
GET
Path:
/metrics
File:
metrics-server.js

Returns

200 metricsText:string

Throws

  • 500
GET /

Exposes Prometheus metrics at the root path for convenience.

Method:
GET
Path:
/
File:
metrics-server.js

Returns

200 metricsText:string

Throws

  • 500
POST /metrics/updateMetric

Creates or updates a Prometheus gauge or counter metric.

Method:
POST
Path:
/metrics/updateMetric
File:
metrics-server.js

Parameters

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.

Method:
POST
Path:
/metrics/pingonline
File:
metrics-server.js

Parameters

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.

Method:
GET
Path:
/metrics/usersonline
File:
metrics-server.js

Returns

200 activeUsers:number

GET /health

Simple health check endpoint that reports service is alive.

Method:
GET
Path:
/health
File:
metrics-server.js

Returns

200 ok:boolean

GET /check

Sends a test email based on query parameters name and who.

Method:
GET
Path:
/check
File:
paypal.js

Parameters

Name Type Description
name string, who:string

Returns

200 string - "Paypal IPN Listener"

Throws

  • 500
GET /

Returns a basic service status string.

Method:
GET
Path:
/
File:
paypal.js

Returns

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.

Method:
GET
Path:
/sendtarotemails
File:
paypal.js

Returns

200 string - concatenated names of recipients

Throws

  • 500

Models Used

GET /all

Returns all Paypal payment records.

Method:
GET
Path:
/all
File:
paypal.js

Returns

200 Array<Paypal>

Throws

  • 500

Models Used

GET /some

Retrieves Paypal records created within a specific month and year.

Method:
GET
Path:
/some
File:
paypal.js

Parameters

Name Type Description
month number, year:number

Returns

200 Array<Paypal>

Throws

  • 500

Models Used

GET /get

Finds Paypal records by a custom identifier.

Method:
GET
Path:
/get
File:
paypal.js

Parameters

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.

Method:
POST
Path:
/update
File:
paypal.js

Parameters

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.

Method:
POST
Path:
/
File:
paypal.js

Parameters

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.

Method:
GET
Path:
/check
File:
paypal.js

Parameters

Name Type Description
name string, who:string

Returns

200 string

Throws

  • 500

Models Used

GET /

Root endpoint that returns the service name and version.

Method:
GET
Path:
/
File:
paypal.js

Returns

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.

Method:
GET
Path:
/sendtarotemails
File:
paypal.js

Returns

200 string - concatenated names

Throws

  • 500

Models Used

GET /all

Returns all Paypal records from the database.

Method:
GET
Path:
/all
File:
paypal.js

Returns

200 array

Throws

  • 500

Models Used

GET /some

Returns Paypal records created within a specific month and year.

Method:
GET
Path:
/some
File:
paypal.js

Parameters

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.

Method:
POST
Path:
/update
File:
paypal.js

Parameters

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.

Method:
POST
Path:
/
File:
paypal.js

Parameters

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.

Method:
GET
Path:
/a
File:
affiliates.js
Function:
affiliate_code

Parameters

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

POST /click

Records a server-side affiliate click when client sends click data (used by mobile SDKs or servers).

Method:
POST
Path:
/click
File:
affiliates.js

Parameters

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

GET /a/resolve

Shows a small web page that redirects iOS users to the App Store and receives a resolver token.

Method:
GET
Path:
/a/resolve
File:
affiliates.js

Parameters

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).

Method:
POST
Path:
/click/install
File:
affiliates.js

Parameters

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

GET /getAffiliateCodes

Returns a list of active affiliate codes.

Method:
GET
Path:
/getAffiliateCodes
File:
affiliates.js

Parameters

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).

Method:
GET
Path:
/getAllAffiliates
File:
affiliates.js

Parameters

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.

Method:
GET
Path:
/getAffiliateClicks
File:
affiliates.js

Parameters

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

POST /saveAffiliate

Creates or updates an affiliate record for a given email and code.

Method:
POST
Path:
/saveAffiliate
File:
affiliates.js

Parameters

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.

Method:
GET
Path:
/getAffiliateStats
File:
affiliates.js

Parameters

Name Type Description
email string

Returns

200 owner:string, code:string, weeklyClicks:array

Throws

  • 400 (Missing email), 404 (Affiliate not found), 500

Models Used

GET /getAffiliatePayments

Retrieves payments associated with an affiliate (by owner email) and calculates commission totals.

Method:
GET
Path:
/getAffiliatePayments
File:
affiliates.js

Parameters

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

POST /completion

Generates a simple AI completion from a prompt.

Method:
POST
Path:
/completion
File:
ai.js

Parameters

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.

Method:
POST
Path:
/getpracticaltips
File:
ai.js

Parameters

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.

Method:
POST
Path:
/calculatereport
File:
ai.js

Parameters

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

GET /asktarotoracle

Fetches a tarot oracle reading for the provided question and returns the oracle's response.

Method:
GET
Path:
/asktarotoracle
File:
ai.js

Parameters

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

POST /generateDataReport

Generates AI-powered data reports (Matrix, Tarot, Transit) with automatic self-rating

Method:
POST
Path:
/generateDataReport
File:
ai.js

Parameters

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.

Method:
GET
Path:
/searchapi
File:
cities.js

Parameters

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.

Method:
GET
Path:
/getapi/:id
File:
cities.js

Parameters

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.

Method:
GET
Path:
/get/:id
File:
cities.js

Parameters

Name Type Description
id string

Returns

200 Cities document

Throws

  • 404 , 500

Models Used

GET /search

Searches the Cities collection for towns whose full name starts with the given query and returns up to 5 matches.

Method:
GET
Path:
/search
File:
cities.js

Parameters

Name Type Description
id string

Returns

200 Array of objects with FullName

Throws

  • 500

Models Used

GET /populatecity

Downloads region code data from an external API and inserts them into the Region collection.

Method:
GET
Path:
/populatecity
File:
cities.js

Returns

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.

Method:
GET
Path:
/update
File:
cities.js

Returns

200 started timer

GET /test

Returns cities whose name matches "Albuquerque" from an in-memory cities array.

Method:
GET
Path:
/test
File:
cities.js

Returns

200 Array

GET /populate

Builds city documents from an in-memory cities array and inserts them into the Cities collection.

Method:
GET
Path:
/populate
File:
cities.js

Returns

200 Array of inserted documents

Models Used

GET /Delete

Deletes component items that match the provided ComponentName and Category.

Method:
GET
Path:
/Delete
File:
component.js

Parameters

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.

Method:
POST
Path:
/Update
File:
component.js

Parameters

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.

Method:
GET
Path:
/FlushDelete
File:
component.js

Returns

200 "Ok"

Throws

  • 500

Models Used

GET /CheckForDuplicateKeys

Scans components in a category for reversed-key duplicates and removes the shorter description entry.

Method:
GET
Path:
/CheckForDuplicateKeys
File:
component.js

Parameters

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.

Method:
GET
Path:
/UpdateServerComponent
File:
component.js

Returns

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.

Method:
GET
Path:
/CleanUpComponents
File:
component.js

Returns

200 "Cleanup complete"

Throws

  • 500

Models Used

GET /GetLanguageTable

Retrieves language tags for the requested language.

Method:
GET
Path:
/GetLanguageTable
File:
component.js

Parameters

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.

Method:
GET
Path:
/TranslateItems
File:
component.js

Parameters

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.

Method:
GET
Path:
/GetLanguageItem
File:
component.js

Parameters

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.

Method:
GET
Path:
/GetComponentTraits/:component/:componentCategory
File:
component.js

Parameters

Name Type Description
component string, componentCategory:string

Returns

200 Array

Throws

  • 500

Models Used

GET /GetComponent

Retrieves a component by name, category, language, and id — uses cache, DB, or main server and returns enriched object.

Method:
GET
Path:
/GetComponent
File:
component.js

Parameters

Name Type Description
Language string, Id:string, Category:string, uid:string, ComponentName:string

Returns

200 Component object

Throws

  • 404 , 500

Models Used

GET /GetCategory

Returns all components in the specified category and language.

Method:
GET
Path:
/GetCategory
File:
component.js

Parameters

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.

Method:
GET
Path:
/GetCategoryItems
File:
component.js

Parameters

Name Type Description
language string, category:string

Returns

200 Array

Throws

  • 500

Models Used

GET /flush

Clears all entries from the in-memory forecast cache.

Method:
GET
Path:
/flush
File:
forecasts.js

Returns

200 string - "OK"

GET /get

Retrieves forecast items for a supplied date, type, and limit.

Method:
GET
Path:
/get
File:
forecasts.js

Parameters

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.

Method:
GET
Path:
/getForecasts
File:
forecasts.js

Parameters

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.

Method:
GET
Path:
/get
File:
forecasts.js

Parameters

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.

Method:
GET
Path:
/getall
File:
forecasts.js

Returns

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.

Method:
GET
Path:
/:userId
File:
friend.js

Parameters

Name Type Description
userId string, page:number, limit:number

Returns

200 requests: Array, friends: Array, count: number

Throws

  • 404 , 500

Models Used

PUT /:id

Updates the status of a friend relationship by its ID.

Method:
PUT
Path:
/:id
File:
friend.js

Parameters

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.

Method:
POST
Path:
/
File:
friend.js

Parameters

Name Type Description
user string, friend:string

Returns

200 message: string, friend: Object

Throws

  • 500

Models Used

GET /get

Fetches help entries filtered by page, section, or type and returns only entries that have a non-empty description.

Method:
GET
Path:
/get
File:
help.js

Parameters

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.

Method:
GET
Path:
/:id
File:
help.js

Parameters

Name Type Description
id string

Returns

200 Help object

Throws

  • 500

Models Used

POST /

Creates a new help entry in the database.

Method:
POST
Path:
/
File:
help.js

Parameters

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.

Method:
PUT
Path:
/:id
File:
help.js

Parameters

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.

Method:
DELETE
Path:
/:id
File:
help.js

Parameters

Name Type Description
id string

Returns

200 Deleted help object

Throws

  • 500

Models Used

GET /

Returns a list of journal entries, optionally filtered by user ID or category.

Method:
GET
Path:
/
File:
journals.js

Parameters

Name Type Description
limit number, uid:string, category:string

Returns

200 Array - Array of journal objects

Throws

  • 500

Models Used

GET /:id

Retrieves a single journal entry by its ID.

Method:
GET
Path:
/:id
File:
journals.js

Parameters

Name Type Description
id string

Returns

200 Object - Journal object

Throws

  • 404 , 500

Models Used

POST /

Creates a new journal entry for an existing profile.

Method:
POST
Path:
/
File:
journals.js

Parameters

Name Type Description
profileId string

Returns

201 Object - Created journal object

Throws

  • 404 , 400

Models Used

PUT /:id

Updates an existing journal entry by ID with provided data.

Method:
PUT
Path:
/:id
File:
journals.js

Parameters

Name Type Description
id string

Returns

200 Object - Updated journal object

Throws

  • 400

Models Used

DELETE /:id

Deletes a journal entry by its ID.

Method:
DELETE
Path:
/:id
File:
journals.js

Parameters

Name Type Description
id string

Returns

200 Object - Deleted journal object

Throws

  • 500

Models Used

GET /:id/view

Get journal entry with full component data for viewing

Method:
GET
Path:
/:id/view
File:
journals.js

Parameters

Name Type Description
id string

Returns

200 Object - Journal with complete component data

Throws

  • 404

Models Used

GET /

Retrieves all language tag records from the database.

Method:
GET
Path:
/
File:
language.js

Returns

200 Language[]

Throws

  • 500

Models Used

GET /:id

Retrieves a single language tag by its ID.

Method:
GET
Path:
/:id
File:
language.js

Parameters

Name Type Description
id string

Returns

200 Language

Throws

  • 404 , 500

Models Used

POST /

Saves a new language tag document to the database.

Method:
POST
Path:
/
File:
language.js

Parameters

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.

Method:
PUT
Path:
/:id
File:
language.js

Parameters

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).

Method:
DELETE
Path:
/:id
File:
language.js

Parameters

Name Type Description
id string

Returns

204 void

Throws

  • 500

Models Used

POST /SendMessage

Saves a new support message and triggers a user notification.

Method:
POST
Path:
/SendMessage
File:
messages.js

Parameters

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.

Method:
POST
Path:
/SendEmail
File:
messages.js

Parameters

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.

Method:
POST
Path:
/SendNewMessage
File:
messages.js

Parameters

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.

Method:
GET
Path:
/GetUserMessages/:ToUserId
File:
messages.js

Parameters

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.

Method:
GET
Path:
/GetMessage/:FromUserId/:ToUserId
File:
messages.js

Parameters

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.

Method:
GET
Path:
/GetNewMessage/:FromUserId/:ToUserId
File:
messages.js

Parameters

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.

Method:
GET
Path:
/
File:
metrics.js

Returns

200 string - Prometheus metrics text/plain content

Throws

  • 500
POST /updateMetric

Registers or updates a dynamic Prometheus metric (gauge or counter).

Method:
POST
Path:
/updateMetric
File:
metrics.js

Parameters

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.

Method:
POST
Path:
/pingonline
File:
metrics.js

Parameters

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.

Method:
GET
Path:
/usersonline
File:
metrics.js

Returns

200 activeUsers:number

Throws

  • 500

External APIs Called

GET /flush

Clears the in-memory cache used for video and product lookups.

Method:
GET
Path:
/flush
File:
products.js

Returns

200 string - "OK"

Throws

  • 500

Models Used

GET /all

Returns all products that have a ProductID field set.

Method:
GET
Path:
/all
File:
products.js

Returns

200 array - list of products

Throws

  • 500

Models Used

GET /specialvideo

Returns active video products filtered by a tag provided in the query string.

Method:
GET
Path:
/specialvideo
File:
products.js

Parameters

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.

Method:
GET
Path:
/videos
File:
products.js

Parameters

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.

Method:
GET
Path:
/allvideos
File:
products.js

Returns

200 array - list of all videos

Throws

  • 500

Models Used

GET /getAd

Fetches active advertisement content for a given tag type.

Method:
GET
Path:
/getAd
File:
products.js

Parameters

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.

Method:
GET
Path:
/getVideoAd
File:
products.js

Parameters

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.

Method:
GET
Path:
/getAdSummary
File:
products.js

Parameters

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.

Method:
GET
Path:
/getAllAd
File:
products.js

Returns

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.

Method:
POST
Path:
/updateAd
File:
products.js

Parameters

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.

Method:
GET
Path:
/addproducts
File:
products.js

Returns

200 empty

Models Used

GET /get/:id

Retrieves a configuration record by its CID, creating a default one if none exists.

Method:
GET
Path:
/get/:id
File:
settings.js

Parameters

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.

Method:
GET
Path:
/get
File:
settings.js

Returns

200 test:string

Throws

  • 404 , 500
GET /test

Returns a short identifier string "sdk" to confirm the test endpoint is reachable.

Method:
GET
Path:
/test
File:
settings.js

Returns

200 string

Throws

  • 404 , 500
POST /AddSurvey

Saves a new survey document to the surveys collection.

Method:
POST
Path:
/AddSurvey
File:
survey.js

Returns

200 object - Created survey document

Throws

  • 500

Models Used

POST /AddRating

Saves a new rating to the ratings collection and increments a statsd metric.

Method:
POST
Path:
/AddRating
File:
survey.js

Returns

200 object - Created rating document

Throws

  • 500

Models Used

POST /IncrementLog

Increments a DogStatsD metric based on the Type field in the request body.

Method:
POST
Path:
/IncrementLog
File:
survey.js

Parameters

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).

Method:
POST
Path:
/AIPromptText
File:
survey.js

Returns

200 string - "OK"

GET /get

Retrieves a tarot card entry by key and type, translating from English if needed.

Method:
GET
Path:
/get
File:
tarot.js

Parameters

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

External APIs Called

POST /addSpread

Saves a new tarot spread document to the database.

Method:
POST
Path:
/addSpread
File:
tarot.js

Parameters

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.

Method:
POST
Path:
/updateSpread/:id
File:
tarot.js

Parameters

Name Type Description
id string, Active:boolean

Returns

200 string - "OK" + request body string

Throws

  • 500

Models Used

GET /createTarotSpreads

Builds a sample tarot spread object in memory (not saved to the database).

Method:
GET
Path:
/createTarotSpreads
File:
tarot.js

Parameters

Name Type Description
none any

Returns

200 sample spread object, not persisted

GET /test2

Simple health-check endpoint that returns OK.

Method:
GET
Path:
/test2
File:
tarot.js

Parameters

Name Type Description
none any

Returns

200 string - "OK"

GET /test

Simple health-check endpoint that returns OK.

Method:
GET
Path:
/test
File:
tarot.js

Parameters

Name Type Description
none any

Returns

200 string - "OK"

GET /getTarotSpreads

Retrieves all tarot spread documents, sorted by the Order field ascending.

Method:
GET
Path:
/getTarotSpreads
File:
tarot.js

Parameters

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.

Method:
GET
Path:
/GetTraits
File:
traits.js

Returns

200 Success:boolean, Message:string, Data:array

Throws

  • 500

Models Used

GET /GetTraits/:id

Retrieves a single trait record by its ID.

Method:
GET
Path:
/GetTraits/:id
File:
traits.js

Parameters

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.

Method:
POST
Path:
/AddTraits
File:
traits.js

Returns

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.

Method:
POST
Path:
/UpdateTraitsByName
File:
traits.js

Parameters

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.

Method:
PUT
Path:
/UpdateTraits/:id
File:
traits.js

Parameters

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.

Method:
DELETE
Path:
/DeleteTraits/:id
File:
traits.js

Parameters

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.

Method:
GET
Path:
/GetComponentTraits
File:
traits.js

Parameters

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.

Method:
POST
Path:
/AddComponentTraits
File:
traits.js

Parameters

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.

Method:
GET
Path:
/findUser
File:
user.js

Parameters

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.

Method:
GET
Path:
/switchAccount
File:
user.js

Parameters

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

External APIs Called

GET /GetAllUsers

Returns a paginated list of public profiles matching a search query.

Method:
GET
Path:
/GetAllUsers
File:
user.js
Function:
skip

Parameters

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.

Method:
GET
Path:
/migratejob
File:
user.js

Parameters

Name Type Description
none any

Returns

200 message:string

Throws

  • 500
POST /start-migration

Starts a migration for a specific user id (uid).

Method:
POST
Path:
/start-migration
File:
user.js

Parameters

Name Type Description
uid string

Returns

200 message:string

Throws

  • 400
POST /erase

Deletes a single user by uid and profileId using post

Method:
POST
Path:
/erase
File:
user.js

Parameters

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 )

Method:
DELETE
Path:
/remove
File:
user.js

Parameters

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.

Method:
DELETE
Path:
/removeaccount/:id
File:
user.js

Parameters

Name Type Description
id string

Returns

200 message:string

Throws

  • 400 , 404, 500

Models Used

GET /update-uids-to-lowercase

Converts any non-lowercase user uids to lowercase across the users collection.

Method:
GET
Path:
/update-uids-to-lowercase
File:
user.js

Parameters

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.

Method:
GET
Path:
/user-count
File:
user.js

Parameters

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.

Method:
GET
Path:
/find-duplicates
File:
user.js

Parameters

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.

Method:
GET
Path:
/checkpassword/:id
File:
user.js

Parameters

Name Type Description
id string, password:string

Returns

200 success:boolean, message:string

Throws

  • 500

Models Used

PUT /edit/:id

Updates a user document identified by profileId with provided body fields (uid/profileId/mainUserId cannot be changed).

Method:
PUT
Path:
/edit/:id
File:
user.js

Parameters

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.

Method:
POST
Path:
/user/Login
File:
user.js

Parameters

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

POST /adduser

Adds a new user document to the users collection using request body fields.

Method:
POST
Path:
/adduser
File:
user.js

Parameters

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

Method:
GET
Path:
/getUsersID/:profileId
File:
user.js

Parameters

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. First looks up the Profile to get the uid, then fetches users by uid.

Method:
GET
Path:
/getUsersID/:profileId
File:
user.js

Parameters

Name Type Description
profileId string

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

Method:
GET
Path:
/connectedUsers/:uid
File:
user.js

Parameters

Name Type Description
uid string, isFamous:string

Returns

200 unknown - 200 array of simplified user objects

Throws

  • 500

Models Used

POST /verifyprofile

Verifies or updates a profile entry and returns the saved profile.

Method:
POST
Path:
/verifyprofile
File:
user.js

Parameters

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.

Method:
POST
Path:
/addprofile
File:
user.js

Parameters

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).

Method:
GET
Path:
/log/error
File:
user.js

Parameters

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.

Method:
POST
Path:
/IncrementLog
File:
user.js

Parameters

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.

Method:
POST
Path:
/log/posterror
File:
user.js

Parameters

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.

Method:
GET
Path:
/find/user
File:
user.js

Parameters

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.

Method:
GET
Path:
/new/start
File:
user.js

Parameters

Name Type Description
none any

Returns

200 unknown - 200 "OK"

GET /new/complete

Increments the metric counter for new user completion and returns OK.

Method:
GET
Path:
/new/complete
File:
user.js

Parameters

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.

Method:
GET
Path:
/store/user
File:
user.js

Parameters

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'.

Method:
GET
Path:
/count/user
File:
user.js

Parameters

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'.

Method:
GET
Path:
/count/profile
File:
user.js

Parameters

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.

Method:
PUT
Path:
/toggleProfile/:uid
File:
user.js

Parameters

Name Type Description
uid string

Returns

200 success:boolean, message:string, isPrivate:boolean

Throws

  • 404 , 500

Models Used

GET /

Returns a simple health-check string indicating the server is running.

Method:
GET
Path:
/
File:
user.js

Returns

200 string

Throws

  • 500

MODELS

AuraSoma (auraSomas)

Stores AuraSoma bottle details including colors, themes and spiritual information.

Model:
AuraSoma
Collection:
auraSomas
File:
aurasoma.js

Schema

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)

Affiliate (affiliates)

Represents an affiliate account used to track referrals and identify partners.

Model:
Affiliate
Collection:
affiliates
File:
Affiliate.js

Schema

Field Type
code String
owner String
email String
status String
created_at Date

Indexes

  • code (unique)

Used By Routes (3)

AffiliateClick (affiliateclicks)

Records individual clicks or installs attributed to an affiliate for tracking conversions.

Model:
AffiliateClick
Collection:
affiliateclicks
File:
Affiliate.js

Schema

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.

Model:
Location
Collection:
locations
File:
Cities.js

Schema

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.

Model:
Component
Collection:
components
File:
Component.js

Schema

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)

Device (devices)

Stores device identifiers, session counts, optional UUIDs, and timestamps for when the record was created.

Model:
Device
Collection:
devices
File:
Device.js

Schema

Field Type
uid String
sessions Number
uuid String
date Date

Used By Routes (2)

Error (errors)

Stores error logs with a user identifier, message, additional info, and a timestamp.

Model:
Error
Collection:
errors
File:
Error.js

Schema

Field Type
uid String
msg String
info String
timestamp Date

Used By Routes (3)

Forecasts (forecasts)

Stores forecasts and horoscope event information for each forecast entry.

Model:
Forecasts
Collection:
forecasts
File:
Forecasts.js

Schema

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)

Used By Functions (1)

Friend (friends)

Stores friendship relationships between user profiles and their current status.

Model:
Friend
Collection:
friends
File:
Friend.js

Schema

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)

Help (helps)

Stores help articles and their metadata for the application's help pages.

Model:
Help
Collection:
helps
File:
Help.js

Schema

Field Type
HelpId Number
Page String
Section String
Type String
Description String

Used By Routes (5)

Used By Functions (1)

Journal (journals)

Stores journal entries created by users, including metadata and content.

Model:
Journal
Collection:
journals
File:
Journal.js

Schema

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 (4)

JournalPrompt (journalprompts)

Stores journal prompts linked to astrological events, houses, language, and category.

Model:
JournalPrompt
Collection:
journalprompts
File:
JournalPrompt.js

Schema

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.

Model:
Language
Collection:
languages
File:
Language.js

Schema

Field Type
Name String
Category String
Type String
Value String
Language String

Used By Routes (8)

Message (messages)

Stores chat message details between users including sender, recipient, content, time and delivery status.

Model:
Message
Collection:
messages
File:
Message.js

Schema

Field Type
FromEmail String
FromUserId String
ToUserId String
Content String
Timestamp Date
Status String

Used By Routes (6)

Used By Functions (3)

Payments (payments)

Stores payment records for users including pricing, timestamps, and platform details.

Model:
Payments
Collection:
payments
File:
Payment.js

Schema

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.

Model:
Paypal
Collection:
paypals
File:
Paypal.js

Schema

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)

Products (products)

Defines the product records stored in the database, including price, images, and metadata for each product.

Model:
Products
Collection:
products
File:
Products.js

Schema

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)

Profile (profiles)

Stores user profile information and securely saves passwords for login.

Model:
Profile
Collection:
profiles
File:
Profile.js

Schema

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 (6)

Prompts (prompts)

Stores prompt records including component, category, prompt text, job and upscale links for use by the application.

Model:
Prompts
Collection:
prompts
File:
Prompt.js

Schema

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.

Model:
Ratings
Collection:
ratings
File:
Rating.js

Schema

Field Type
UserID String
Category String
Component String
Type String
Rating String

Used By Routes (1)

Region (regions)

Stores regional geographic names and identifiers for countries and regions.

Model:
Region
Collection:
regions
File:
Region.js

Schema

Field Type
codeid Number
country String
region String
name2 String
name3 String

Used By Routes (1)

Settings (settings)

Defines a Settings data model that stores a customer identifier (CID), an amount, and a value.

Model:
Settings
Collection:
settings
File:
Settings.js

Schema

Field Type
CID String
Amount Number
Value Number
Stripe (stripes)

Stores Stripe payment configuration and product details used by the application.

Model:
Stripe
Collection:
stripes
File:
Stripe.js

Schema

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.

Model:
Survey
Collection:
surveys
File:
Survey.js

Schema

Field Type
dynamic (no fixed fields; strict false)

Indexes

  • none

Used By Routes (1)

Tarot (tarots)

Defines the Tarot card structure stored in MongoDB, describing fields like Key, Name, Type, and whether the card is reversed.

Model:
Tarot
Collection:
tarots
File:
Tarot.js

Schema

Field Type
Key String
Name String
Type String
Category String
Phrase String
Description String
Language String
Reversed Boolean

Used By Routes (1)

Used By Functions (1)

TarotReading (tarotreadings)

Stores tarot reading entries including drawn cards, the user's question, the AI response, timing, and basic metadata.

Model:
TarotReading
Collection:
tarotreadings
File:
TarotReading.js

Schema

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.

Model:
TarotSpread
Collection:
tarotspreads
File:
TarotSpread.js

Schema

Field Type
Group String
Title String
Cards String
CardTotal Number
Index Number
Order Number
Active Number
Featured String

Indexes

  • none

Used By Routes (3)

Traits (Traits)

Stores personality trait records with category, component, value, language, and rating.

Model:
Traits
Collection:
Traits
File:
Traits.js

Schema

Field Type
TraitsID Number
Component String
ComponentCategory String
TraitsCategory String
Value String
Language String
Rating Number

Indexes

  • none

Used By Routes (9)

User (users)

Stores user birth and account details for each person in the database.

Model:
User
Collection:
users
File:
User.js

Schema

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)

Views (views)

Records how many times a UI component has been viewed, organized by category and language.

Model:
Views
Collection:
views
File:
Views.js

Schema

Field Type
Component String
Category String
Language String
Views Number

Used By Functions (1)

Views (views)

Exports the Mongoose model so other parts of the application can read and write view counts.

Model:
Views
Collection:
views
File:
Views.js

Used By Functions (1)

Seo (seos)

Stores SEO metadata like title, description and keywords for site components and categories.

Model:
Seo
Collection:
seos
File:
seo.js

Schema

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.

Model:
Seo
Collection:
seos
File:
seo.js

Schema

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.

Model:
Paypal
Collection:
paypals
File:
paypal.js

Schema

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)

Paypal (paypals)

Declares and loads the Paypal model used to read and write payment records.

Model:
Paypal
Collection:
paypals
File:
paypal.js

Schema

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)

Config (configs)

Stores configuration entries that track an identifier, an amount, and a numeric value.

Model:
Config
Collection:
configs
File:
settings.js

Schema

Field Type
CID String
Amount Number
Value Number

Used By Routes (1)

Survey (surveys)

Handles survey documents stored in MongoDB; used to create and query surveys.

Model:
Survey
Collection:
surveys
File:
survey.js

Schema

Field Type
fields depend on Survey model (stored in MongoDB) String

Used By Routes (1)

Rating (ratings)

Handles rating documents stored in MongoDB; used to create and query ratings.

Model:
Rating
Collection:
ratings
File:
survey.js

Schema

Field Type
fields depend on Rating model (stored in MongoDB) String

Used By Routes (1)

Component (components)

Manages component metadata stored in MongoDB; used to create and update component documents.

Model:
Component
Collection:
components
File:
survey.js

Schema

Field Type
fields depend on Component model (stored in MongoDB) String

Used By Routes (7)

SEO (seo)

Manages SEO metadata stored in MongoDB; used to create SEO documents for components.

Model:
SEO
Collection:
seo
File:
survey.js

Schema

Field Type
fields depend on SEO model (stored in MongoDB) String
Message (messages)

Stores user messages and chat content exchanged between users.

Model:
Message
Collection:
messages
File:
messageService.js

Schema

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)

Used By Functions (3)

User (users)

Stores user account information and authentication details.

Model:
User
Collection:
users
File:
messageService.js

Schema

Field Type
_id ObjectId
Email String
Name String
PasswordHash String

Indexes

  • Email (unique)

Relations

  • Message (FromUserId), Message (ToUserId)

Used By Routes (11)

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)

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)

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)

GET https://astromatrix.org/API/Utility/GetBirthCityInfo

Fetches detailed city information for a town name from an external astrology API.

Used By (1)

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)

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)

GET https://astromatrix.org/Api/notification/SendUserNotification

Saves a new support message and triggers a user notification.

Used By (1)

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)

GET https://astromatrix.org/API/Utility/HasComponentTraits

Checks whether a component already has traits by querying the astromatrix service.

Used By (1)

GET https://astromatrix.org/API/User/SwitchUserAccount

Switches account IDs across profiles and users, and notifies a legacy API.

Used By (1)

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)

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)

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)

translation.googleapis.com (2 endpoints)

Endpoints

GET https://translation.googleapis.com/language/translate/v2?key=AIzaSyCVCwZXnu25bl_tVVXp80-QdX-vR9W93HI

Helper that translates a tarot entry into another language and saves the translated entry.

Used By (1)

GET https://translation.googleapis.com/language/translate/v2?key=AIzaSyCVCwZXnu25bl_tVVXp80-QdX-vX-vR9W93HI

Translates an English tarot entry into the requested language and saves it.

Used By (2)

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)

FUNCTIONS

ErrorHandler [Utility]

Mounts journal-related API endpoints under /journals.

Function:
ErrorHandler
File:
app.js
Type:
Utility
ErrorHandler [Utility]

Mounts affiliate-related API endpoints under /affiliate.

Function:
ErrorHandler
File:
app.js
Type:
Utility
scrapeAuraSoma [Data Service]

Scrapes a single Aura-Soma product page and saves its details to the database.

Function:
scrapeAuraSoma
File:
aurasoma.js
Type:
Data Service

Parameters

Name Type Description
url string

Returns

unknown - void

Throws

  • Error

Models Used

emailTemplate [Utility]

Connects to MongoDB with the configured host and database.

Function:
emailTemplate
File:
paypal.js
Type:
Utility
emailTemplate [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.

Function:
emailTemplate
File:
paypal.js
Type:
Utility

Parameters

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.

Function:
sendEmail
File:
paypal.js
Type:
Utility

Parameters

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.

Function:
getAsn
File:
affiliates.js
Type:
Utility

Parameters

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.

Function:
getClientIp
File:
affiliates.js
Type:
Utility

Parameters

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).

Function:
normalizeIp
File:
affiliates.js
Type:
Utility

Parameters

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.

Function:
getIPv6Prefix
File:
affiliates.js
Type:
Utility

Parameters

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.

Function:
isBot
File:
affiliates.js
Type:
Utility

Parameters

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.

Function:
prepareCategoryData
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
grade
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
createScoreObject
File:
relocation.js
Type:
Utility

Returns

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.

Function:
addPositive
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
addNegative
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
finalizeScore
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
weightCurve
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
scorePlanet
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
calculateCategoryScores
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
pushScore
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
addVirtueBonusFromAngles
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
checkConj
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
prepareWellnessData
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
prepareRootsData
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
prepareCareerData
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
prepareLoveData
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
prepareTransformationData
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
generatePromptWithExtras
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
getExtra
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
withinOrb
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
tagAxisConjunctions
File:
relocation.js
Type:
Utility

Parameters

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.

Function:
loadPrompt
File:
relocation.js
Type:
API Integration

Parameters

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.

Function:
calculate
File:
reports.js
Type:
API Integration

Parameters

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.

Function:
calculateReport
File:
reports.js
Type:
API Integration

Parameters

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.

Function:
clean
File:
reports.js
Type:
Utility

Parameters

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.

Function:
cleanTransits
File:
reports.js
Type:
Utility

Parameters

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.

Function:
cleanForecasts
File:
reports.js
Type:
Utility

Parameters

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.

Function:
cleanNatal
File:
reports.js
Type:
Utility

Parameters

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.

Function:
calculatePriority
File:
reports.js
Type:
Utility

Parameters

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.

Function:
calculateForecastPriority
File:
reports.js
Type:
Utility

Parameters

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.

Function:
classifyTerm
File:
reports.js
Type:
Utility

Parameters

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.

Function:
aspectTone
File:
reports.js
Type:
Utility

Parameters

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.

Function:
filterByMonth
File:
reports.js
Type:
Utility

Parameters

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.

Function:
toWeight
File:
reports.js
Type:
Utility

Parameters

Name Type Description
item object

Returns

number - weight

addFacetScore [Utility]

Adds a weighted score to a facet's running total.

Function:
addFacetScore
File:
reports.js
Type:
Utility

Parameters

Name Type Description
facetScores object, facet:string, weight:number
bumpFacetTone [Utility]

Increments the harmonious/challenging counters for a facet based on an aspect tone.

Function:
bumpFacetTone
File:
reports.js
Type:
Utility

Parameters

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.

Function:
addKeyDate
File:
reports.js
Type:
Utility

Parameters

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.

Function:
logRawTransitForecasts
File:
reports.js
Type:
Utility

Parameters

Name Type Description
cleaned object
printSummary [Utility]

Prints a human-friendly summary of the filtered data including sections, facets, and weights for debugging.

Function:
printSummary
File:
reports.js
Type:
Utility

Parameters

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.

Function:
buildAIPayload
File:
reports.js
Type:
Utility

Parameters

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.

Function:
buildBasePrompt
File:
reports.js
Type:
Utility

Parameters

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.

Function:
callAI
File:
reports.js
Type:
API Integration

Parameters

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.

Function:
generateMonthlyReading
File:
reports.js
Type:
API Integration

Parameters

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

Function:
categorizeQuestion
File:
tarotreading.js
Type:
Utility
getRandomTarotCards [Utility]

Draws three random tarot cards using seedrandom for consistency

Function:
getRandomTarotCards
File:
tarotreading.js
Type:
Utility
cleanAndParseJson [Utility]

Cleans and parses JSON response from OpenAI

Function:
cleanAndParseJson
File:
tarotreading.js
Type:
Utility
loadPrompt [Utility]

Load prompt template from file

Function:
loadPrompt
File:
tarotreading.js
Type:
Utility
replaceVariables [Utility]

Replace template variables in prompt

Function:
replaceVariables
File:
tarotreading.js
Type:
Utility
logReading [Utility]

Log reading to monthly log file

Function:
logReading
File:
tarotreading.js
Type:
Utility
getCurrentPromptVersion [Utility]

Get current prompt version from logs

Function:
getCurrentPromptVersion
File:
tarotreading.js
Type:
Utility
getTarotOracleReading [Utility]

Main function to generate a tarot oracle reading

Function:
getTarotOracleReading
File:
tarotreading.js
Type:
Utility

Parameters

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.

Function:
escapeSingleQuotes
File:
ai.js
Type:
Utility

Parameters

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 &#39;.

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.

Function:
cleanAndParseJson
File:
ai.js
Type:
Utility

Parameters

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).
updateLocation [Utility]

Updates a single city document by looking up the province name from the Region collection and saving it.

Function:
updateLocation
File:
cities.js
Type:
Utility

Parameters

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.

Function:
updateLocations
File:
cities.js
Type:
Utility
doTranslate [Utility]

Translates a component object into the requested language and inserts it into the database.

Function:
doTranslate
File:
component.js
Type:
Utility

Parameters

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.

Function:
addItem
File:
component.js
Type:
Utility

Parameters

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.

Function:
translateItem
File:
component.js
Type:
Utility

Parameters

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.

Function:
checkTranslate
File:
component.js
Type:
Utility

Parameters

Name Type Description
{string} lang - Target language code. any
{string} type - Type of language items to check (e.g., "Tag"). any
updateTitle [Utility]

Ensures a transit component title includes "Natal" and removes "Transit" for Transit Aspects.

Function:
updateTitle
File:
component.js
Type:
Utility

Parameters

Name Type Description
{string} component - The component title to adjust. any
{string} category - The category name to inspect. any

Returns

string - Adjusted component title.

createComponentAI [Utility]

Attempts to generate AI content for components that lack meaningful descriptions.

Function:
createComponentAI
File:
component.js
Type:
Utility

Parameters

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.

Function:
findComponent
File:
component.js
Type:
Utility

Parameters

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.

updateDescription [Utility]

Removes a specific phrase and everything after it from the description string.

Function:
updateDescription
File:
component.js
Type:
Utility

Parameters

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.

Function:
handleLanguageSpecificReplacements
File:
component.js
Type:
Utility

Parameters

Name Type Description
{Object} query - The request query object (mutated by this function). any
addDays [Utility]

Adds a number of days to a given date and returns the new date.

Function:
addDays
File:
forecasts.js
Type:
Utility

Parameters

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.

Function:
getForecast
File:
forecasts.js
Type:
Data Service

Parameters

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.

Function:
tryTypeQuery
File:
help.js
Type:
Data Service

Parameters

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.

Function:
findMatchingQuestion
File:
messages.js
Type:
Utility

Parameters

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.

Function:
checkRequireLogin
File:
messages.js
Type:
Utility

Parameters

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.

Function:
sendAWSEmail
File:
messages.js
Type:
Utility

Parameters

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.

Function:
sendMetric
File:
metrics.js
Type:
API Integration

Parameters

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.

Function:
getConsciousnessLevel
File:
products.js
Type:
Utility

Parameters

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.

Function:
AddComponentTraits
File:
survey.js
Type:
API Integration

Parameters

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.

Function:
generateAssistantResponse
File:
survey.js
Type:
API Integration

Parameters

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

checkComponentTraits [API Integration]

Checks whether a component already has traits by querying the astromatrix service.

Function:
checkComponentTraits
File:
survey.js
Type:
API Integration

Parameters

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.

Function:
countWords
File:
survey.js
Type:
Utility

Parameters

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.

Function:
generateAI
File:
survey.js
Type:
Utility

Parameters

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 [API Integration]

Translates an English tarot entry into the requested language and saves it.

Function:
doTranslate
File:
tarot.js
Type:
API Integration

Parameters

Name Type Description
obj object, req.query.language:string, req.query.key:string, res:object

External APIs Called

Models Used

containsZodiacSign [Utility]

Checks whether a given text contains any zodiac sign phrase (like "in Aries").

Function:
containsZodiacSign
File:
traits.js
Type:
Utility

Parameters

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.

Function:
removeZodiacSign
File:
traits.js
Type:
Utility

Parameters

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.

Function:
switchAspect
File:
traits.js
Type:
Utility

Parameters

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.

Function:
getComponentTraits
File:
traits.js
Type:
Utility

Parameters

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.

Function:
updateComponentTraitsByID
File:
traits.js
Type:
Utility

Parameters

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 - >}

addOrUpdateProfile [Utility]

Adds or updates a profile document in the profiles collection using provided profileData. This helper creates a profile if one does not exist, or updates fields if it does.

Function:
addOrUpdateProfile
File:
user.js
Type:
Utility

Parameters

Name Type Description
{Object} profileData - profile information object (uid required) 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 any

Returns

Promise<Object|undefined> - The saved profile (without password) or undefined on error

updateItemView [Data Service]

Increments the view counter for a given component/category/language, or creates a new record with Views = 1 if none exists.

Function:
updateItemView
File:
views.js
Type:
Data Service

Parameters

Name Type Description
ComponentName string, Category:string, Language:string, Views:number

Returns

unknown - void

Models Used

checkRequireLogin [Utility]

Lists actions that require the user to be logged in before proceeding.

Function:
checkRequireLogin
File:
messageService.js
Type:
Utility
sendAWSEmail [API Integration]

Sends an HTML email via AWS Simple Email Service (SES).

Function:
sendAWSEmail
File:
messageService.js
Type:
API Integration

Parameters

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.

Function:
saveMessage
File:
messageService.js
Type:
Data Service

Parameters

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.

Function:
markMessagesAsSeen
File:
messageService.js
Type:
Data Service

Parameters

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.

Function:
sendEmailMessage
File:
messageService.js
Type:
API Integration

Parameters

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

sleep [Data Service]

Migration utilities to fetch old user data from an external service and save it into the local database. This module finds profiles that need migration and imports their related users from an external API into local collections.

Function:
sleep
File:
migrationService.js
Type:
Data Service

Models Used

migrateJob [Utility]

Waits for a given number of milliseconds before continuing.

Function:
migrateJob
File:
migrationService.js
Type:
Utility

Parameters

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.

Function:
migrateUsers
File:
migrationService.js
Type:
API Integration

Parameters

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

initSocket [Utility]

Starts a Socket.IO server on the provided HTTP server and manages real-time chat events.

Function:
initSocket
File:
socketService.js
Type:
Utility

Parameters

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.

DATABASES

astromatrix
Name:
astromatrix
Host:
127.0.0.1:23516
Auth Source:
admin

Used In Files (6)

  • ai.js
  • app.js
  • aurasoma.js
  • message.js
  • paypal.js
  • user.js

CLUSTERS

master (cpuCount workers)
Mode:
master
Workers:
cpuCount

Used In Files (3)

  • ai.js
  • app.js
  • message.js
worker (1 workers)
Mode:
worker
Workers:
1

Used In Files (3)

  • ai.js
  • app.js
  • message.js

SOCKETS

connection, message
Event:
connection, message
File:
message.js
typing, register_user, new_message, disconnect, error, headers, connection_error, connect_error
Event:
typing, register_user, new_message, disconnect, error, headers, connection_error, connect_error
File:
socketService.js
Handler:
initSocket