Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Initial static page via SSR: When a user initially visits any page in the DSpace user interface (UI), this triggers server-side rendering (SSR) via Angular Universal.  This means that the UI (Javascript) application is run on the server by Node.js. The result is that a static HTML page is generated, which will be sent back to the user.
    1. This process of rendering the static HTML page will result in Node.js making requests to REST API to gather all the data necessary to build the static HTML page.
  2. Static page is dynamically replaced by UI application: The user briefly sees the generated static HTML page while the UI (Javascript) application is downloading to their browser .  This allows the user to immediately see the DSpace User Interface even before it becomes interactive. As soon as the UI application finishes downloading, it dynamically replaces that static HTML page, making the User Interface interactive to the user.  (The time between the UI page appearing and becoming interactive is usually unnoticeable to a user.)  This entire process is handled by Angular Universal.
  3. Interactions with the UI application send requests to the REST API (CSR): As soon as the UI becomes interactive, it runs entirely in the user's browser (as any other Javascript application).  This means that when the user interacts with the application (by clicking links/buttons or typing in fields, etc), this will send requests from the user's browser to the REST API (backend).  This is called client-side rendering (CSR) as all HTML is generated within the user's browser.
    1. At this point, every action in the User Interface will generate one or more requests to the REST API to gather necessary data.  These requests are all visible in the user's browser (in the "Network" tab of the browser's "Developer tools").

NOTE: For bots or clients without the ability to run Javascript, every page request will trigger SSR. This is because the static page can never be dynamically replaced by the User Interface application (in step 2 above).  However, this is necessary behavior to support Search Engine Optimization. Some search engine bots cannot run Javascript & therefore cannot index sites which do not generate static HTML.

Keep in mind, SSR can be potentially taxing for very large pages with a lot of objects or data display.  This is because Node.js has to make requests to the REST API to gather all the data for the page before rendering the static HTML.  Because of this, we do also document some Performance Tuning suggestions for the User Interface (e.g. there is an option to cache these SSR generated static pages in order to generate them less frequently).Finally, it's worth noting that running

Note
titleSome bots and clients may use server-side rendering at all times

For bots or clients without the ability to run Javascript, every page request will trigger SSR (server side rendering). This is because the static HTML page can never be dynamically replaced by the User Interface application (in step 2 above).  However, this behavior is necessary to support Search Engine Optimization. Some search engine bots cannot run Javascript & therefore cannot index sites which do not generate static HTML pages.


Info
titleRunning the user interface in development mode disables SSR and may impact SEO

Running the user interface (frontend) in development mode will only utilize client side rendering (CSR) (as described in step 3 above).  This means SSR will never trigger, and all HTML will be generated in the user's browser.  It also means that bots or clients without the ability to run Javascript will be unable to interact with the site (which can

...

negatively impact Search Engine Optimization)