Skip to content

feat(examples): add chat-app and webui-todo-app SSR examples with design tokens#7526

Closed
janechu wants to merge 1 commit into
microsoft:mainfrom
janechu:users/janechu/update-example-apps
Closed

feat(examples): add chat-app and webui-todo-app SSR examples with design tokens#7526
janechu wants to merge 1 commit into
microsoft:mainfrom
janechu:users/janechu/update-example-apps

Conversation

@janechu
Copy link
Copy Markdown
Collaborator

@janechu janechu commented May 21, 2026

Pull Request

📖 Description

Adds two new SSR example apps and adopts the shared CSS design system that landed in #7524.

  • examples/ssr/chat-app/ — declarative FAST chat demo. Initial markup is pre-rendered with @microsoft/fast-build; each assistant reply is streamed into the transcript with the hidden-iframe + document.write() technique. Hard-coded dark theme.
  • examples/ssr/webui-todo-app/ — todo app pre-rendered by @microsoft/webui and hydrated by @microsoft/fast-html via <f-template>. Hard-coded light theme.

Both apps live under the new examples/ssr/ folder (separate from examples/csr/) because both rely on a server-side rendering backend rather than a client-only bootstrap. Both consume @microsoft/fast-examples-design-system for every color, type ramp, spacing, corner, stroke, shadow, duration, and easing value through var(--fast-...) tokens. Neither app implements a runtime theme toggle; data-theme is set statically in the entry HTML.

This change supersedes the two open PRs for these example apps:

The merged PRs #7523 (todo-mobx-app) and #7524 (CSS-only design system) provide the conventions this PR follows.

👩‍💻 Reviewer Notes

  • Folder layout. examples/csr/ keeps purely client-rendered examples. examples/ssr/ now holds examples whose initial markup is produced server-side and hydrated in the browser. The workspace-level README, DESIGN.md, and .github/copilot-instructions.md describe this split.
  • Design-system wiring. Each app imports @microsoft/fast-examples-design-system/tokens.css exactly once from its TypeScript entry. The webui-todo-app's src/index.ts triggers esbuild to emit dist/index.css, which src/index.html links before the inline page-shell styles. The chat-app's entry.html links public/styles.css directly, and that stylesheet is shared with every component shadow root via <link rel="stylesheet"> inside each <template shadowrootmode="open">.
  • Theme selection. Themes are hard-coded with <html data-theme="dark"> (chat-app) and <html data-theme="light"> (webui-todo-app). No runtime toggle, no theme persistence.
  • Fast-element versions. The chat-app declares "@microsoft/fast-element": "^3.0.0-rc.1", so npm installs the v3 RC into the chat-app's local node_modules. The webui-todo-app uses the workspace fast-element 2.x. Both build cleanly from the same checkout.
  • Generated index.html. examples/ssr/chat-app/index.html is regenerated by build-markup.mjs from entry.html + state.json + templates.html on every build, so it is gitignored at the example level.

📑 Test Plan

From the monorepo root:

npm run build           # all 10 workspaces build successfully
npm run biome:ci        # 26 staged files in examples/ssr/ pass
npm run checkchange     # no change files needed (both new packages are private)

Manual smoke test:

# Chat app
npm run start -w @microsoft/fast-chat-app-example
# → http://localhost:9000
#   Try: "Hi", "How are you?", "What's the weather like?", "Tell me a joke", "What can you do?", "Goodbye"

# WebUI todo app
npm start -w @microsoft/fast-webui-todo-app-example
# → http://localhost:8081
#   Try: add an item, toggle complete, delete an item

✅ Checklist

General

  • I have included a change request file using $ npm run change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

⏭ Next Steps

- Add examples/ssr/chat-app/ — declarative FAST chat demo using
  @microsoft/fast-build for SSR pre-rendering and hidden-iframe
  streaming for assistant replies. Uses the dark theme statically.
- Add examples/ssr/webui-todo-app/ — todo app using @microsoft/webui for
  server-side prerendering and @microsoft/fast-html for hydration. Uses
  the light theme statically.
- Both apps consume @microsoft/fast-examples-design-system tokens via
  CSS custom properties. No hard-coded design values; no runtime theme
  switching.
- Add 'examples/ssr/*' to the root workspaces config and update the
  workspace-level README.md, DESIGN.md, and .github/copilot-instructions
  to describe the new ssr/ subfolder.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@janechu
Copy link
Copy Markdown
Collaborator Author

janechu commented May 21, 2026

Closing in favor of updating the original PRs #7424 and #7518 directly.

@janechu janechu closed this May 21, 2026
@janechu janechu deleted the users/janechu/update-example-apps branch May 21, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant