INSTALL.md 1.8 KB

  1. src/index.js: The application entry point that sets up the React app and initializes the ServerFunctionProvider.

  2. src/ApplicationRouter.js: The main router component that handles navigation in the app.

  3. src/pages/Public/HelloWorld.js: An example component that demonstrates using server code markers. This file includes:

    • Comment markers (// @eserver-register-next-line) to indicate server code
    • Frontend UI components to display the results
  4. src/utils/use-server.js: The core library that manages server functions. It:

    • Establishes and maintains WebSocket connections
    • Handles registration and execution of server code
    • Provides React hooks and components for server integration
    • Includes the LogViewer for visualizing logs
  5. src/utils/dev-runtime-injector.js: A development-specific utility that:

    • Detects comment markers at runtime
    • Processes them to avoid browser errors
    • Provides stubs for Node.js globals
  6. server/server-function-hub.js: The WebSocket server that:

    • Accepts code registration requests
    • Executes code in a Node.js environment
    • Returns the results to the client
    • Maintains connections and handles errors
  7. config-overrides.js: Configuration for React App Rewired that:

    • Adds the custom loader for processing server markers
    • Sets up Node.js polyfills for the browser
  8. server-marker-loader.js: A Webpack loader that:

    • Identifies comment markers during build
    • Transforms them into code that registers with the server
    • Prevents client-side execution of server code

This architecture creates a seamless system where frontend developers can include server code directly in their React components using simple comment markers. The system handles the complexity of sending the code to the server, executing it, and returning the results to the client.