* fix: intoducing cargo all-features clippy * fix: change check to clippy for better diagnostics * chore: build is redundant * fix: lint task * feat: speed up tests by 2x with cargo-nextest * fix: re-add flags * fix: router example build process * fix: correct clippy arguments * fix: adapt examples makefile to new tools * fix(CI): add cargo-all-features part of CI dep * fix: just warn if there is no tests * fix(CI): add clippy and rustfmt components * fix: nextest in examples * fix: clippy should not run on empty set of features in examples (quickfix) * fix: pin cargo-all-features installation to a branch * fix: nextest --no-tests=warn? * fix: do not use built-in cargo-make workflows * fix: remove --all-targets * fix: do not run tests in parallel in certain examples * fix: disable nextest for examples * fix: properly override the make task * chore: run tests with no-deps * fix: hackernews_islands_axum * fix(CI): properly use --no-deps * fix(CI): --no-deps is not supported in tests * fix(CI): run doctests separately due to stable rust limitation in nextest * fix(examples): makefile lint recursion * fix(CI): run tests correctly * fix: remove unused clear in test makefile * fix: --no-deps positional arg in clippy * fix: run doctests for all-features * fix: running cargo-all-features over doctests * fix: improve playwright makefile
SSR Mode Axum Example
This example shows the different "rendering modes" that can be used while server-side rendering an application.
Getting Started
See the Examples README for setup and run instructions.
Server-Side Rendering Modes
-
Synchronous: Serve an HTML shell that includes
fallbackfor anySuspense. Load data on the client, replacingfallbackonce they're loaded.- Pros: App shell appears very quickly: great TTFB (time to first byte).
- Cons: Resources load relatively slowly; you need to wait for JS + Wasm to load before even making a request.
-
Out-of-order streaming: Serve an HTML shell that includes
fallbackfor anySuspense. Load data on the server, streaming it down to the client as it resolves, and streaming down HTML forSuspensenodes.- Pros: Combines the best of synchronous and
async, with a very fast shell and resources that begin loading on the server. - Cons: Requires JS for suspended fragments to appear in correct order. Weaker meta tag support when it depends on data that's under suspense (has already streamed down
<head>)
- Pros: Combines the best of synchronous and
-
In-order streaming: Walk through the tree, returning HTML synchronously as in synchronous rendering and out-of-order streaming until you hit a
Suspense. At that point, wait for all its data to load, then render it, then the rest of the tree.- Pros: Does not require JS for HTML to appear in correct order.
- Cons: Loads the shell more slowly than out-of-order streaming or synchronous rendering because it needs to pause at every
Suspense. Cannot begin hydration until the entire page has loaded, so earlier pieces of the page will not be interactive until the suspended chunks have loaded.
-
async: Load all resources on the server. Wait until all data are loaded, and render HTML in one sweep.- Pros: Better handling for meta tags (because you know async data even before you render the
<head>). Faster complete load than synchronous because async resources begin loading on server. - Cons: Slower load time/TTFB: you need to wait for all async resources to load before displaying anything on the client.
- Pros: Better handling for meta tags (because you know async data even before you render the
Quick Start
Run cargo leptos watch to run this example.