Skip to content

Commit 0be1fcc

Browse files
committed
feat: add documentation for support of additional frontend frameworks and update templates overview
1 parent 9470ee0 commit 0be1fcc

File tree

2 files changed

+118
-7
lines changed

2 files changed

+118
-7
lines changed

docs/guide/frontend-frameworks.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
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.

docs/templates/index.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# Templates Overview
22

3-
All service templates live in `templates/` and are copied verbatim (with a Spring Boot properties rename step). Current templates:
3+
Service scaffolding comes from internal templates or official generators:
44

5-
- `node/` Express + `/health` endpoint
6-
- `python/` FastAPI + `/health`
7-
- `go/` net/http server + `/health`
8-
- `spring-boot/` Java with `/health` REST controller
9-
- `frontend/` Next.js minimal (or `create-next-app` output when generator used)
5+
- Internal templates (copied verbatim): `node/`, `python/`, `go/`, `spring-boot/`, `frontend/` (minimal Next.js when not using `--frontend-generator`).
6+
- External generators (no internal fallback unless added later): Remix (`create-remix`), Astro (`create-astro`), SvelteKit (`sv create` with legacy `create-svelte` fallback).
107

11-
Each template should stay minimal & dependency-light.
8+
Spring Boot still performs a post-copy rename of `application.properties.txt``application.properties`.
9+
10+
Keep internal templates minimal & dependency-light; external generator outputs are left intact.

0 commit comments

Comments
 (0)