Skip to content

Latest commit

 

History

History
53 lines (38 loc) · 2.19 KB

File metadata and controls

53 lines (38 loc) · 2.19 KB

NiceGUI Storage Architecture Findings

Key Discoveries from Documentation

1. Application Lifecycle

  • NiceGUI apps start with ui.run() which launches the web server
  • The app uses FastAPI/Starlette underneath with Uvicorn as the ASGI server
  • Frontend uses Vue.js, Quasar, and Tailwind CSS

2. Storage Implementation Details

From the documentation analysis:

  • No explicit mention of app.storage.general being client-side localStorage
  • Storage appears to be a NiceGUI abstraction but implementation details not clear
  • The framework focuses on reactive UI elements, not persistent storage

3. Server Architecture

  • Built on top of FastAPI (ASGI framework)
  • Uses WebSocket connections for real-time updates
  • Docker deployment is well-supported
  • Can run behind reverse proxies (nginx examples provided)

4. Missing Information

The documentation doesn't clearly explain:

  • Whether app.storage is server-side or client-side
  • How storage persists across server restarts
  • Best practices for state persistence
  • Lifecycle hooks for initialization

Implications for Our Issue

  1. Storage Type Unclear: The docs don't confirm if app.storage.general is browser localStorage or server-side storage

  2. No State Persistence Examples: No examples show persisting game state across server restarts

  3. Docker/Production Focus: Examples focus on deployment but not on state management

  4. Testing Approach: The testing framework uses a Screen class for UI testing, not state persistence testing

Recommended Architecture Based on Findings

Since NiceGUI documentation doesn't provide clear guidance on persistent storage:

  1. Assume Client-Side: Treat app.storage.general as client-side until proven otherwise
  2. Implement Server-Side: Create our own server-side persistence layer
  3. Use FastAPI Features: Leverage the underlying FastAPI for lifecycle management
  4. File/DB Storage: Implement file or database storage independent of NiceGUI

Next Steps

  1. Test if app.storage.general survives server restarts (empirical testing)
  2. Implement server-side storage solution (file or SQLite)
  3. Use FastAPI lifecycle events for initialization
  4. Create proper state management layer