split-micro-app

Splits standalone micro apps with React Router SSR, Workers, CDN deploys, and gateway routing.

Updated Jan 27, 2026
One-click install
npx skills add https://github.com/SmallAi-API/smaihub --skill split-micro-app-smallai-api
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: split-micro-app
Source: https://github.com/SmallAi-API/smaihub/tree/main/.agents/skills/split-micro-app
Command: npx skills add https://github.com/SmallAi-API/smaihub --skill split-micro-app-smallai-api

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Splitting a standalone micro app out of a large monorepo SPA involves many hidden failure modes: SSR bundle bloat from shared store imports, hydration mismatches, broken Docker serving chains, and deploy workflows that silently ship fallback surfaces. This Skill records the decisions and landmines for building, serving, and deploying React Router SSR/SSG micro apps on Cloudflare Workers with CDN assets. ## Core Features & Use Cases - SSR bundle weight reduction: Trace module importers, stub store hubs per environment, gate heavy routes behind client-only boundaries, and cut worker bundles from ~10MB to under 2MB gzip. - Dual hosting model: Serve the same app through a Cloud gateway with per-page SSR, or through Docker as a client-rendered SPA with a five-link build chain. - Prerendered SSG variant: Build locale-matrix prerendered documents with runtime config injection for apps that need no SSR at all. - Use Case: When adding a new standalone app like a share page or auth flow, use this Skill to wire the Vite React Router config, wrangler deploy, CDN asset upload, preview Worker versioning, and CI affected-detection without rediscovering known traps. ## Quick Start Use the split-micro-app skill to scaffold a new React Router SSR micro app under apps/ with worker deploy and CDN asset upload.

Frequently Asked Questions about split-micro-app

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reduce Cloudflare Worker SSR bundle size in a React Router app?

Trace which modules pull in heavy store code with a build-time module trace, then stub store hubs per SSR environment with callable empty-state hooks. Client-gate heavy routes and bypass barrel exports; this approach cut one app's SSR bundle from 9.84MB to 1.78MB gzip.

How to deploy React Router SSR apps to Cloudflare Workers with CDN assets?

Build with a stable CDN base URL, upload the hashed client assets to an R2 bucket, then run wrangler deploy against the server build. Content-hashed filenames make uploads incremental, so one prefix per app is safe across build origins.

Should I use SSR or prerendering for a Cloudflare Workers micro app?

Use prerendering with ssr: false when every page is config-free at render time; the worker becomes a small static picker with no SSR stubs. Use SSR when pages need per-request data, accepting the bundle-weight work that comes with it.

Why does my prerendered React Router page render twice in the DOM?

Serving a locale-prefixed prerendered document at the plain route breaks hydration: React Router finds no context for the prefixed route id and re-renders the whole document. Build one pass per locale so each document lives at its canonical path.

Why does my Vite dev server return 200 but never load the micro app?

The dev shell handler falls back to the main SPA HTML when the root-level index template file is missing, returning a 200 that silently serves the wrong app. Verify the template file exists at the repo root and points at the app's entry.

Can preview builds upload to the production Cloudflare Worker?

No. Preview uploads count against the 100-version rollback window of a script, so previews must target a separate sibling Worker with its own name. Bootstrap the preview Worker once with wrangler deploy before the first version upload.