50 lines
2.3 KiB
Markdown
50 lines
2.3 KiB
Markdown
# `_app_template_` (scaffold-resident)
|
|
|
|
Skeleton for every user app. **Lives in the scaffold container, not the user's repo.** Users never see this directly — the scaffold instantiates from it when a new app is needed.
|
|
|
|
## How it gets instantiated
|
|
|
|
`pikku create-app <name>` (landed in #58) reads this directory from the scaffold's known path (`/opt/fabric/_app_template_/` inside the container) and:
|
|
|
|
1. Copies every file to `apps/<name>/` in the user's repo
|
|
2. Substitutes placeholders — `app`, `@project/app`, `5001`, `App`, `0.0.1`, `2026-04-17T11:42:52Z`
|
|
3. Adds to yarn workspaces, runs `yarn install`
|
|
4. Regenerates Caddyfile to route to the new app's dev server
|
|
5. Stamps `package.json` → `fabric.templateVersion` with the current skeleton version (for 3-way merge on later `upgrade-app`)
|
|
|
|
On first scaffold boot against an empty `apps/` dir, the scaffold auto-runs `create-app app` to seed the default.
|
|
|
|
## Placeholders
|
|
|
|
| Placeholder | Example | Notes |
|
|
|---|---|---|
|
|
| `app` | `admin` | Dir name + workspace slug |
|
|
| `@project/app` | `@project/admin` | `package.json` `name` |
|
|
| `5001` | `5002` | Next free port from 5001+ |
|
|
| `App` | `Admin` | `<title>`, app header |
|
|
| `0.0.1` | `0.0.1` | Version at instantiation — ancestor for `upgrade-app` |
|
|
| `2026-04-17T11:42:52Z` | ISO timestamp | Audit |
|
|
|
|
## What's here
|
|
|
|
- Vite + Mantine + TypeScript + ESLint + Stylelint config
|
|
- Root providers wiring (`main.tsx`) — react-query, router, i18next, Pikku RPC
|
|
- Theme entry (`src/theme.css`) — imports `@project/components/themes/default.css`, allows local overrides
|
|
- Default routes: `/login`, `/logout`, `/hello`
|
|
- Auth config scaffold (Auth0 active; GitHub / Google / Microsoft / Passwordless as `.ts.inactive` templates)
|
|
- EN locale baseline
|
|
|
|
## What's NOT here
|
|
|
|
- **Widgets / components / themes** → `@project/components` in the user's template repo (shared across every app)
|
|
- **Backend functions** → `@project/functions`
|
|
- **App-specific pages / wirings** — land in the instantiated `apps/<name>/src/pages/` after creation
|
|
|
|
## Upgrading an app to this skeleton version
|
|
|
|
```sh
|
|
pikku upgrade-app app # 3-way merge (see #57)
|
|
```
|
|
|
|
Uses `package.json` → `fabric.templateVersion` as the ancestor. Untouched files update; edited files get conflict markers or interactive diff.
|