> ## Documentation Index
> Fetch the complete documentation index at: https://ayakaleaf-pro.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# System Messages Collection

`systemmessages` holds the site-wide banners that an admin posts for all logged-in users. One document is one message. `web` owns it; the schema is `services/web/app/src/models/SystemMessage.mjs` and the code is `services/web/app/src/Features/SystemMessages/SystemMessageManager.mjs`.

#### Fields

| Field | Type | Meaning | Source |
| - | - | - | - |
| `_id` | ObjectId | Message id. The browser remembers by this id which messages the user closed (`services/web/frontend/js/shared/components/system-message.tsx:10`). | `SystemMessage.mjs:5` |
| `content` | String | Message text, default `''`. | `SystemMessage.mjs:7` |
| `__v` | Number | Mongoose version key, added by `message.save()`. | `SystemMessageManager.mjs:29-30` |

#### Who Writes It

| Code | What it does |
| - | - |
| `SystemMessageManager.mjs:28-33` (`createMessage`) | `POST /admin/messages` (`services/web/app/src/router.mjs:1150-1152`, `services/web/app/src/Features/ServerAdmin/AdminController.mjs:151-159`): adds one message. |
| `SystemMessageManager.mjs:22-26` (`clearMessages`) | `POST /admin/messages/clear` (`router.mjs:1155-1157`, `AdminController.mjs:161-168`): deletes all messages. There is no way to delete a single one. |

#### Who Reads It

| Code | What it does |
| - | - |
| `SystemMessageManager.mjs:50-65` | Each `web` process keeps all messages in memory and reloads them every 20 to 30 seconds, and right after its own create or clear. |
| `services/web/app/src/Features/SystemMessages/SystemMessageController.mjs:6-24` | `GET /system/messages` (`router.mjs:331`): returns the cached messages to logged-in users. While the site is closed (`siteIsOpen` false) it returns a fixed notice instead, which is not stored in Mongo. |
| `AdminController.mjs:83-84` | The `/admin` page lists the messages straight from Mongo. |

#### Indexes

No migration creates an index on `systemmessages`; only the default `_id` index exists.

#### Notes

* With `notifyOnSystemMessageChanges` set, a create or clear is also published on the Redis channel `refresh-system-messages`, so other `web` processes reload at once (`SystemMessageManager.mjs:9`, `:35-48`, `:75-87`). Without it they pick up the change on their next timed reload.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.