dc0ebe8a49
Extiende init_api_app anadiendo la capa frontend: pnpm + vite + react + @mantine/core. Genera frontend/ con vite.config.ts (proxy /api y /health al backend + alias @fn_library a frontend/functions/ui), src/main.tsx con MantineProvider, src/App.tsx con AppShell y src/pages/Home.tsx consumiendo /api/v1/status. Flags: --port N, --with-auth, --with-db (delegadas a init_api_app). Docker compose para desarrollo. Verifica con pnpm install && pnpm build si pnpm esta disponible (skippable con SKIP_PNPM_BUILD=true). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4.2 KiB
4.2 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, example, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | params | output | tested | tests | test_file_path | example | file_path | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| init_web_app | pipeline | bash | pipelines | 1.0.0 | impure | init_web_app(nombre: string, [--port N], [--with-auth], [--with-db]) -> void | Scaffold de full-stack app: Go HTTP API backend + React frontend con Mantine y @fn_library. Extiende init_api_app anadiendo frontend/ con pnpm + vite + react + mantine. Genera vite.config.ts con proxy al backend y alias @fn_library, src/main.tsx con MantineProvider, src/App.tsx con AppShell, src/pages/Home.tsx con ejemplo consumiendo /api/v1/status. |
|
|
false | error_go_core |
|
app full-stack en apps/{nombre}/ con backend Go (main.go) y frontend/ (vite + react + mantine). Dev: terminal 1 go run .; terminal 2 cd frontend && pnpm dev. | false | fn run init_web_app my_dashboard --with-auth | bash/functions/pipelines/init_web_app.sh |
Sinopsis
fn run init_web_app <nombre> [--port N] [--with-auth] [--with-db]
Ejemplo rapido
fn run init_web_app inventory_dashboard --with-auth
cd apps/inventory_dashboard
make install # pnpm install del frontend
# Terminal 1:
CGO_ENABLED=1 go run .
# Terminal 2:
cd frontend && pnpm dev
# → http://localhost:5173 (frontend) proxea a :8080 (backend)
Archivos generados
Todos los de init_api_app, mas:
| Archivo | Descripcion |
|---|---|
frontend/package.json |
pnpm, vite, react, @mantine/core, @tabler/icons-react |
frontend/vite.config.ts |
Proxy /api y /health al backend + alias @fn_library |
frontend/tsconfig.json |
TS strict con paths @fn_library/* |
frontend/index.html |
Entry HTML minimo |
frontend/postcss.config.cjs |
postcss-preset-mantine + breakpoints |
frontend/src/main.tsx |
Root con MantineProvider + theme |
frontend/src/theme.ts |
createTheme() con primaryColor |
frontend/src/App.tsx |
AppShell con Burger + Navbar + Header |
frontend/src/pages/Home.tsx |
Pagina ejemplo que consume /api/v1/status |
docker-compose.yml |
Services: api + frontend (node alpine) |
Makefile |
Targets install, build-frontend, build, dev |
app.md |
Framework: net/http + vite + react + mantine |
Flags
| Flag | Efecto |
|---|---|
--port N |
Puerto del backend Go (default: 8080) — frontend Vite siempre en 5173 |
--with-auth |
JWT + tabla users al backend |
--with-db |
Store + SQLite setup al backend |
Post-setup
cd apps/{nombre}
cp .env.example .env
make install # pnpm install del frontend
# Desarrollo (2 terminales):
CGO_ENABLED=1 go run . # Terminal 1: backend :PORT
cd frontend && pnpm dev # Terminal 2: frontend :5173
# Produccion:
make build # build frontend + binario Go
./<nombre> # sirve todo en :PORT
Notas
Pipeline impuro: invoca primero init_api_app para el backend y luego
escribe el frontend. Si pnpm esta disponible y SKIP_PNPM_BUILD no es
true, ejecuta pnpm install && pnpm build como verificacion final.
El alias @fn_library en vite.config.ts apunta a
../../../frontend/functions/ui (relativo desde apps/{nombre}/frontend/).
Los componentes del registry se consumen sin duplicarlos.
Si apps/{nombre}/ ya existe, aborta sin sobrescribir.
El tag launcher permite que aparezca en el Pipeline Launcher TUI.