theme | class | highlighter | drawings | transition | title | layout | |
---|---|---|---|---|---|---|---|
./theme |
text-center |
shiki |
|
slide-left |
APL Website Architecture |
intro |
- Simplicity
- Discoverability (SEO)
- Initial page load
- Do as much work on the server as possible
- Send as little data over the network as possible
- Ship HTML to your users
- Make pages work before JavaScript loads
- Embrace web standards and browser defaults
- If you fetch your data on the client, you can't load images until it loads data, you can't load data until you load JavaScript, and you can't load JavaScript until the document loads
- The user's network is a multiplier for every single step in that chain 😫
- Always fetching on the server removes the user's network as a multiplier everywhere else
- Mobile network
- Nested routing
- Partial hydration / Islands
- Websites should work as soon as you can see them: progressive enhancement!
- Websites that are rendered entirely via JavaScript require waiting for the script(s) to download and execute before anything is displayed to users
HTML |---|
JavaScript |---------|
Data |---------------|
page rendered 👆
- HTML will download and display quicker than JavaScript and allows more parallel execution
👇 first byte
HTML |---|-----------|
JavaScript |---------|
Data |---------------|
page rendered 👆
- Why? Everyone has JavaScript, right?
- The data layer of your site should function with or without JavaScript on the page
- It will make your website feel faster
- This is part of progressive enhancement
<form>
<link rel="prefetch">
- URLs for assets
Cache-Control
- With the flexibility to server render & not use React: Astro with Preact Islands
- If we can server render, but want to use React: Remix
- For a greenfield rewrite focused solely on client-rendering: Remix
- For an incremental rewrite, working within Drupal: Sprinkles of Preact or Lit web components
- Replace one route at a time (e.g.
/meeting-rooms
) with greenfield pages/apps built on new technologies - Could be done via Drupal or Nginx/reverse proxy configuration to redirect requests to different servers or client bundles
- Allows incremental adoption of modern technologies without needing to wholesale replace everything at once
- Replace imperative front-end code with an embedded declarative framework (Preact or Lit web components)
- Can embed directly in Drupal pages without needing to replace existing routes
- Need to figure out a bundling strategy to keep from having waterfall requests
- Juggling server rendering via Drupal and hydrating via the client-side framework might be more technically challenging