Skip to content

feat(examples): add micro-frontend example with Hub + multi-framework sub-apps#296

Open
lzxb wants to merge 19 commits intomasterfrom
feat-micro-app-example
Open

feat(examples): add micro-frontend example with Hub + multi-framework sub-apps#296
lzxb wants to merge 19 commits intomasterfrom
feat-micro-app-example

Conversation

@lzxb
Copy link
Copy Markdown
Contributor

@lzxb lzxb commented May 7, 2026

Summary

Add a complete micro-frontend example (examples/micro-app/) demonstrating Esmx v3 best practices with Hub + sub-apps using @esmx/router.

What's Included

  • ssr-micro-shared - Shared dependency hub exporting @esmx/router
  • ssr-micro-html - Native HTML + TypeScript micro-app
  • ssr-micro-vue2 - Vue 2.7 + Composition API micro-app
  • ssr-micro-vue3 - Vue 3.5 + SSR micro-app
  • ssr-micro-react - React 18 + Hooks micro-app
  • ssr-micro-hub - Framework-agnostic Hub aggregating all sub-app routes

Key Features

  • Build-time isolation, runtime integration via ESM Import Map
  • Framework libraries shared via modules.exports (vue, react, react-dom)
  • Server-only exports for SSR renderers (vue-server-renderer, @vue/server-renderer)
  • Home page with navigation cards at /
  • All routes support SSR: /html, /vue2, /vue3, /react

Documentation

  • README.md (Chinese) and README.en.md (English) for each package

… sub-apps

- Add ssr-micro-shared for sharing @esmx/router across all sub-apps
- Add ssr-micro-html with native HTML + TypeScript
- Add ssr-micro-vue2 with Vue 2.7 + Composition API
- Add ssr-micro-vue3 with Vue 3.5 + SSR
- Add ssr-micro-react with React 18 + Hooks
- Add ssr-micro-hub to aggregate all sub-app routes
- Configure modules.exports for framework library sharing (vue, react, react-dom)
- Configure server-only exports for vue-server-renderer and @vue/server-renderer
- Add README.md and README.en.md for each package
- Remove outdated ssr-demo-html and ssr-demo-preact-htm examples
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 7, 2026

Deploying esmx with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9d88560
Status:⚡️  Build in progress...

View logs

@lzxb lzxb force-pushed the feat-micro-app-example branch from 37060e3 to 0070dfb Compare May 7, 2026 12:44
Dev added 16 commits May 7, 2026 20:53
… cards

- Add consistent styling system with CSS animations
- Redesign home page with modern cards, icons, and feature section
- Update all sub-apps with consistent card-based layout
- Add fade-in animations for page transitions
- Use container element pattern for clean unmounting
- Improve visual hierarchy and responsive design
…igation

- Create useLayout() composable in ssr-micro-shared
- Add consistent sidebar with navigation across all micro-apps
- Integrate layout into Vue2, Vue3, React, HTML, and Hub home page
- Remove global layout styles from entry.server.ts
- Use fixed DOM IDs (esmx-sidebar, esmx-layout-footer) across all apps
- Only update active state and rebind events when DOM already exists
- Avoid DOM recreation during micro-app transitions
- Layout is now a class instance with mount/unmount methods
- useLayout() acts as a composable factory for Vue2/Vue3 setup usage
- Maintains shared DOM behavior to prevent flicker
…removing global animations

- Remove global fadeIn animation from entry.server.ts
- Return empty string in Layout.header if sidebar DOM already exists
- Prevent v-html from replacing existing sidebar on each app switch
- Vue3: Move app creation to factory function, use v-once in template
- React: Simplify app structure, add biome-ignore for safe HTML
- HTML: Move Layout creation to mount function
- Hub: Simplify home.ts Layout usage
…HomeApp)

- HtmlApp: class-based HTML micro-app with render/mount/unmount methods
- HomeApp: class-based Hub home page with render/mount/unmount methods
- Both follow Vue pattern: instance created in factory function
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