How jhanink/poolmaster works
Main Components
a. Frontend/UI Layer:
• The React Application housed in the “app” directory.
• Organized routing (see app/routes, react-router.config.ts) that manages navigation.
• UI components (e.g., header, footer, main, guest form/list, drag-and-drop interfaces) within app/routes/components.
• Global state management aspects under app/appStateGlobal (jotai atoms) and local state via React hooks.
• Styling: Incorporates Tailwind CSS and CSS Modules (e.g., in headerStyles.module.css, etc.).
b. Configuration & Utilities:
• Configuration management in app/config that holds environment/runtime configurations (AppConfig.ts, AppRuntime.ts, etc.) and service interfaces.
• Utility helpers in app/util for managing themes, storage, general styling, etc.
c. Server/Backend Layer:
• Server-side logic under app/server covers domain-specific actions such as guest assignment, guest deletion, saving guest data, state synchronization, and file storage interactions.
• A websocket manager (app/server/websocketManager.ts) is responsible for real-time updates between clients.
d. Persistence/Storage Layer:
• Filesystem storage managed outside the main UI under fileStorage, which contains sample data (e.g., app_state_file.json) to serve as a central shared source of truth state.
Understanding the Relationships and Interactions
• The user interacts with the Frontend/UI layer which uses React Router to handle navigation through different views/pages.
• UI components send actions (e.g., form submissions, drag-and-drop interactions) that trigger client-side event handlers, invoking “Remix” style loaders and actions.
• These actions communicate with the Server Layer (via endpoints implemented in app/server) to handle CRUD operations and state synchronization.
• The websocket manager in the server sends real-time state updates back to the UI clients, ensuring consistency across sessions.
• Global state managed by jotai is updated based on server responses, and these changes may trigger UI re-rendering.
• The Server Layer interfaces with the filesystem (fileStorage) to persist data, creating a layered interaction between active state, persistent storage, and client views.
Architectural Patterns and Design Principles
• Componentized UI: Separation of concerns across distinct UI components (header, footer, main, etc.) ensuring modularity.
• Layered Architecture: Clear separation between the presentation (React components), business logic (server actions, websocket manager), and persistence (fileStorage).
• Real-Time Synchronization: The use of a dedicated websocketManager for maintaining real-time client-to-client state synchronization.
• Configuration as Code: Dedicated configuration files capture runtime and application settings, making the architecture flexible and maintainable.
• “Remix” style actions/loaders: This pattern simplifies data fetching and state updating by coupling UI events directly with backend actions.