|
| 1 | +# Modern Frontend Framework Support |
| 2 | + |
| 3 | +create-polyglot can scaffold additional frontend frameworks beyond the default Next.js. |
| 4 | + |
| 5 | +## Supported Frameworks |
| 6 | + |
| 7 | +- **Next.js** (internal template or `create-next-app` when `--frontend-generator` is passed) |
| 8 | +- **Remix** (via `npx create-remix@latest . --template remix`) |
| 9 | +- **Astro** (via `npx create-astro@latest -- --template minimal`) |
| 10 | +- **SvelteKit** (via `npx sv create .`; falls back to `npx create-svelte@latest . --template skeleton` if the new command fails) |
| 11 | + |
| 12 | +## Selecting Frameworks |
| 13 | + |
| 14 | +Specify them in the `--services` list during init or with `create-polyglot add service`: |
| 15 | + |
| 16 | +```bash |
| 17 | +create-polyglot init my-stack -s remix,astro,sveltekit --yes |
| 18 | +create-polyglot add service docs --type astro --port 3030 |
| 19 | +``` |
| 20 | + |
| 21 | +## Ports |
| 22 | + |
| 23 | +Default ports: |
| 24 | + |
| 25 | +```text |
| 26 | +remix: 3005 |
| 27 | +astro: 3006 |
| 28 | +sveltekit: 3007 |
| 29 | +``` |
| 30 | + |
| 31 | +Override any port via `type:name:port` syntax: |
| 32 | + |
| 33 | +```bash |
| 34 | +create-polyglot init web-app -s remix:web:3100,astro:site:3200,sveltekit:kit:3300 --yes |
| 35 | +``` |
| 36 | + |
| 37 | +## Generation Behavior |
| 38 | + |
| 39 | +| Framework | Generation Method | Fallback | Notes | |
| 40 | +|-----------|-------------------|----------|-------| |
| 41 | +| Remix | `create-remix` | None (skip on failure) | Skipped if generator errors. | |
| 42 | +| Astro | `create-astro` | None (skip on failure) | Uses `--template minimal`. | |
| 43 | +| SvelteKit | `sv create` | `create-svelte` | Deprecation handled gracefully. | |
| 44 | + |
| 45 | +Failed generators log an error and the service is skipped (not partially scaffolded) to avoid broken directories. |
| 46 | + |
| 47 | +## Docker |
| 48 | + |
| 49 | +All Node-based frameworks (Remix, Astro, SvelteKit) reuse the generic Node Dockerfile pattern: |
| 50 | + |
| 51 | +```Dockerfile |
| 52 | +FROM node:20-alpine AS deps |
| 53 | +WORKDIR /app |
| 54 | +COPY package*.json ./ |
| 55 | +RUN npm install --omit=dev || true |
| 56 | +COPY . . |
| 57 | +EXPOSE <PORT> |
| 58 | +CMD ["npm", "run", "dev"] |
| 59 | +``` |
| 60 | + |
| 61 | +Adjust after generation if framework-specific build or preview commands are desired. |
| 62 | + |
| 63 | +## Service Manager |
| 64 | + |
| 65 | +Runtime start uses the detected package manager and `npm run dev` (or equivalent) for these frameworks. Ensure the generator produces a `dev` script. If not, add one manually. |
| 66 | + |
| 67 | +## Caveats & Future Plans |
| 68 | + |
| 69 | +- No internal fallback templates (kept lean). Potential future flag: `--allow-fallback`. |
| 70 | +- Post-generation customization (eslint, prettier) left to user. |
| 71 | +- May add automatic build scripts & production Docker variants later. |
| 72 | + |
| 73 | +## Example Full Init |
| 74 | + |
| 75 | +```bash |
| 76 | +npx create-polyglot init multi-web -s node,remix,astro,sveltekit --git --yes |
| 77 | +``` |
| 78 | + |
| 79 | +After scaffold: |
| 80 | + |
| 81 | +```bash |
| 82 | +cd multi-web |
| 83 | +npm run list:services |
| 84 | +create-polyglot dev |
| 85 | +``` |
| 86 | + |
| 87 | +## Troubleshooting |
| 88 | + |
| 89 | +| Issue | Cause | Fix | |
| 90 | +|-------|-------|-----| |
| 91 | +| Generator network failure | Offline or registry issue | Retry with stable connection; consider adding fallback templates. | |
| 92 | +| Missing dev script | Generator changed defaults | Add `"dev": "<framework command>"` to `package.json`. | |
| 93 | +| Port collision | Duplicate specified port | Re-run with adjusted port list or edit `polyglot.json` then restart. | |
| 94 | +| SvelteKit deprecation warning | Using legacy command | Ensure `sv` is available; keep fallback until ecosystem fully migrates. | |
| 95 | + |
| 96 | +## Updating Existing Workspace |
| 97 | + |
| 98 | +Add a new framework to an existing project: |
| 99 | + |
| 100 | +```bash |
| 101 | +create-polyglot add service ui-new --type sveltekit --port 3400 |
| 102 | +``` |
| 103 | + |
| 104 | +Remove it later: |
| 105 | + |
| 106 | +```bash |
| 107 | +create-polyglot remove service ui-new --yes |
| 108 | +``` |
| 109 | + |
| 110 | +--- |
| 111 | + |
| 112 | +Need another framework (e.g., Nuxt, SolidStart)? Open an issue or PR with a proposed generator command. |
0 commit comments