SEAM stores all runtime state about the authenticated user in a single plain JavaScript object exported asDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/TheSerchCp/SEAM/llms.txt
Use this file to discover all available pages before exploring further.
session from js/state/session.state.js. There is no framework reactivity — pages read the object directly and ApiClient sources the JWT from it on every request. Because the object is a module-level singleton, any part of the application that imports it always sees the same values.
Session Object
The authenticated user record returned by the server (contains at minimum
id, name, email, role). null when no session exists.The JWT returned by
/auth/login. Attached as Authorization: Bearer {token} by ApiClient on every request. null when logged out.A
Set of permission nameUri strings for the active user (e.g. 'users:read', 'roles:delete'). Pages check membership with session.permissions.has('resource:action'). null until populated after login.Navigation items returned by the server for the user’s role. The sidebar component renders this array directly.
null until populated after login.The
session.state.js file also contains local seed data arrays (users, roles, grupos, calificaciones, tareas, reportes) that were used during early development. These are plain arrays on the same object and are not related to the live session fields above.Hydration from localStorage
When a user refreshes the page or opens the app in a new tab, the in-memory session object starts empty. main.js immediately reads localStorage.getItem('currentUser') and populates the session before the first loadRoute() call. If a token is found, the Socket.IO connection is also re-established.
Router.js auth guard performs the same hydration lazily as a fallback for cold navigations to deep links — but the canonical location is main.js, which runs once per page load before any route resolution.
Operation Listeners
SEAM’s real-time system routesdata:changed events from the server to the correct pages using a static map defined in js/core/OperationListeners.js.
OPERATION_LISTENERS
operation strings from data:changed payloads that should cause that page to refresh.
shouldUpdatePage(pageType, operation)
true if operation is in the interest list for pageType, false otherwise.
One of the keys in
OPERATION_LISTENERS: 'users', 'permissions', 'roles', or 'sidebar'.The
operation field from the data:changed payload (e.g. 'roles:delete').How Pages Use shouldUpdatePage
Pages subscribe to data:changed in their factory function and call shouldUpdatePage to gate their re-render logic. This prevents every page from re-rendering every time any data changes anywhere in the system.
Targeted re-renders
shouldUpdatePage means the Users page ignores 'roles:delete' events and the Roles page ignores 'users:create' events — even though both arrive on the same data:changed channel.No polling required
Because the server broadcasts
data:changed to all connected clients, pages stay consistent across tabs and users without any polling interval.Session Lifecycle Summary
App load
main.js reads localStorage, populates session, and reconnects the socket with the stored JWT.Login
The auth page calls
POST /auth/login, receives { user, token, permissions, sidebarItems }, writes the full object to localStorage, assigns every field to session, and calls EventBus.connect(token).Authenticated requests
ApiClient.request() reads session.token on each call. No manual header management is needed in repositories or pages.Permission checks
Pages call
session.permissions.has('resource:action') to show or hide UI elements based on what the current user is allowed to do.