create-wervt 0.2.14 → 0.2.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -0
- package/package.json +2 -2
- package/template/.claude/skills/nuxt-ui/SKILL.md +85 -243
- package/template/.claude/skills/nuxt-ui/references/components.md +184 -313
- package/template/.claude/skills/nuxt-ui/references/guidelines/component-selection.md +124 -0
- package/template/.claude/skills/nuxt-ui/references/guidelines/conventions.md +372 -0
- package/template/.claude/skills/nuxt-ui/references/guidelines/design-system.md +378 -0
- package/template/.claude/skills/nuxt-ui/references/guidelines/forms.md +235 -0
- package/template/.claude/skills/nuxt-ui/references/layouts/chat.md +140 -77
- package/template/.claude/skills/nuxt-ui/references/layouts/dashboard.md +33 -19
- package/template/.claude/skills/nuxt-ui/references/layouts/docs.md +23 -12
- package/template/.claude/skills/nuxt-ui/references/layouts/editor.md +49 -63
- package/template/.claude/skills/nuxt-ui/references/layouts/{page.md → landing.md} +43 -118
- package/template/.claude/skills/nuxt-ui/references/recipes/auth.md +162 -0
- package/template/.claude/skills/nuxt-ui/references/recipes/data-tables.md +249 -0
- package/template/.claude/skills/nuxt-ui/references/recipes/navigation.md +90 -0
- package/template/.claude/skills/nuxt-ui/references/recipes/overlays.md +177 -0
- package/template/.claude/skills/nuxt-ui-mobile/SKILL.md +38 -10
- package/template/.claude/skills/nuxt-ui-mobile/references/identity.md +127 -0
- package/template/.claude/skills/nuxt-ui-mobile/references/patterns.md +1 -0
- package/template/.claude/skills/nuxt-ui-mobile/references/review-checklist.md +14 -6
- package/template/.claude/skills/nuxt-ui-mobile/references/tokens.md +1 -1
- package/template/.claude/skills/nuxt-ui-mobile/template/app/assets/css/main.css +9 -9
- package/template/.claude/skills/nuxt-ui-mobile/template/app/components/mobile/ListSection.vue +7 -3
- package/template/.claude/skills/nuxt-ui-mobile/template/app/components/mobile/NavBar.vue +13 -4
- package/template/.claude/skills/nuxt-ui-mobile/template/nuxt.config.ts +2 -1
- package/template/AGENTS.md +175 -9
- package/template/drizzle/20261005212059_sudden_titania/snapshot.json +46 -25
- package/template/golar.config.ts +5 -0
- package/template/nuxt.config.ts +7 -0
- package/template/package.json +9 -6
- package/template/pnpm-workspace.yaml +2 -0
- package/template/server/api/example-secret.get.ts +8 -0
- package/template/.claude/skills/nuxt-ui/references/composables.md +0 -127
- package/template/.claude/skills/nuxt-ui/references/theming.md +0 -427
|
@@ -29,17 +29,23 @@ onMounted(() => {
|
|
|
29
29
|
})
|
|
30
30
|
onBeforeUnmount(() => window.removeEventListener('scroll', update))
|
|
31
31
|
|
|
32
|
+
// Back must not push: pushing the parent puts it on top of the child, and the next back from
|
|
33
|
+
// the parent lands on the child again.
|
|
32
34
|
function goBack() {
|
|
33
|
-
|
|
34
|
-
if (
|
|
35
|
-
|
|
35
|
+
const previous = window.history.state?.back
|
|
36
|
+
if (typeof props.back === 'string') {
|
|
37
|
+
if (previous === props.back) return router.back()
|
|
38
|
+
return router.replace(props.back)
|
|
39
|
+
}
|
|
40
|
+
if (previous) return router.back()
|
|
41
|
+
router.replace('/')
|
|
36
42
|
}
|
|
37
43
|
</script>
|
|
38
44
|
|
|
39
45
|
<template>
|
|
40
46
|
<header
|
|
41
47
|
ref="bar"
|
|
42
|
-
class="sticky top-0 z-30 pt-safe transition-[background-color,box-shadow] duration-200 select-none"
|
|
48
|
+
class="sticky top-0 z-30 pt-[max(env(safe-area-inset-top),0.5rem)] pb-2 transition-[background-color,box-shadow] duration-200 select-none"
|
|
43
49
|
:class="scrolled && collapsed ? 'glass-bar shadow-[0_0.5px_0_var(--ui-border)]' : 'bg-transparent'"
|
|
44
50
|
>
|
|
45
51
|
<div class="grid h-(--ui-header-height) grid-cols-[1fr_auto_1fr] items-center gap-2 px-4">
|
|
@@ -81,6 +87,9 @@ function goBack() {
|
|
|
81
87
|
<h1 v-else class="sr-only">
|
|
82
88
|
{{ title }}
|
|
83
89
|
</h1>
|
|
90
|
+
<!-- Without a large title nothing separates the bar from the content. After the v-if/v-else
|
|
91
|
+
pair: in between it would break the chain. -->
|
|
92
|
+
<div v-if="!large" class="h-1" aria-hidden="true" />
|
|
84
93
|
|
|
85
94
|
<div v-if="$slots.default" class="px-4 pb-2">
|
|
86
95
|
<slot />
|
|
@@ -3,7 +3,8 @@ export default defineNuxtConfig({
|
|
|
3
3
|
|
|
4
4
|
css: ['~/assets/css/main.css'],
|
|
5
5
|
|
|
6
|
-
// System font
|
|
6
|
+
// System font by default. Set to true when the app uses a display font (references/identity.md):
|
|
7
|
+
// @nuxt/fonts then downloads and self-hosts it.
|
|
7
8
|
ui: {
|
|
8
9
|
fonts: false
|
|
9
10
|
},
|
package/template/AGENTS.md
CHANGED
|
@@ -24,13 +24,30 @@ Pick the UI stack by the kind of app:
|
|
|
24
24
|
their own identity): Reka UI (`reka-ui`) for accessible behavior (dialogs, menus, popovers,
|
|
25
25
|
sliders, …) and Tailwind CSS with your own styles on top. Don't bend Nuxt UI's theme into a
|
|
26
26
|
different design.
|
|
27
|
-
- **Pure mobile apps** (used mainly on phones, should feel like a
|
|
28
|
-
`nuxt-ui-mobile` skill
|
|
27
|
+
- **Pure mobile apps** (used mainly on phones, should feel like a real app from the App Store):
|
|
28
|
+
Nuxt UI with the `nuxt-ui-mobile` skill: iOS mechanics plus an own look per app (brand color,
|
|
29
|
+
imagery, a home screen with the person's content). Read its `SKILL.md` and decide the app's
|
|
30
|
+
identity before writing UI, then follow its rules. Its
|
|
29
31
|
`template/app/*` files go to the project root here: this app keeps `app.vue`, `pages/` and
|
|
30
32
|
`components/` at the root, not in `app/`.
|
|
31
33
|
|
|
32
34
|
Reka UI primitives are fine inside a Nuxt UI app for a one-off component Nuxt UI doesn't have.
|
|
33
35
|
|
|
36
|
+
Icons: the isolate can't reach the Iconify API, so install every icon collection the app uses as
|
|
37
|
+
a dev dependency when adding Nuxt UI (or `@nuxt/icon`): `pnpm add -D @iconify-json/lucide` (Nuxt
|
|
38
|
+
UI's own icons are Lucide), plus `@iconify-json/<name>` for each other prefix you use (`i-<name>-…`).
|
|
39
|
+
@nuxt/icon bundles the locally installed collections into the server by itself; `@wervt/nuxt` only
|
|
40
|
+
stops the server from falling back to the API and warns on build when Lucide is missing (the full
|
|
41
|
+
`@iconify/json` package counts too).
|
|
42
|
+
Icons that only show up after the page loaded (client-only parts, `v-if` on fetched data) need
|
|
43
|
+
their data in the client bundle too: `icon: { clientBundle: { scan: true } }` in `nuxt.config.ts`.
|
|
44
|
+
Otherwise they render empty in the browser while the server-rendered ones look fine.
|
|
45
|
+
|
|
46
|
+
OG images (`defineOgImage`): `pnpm add nuxt-og-image @takumi-rs/core @takumi-rs/wasm`. The isolate
|
|
47
|
+
can't load native renderers, so `@wervt/nuxt` switches nuxt-og-image to WebAssembly; don't set
|
|
48
|
+
`ogImage.compatibility` yourself. PNG only (no sharp). A private app's `/_og/…` images need a
|
|
49
|
+
login, so chats can't show them: use `wervt: { preview }` (below) for its shared links.
|
|
50
|
+
|
|
34
51
|
## Server routes
|
|
35
52
|
|
|
36
53
|
Use `defineEventHandler` and friends from `nuxt/server` (never `h3` or `nitro/h3`), and validate
|
|
@@ -59,6 +76,29 @@ export default defineEventHandler(async (event) => {
|
|
|
59
76
|
- Throw `createError({ status: 404, message: '…' })` for errors.
|
|
60
77
|
- Cookies and sessions: `getCookie`, `setCookie`, `useSession` from `nuxt/server`.
|
|
61
78
|
- Nothing is auto-imported on the server: import everything explicitly.
|
|
79
|
+
- Configuration and secrets: `runtimeConfig`, see below. No `process.env` in app code.
|
|
80
|
+
|
|
81
|
+
### Configuration and secrets
|
|
82
|
+
|
|
83
|
+
Declare every setting and secret in `runtimeConfig` in `nuxt.config.ts`, with an empty or default
|
|
84
|
+
value, and read it with `useRuntimeConfig()` from `nuxt/server` (in Vue code: `useRuntimeConfig()`,
|
|
85
|
+
`public` keys only). The defaults type it, and keys outside `public` never reach the browser.
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
// nuxt.config.ts
|
|
89
|
+
runtimeConfig: { weatherApiKey: '', public: { mapStyle: 'light' } },
|
|
90
|
+
|
|
91
|
+
// server/api/weather.get.ts
|
|
92
|
+
const { weatherApiKey } = useRuntimeConfig()
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- Values come from `wervt env <app> --set NUXT_<KEY>=…`, applied from the next request without a
|
|
96
|
+
deploy. The name is the key in SCREAMING_SNAKE_CASE with `NUXT_` in front: `weatherApiKey` →
|
|
97
|
+
`NUXT_WEATHER_API_KEY`, `public.mapStyle` → `NUXT_PUBLIC_MAP_STYLE`.
|
|
98
|
+
- Only declared keys are overridden: a `NUXT_*` variable without a key in `runtimeConfig` is ignored.
|
|
99
|
+
- Locally they come from `.env` (gitignored) with the same names.
|
|
100
|
+
- `server/api/example-secret.get.ts` shows the pattern with `exampleSecret`; replace it.
|
|
101
|
+
- `process.env` still works (and is typed by `@wervt/nuxt`), but don't use it for app settings.
|
|
62
102
|
|
|
63
103
|
## Database
|
|
64
104
|
|
|
@@ -85,8 +125,9 @@ Example and fixture data goes into the `db:seed` task in `server/tasks/db/seed.t
|
|
|
85
125
|
migrations. Keep it idempotent: `seedTable(table, rows)` from `@wervt/nuxt/server` only inserts
|
|
86
126
|
while the table is empty.
|
|
87
127
|
|
|
88
|
-
- `nuxt dev` runs it once, right after it created and migrated a new local database.
|
|
89
|
-
|
|
128
|
+
- `nuxt dev` runs it once, right after it created and migrated a new local database. Tables you
|
|
129
|
+
add to an existing database stay empty: after `pnpm db:generate`, wait for the dev server to
|
|
130
|
+
migrate, then `pnpm exec nuxt task run db:seed`.
|
|
90
131
|
- It's never scheduled and never runs on deploy. Seed production only when asked:
|
|
91
132
|
`pnpm exec wervt tasks <app> --run db:seed`.
|
|
92
133
|
- Update the seed when the schema changes, so a new database still seeds.
|
|
@@ -123,6 +164,9 @@ const { data: todos, isLive } = await useShape('/api/shapes/todos')
|
|
|
123
164
|
- Column names are what the client sees, so keep them camelCase like the schema keys (no
|
|
124
165
|
snake_case `casing`).
|
|
125
166
|
- Never put secrets in a shape: list the `columns` a client may see.
|
|
167
|
+
- A shape route that needs a user answers 401 without one. `useShape` then has no
|
|
168
|
+
rows, no error and `unauthorized: true`, e.g. for the deploy's anonymous page check; no `v-if`
|
|
169
|
+
guard needed. Public apps can use `unauthorized` to show "sign in" instead of an empty state.
|
|
126
170
|
- Do auth checks in the shape route and restrict rows with `where`. Pass values as `params`,
|
|
127
171
|
never by building the SQL string:
|
|
128
172
|
|
|
@@ -142,6 +186,10 @@ version polling. For a banner in the app's own design, set `wervt: { updates: 'm
|
|
|
142
186
|
auto-imported) give the signed-in wervt user or nothing. Private apps always have one; public
|
|
143
187
|
apps only when the visitor signed in. It works with `ssr: false` too (no own `/api/me` needed). Link to `wervtLoginUrl(path)` / `wervtLogoutUrl(path)` as
|
|
144
188
|
external links. Never build your own login or OAuth.
|
|
189
|
+
- `user.role` is what they are to the app: `owner`, `member`, `admin` (wervt), `invited`,
|
|
190
|
+
`allowed` or `public`. Guard the app's admin features with
|
|
191
|
+
`requireWervtRole(event, 'owner', 'member', 'admin')` from `@wervt/nuxt/server`; don't keep
|
|
192
|
+
admin emails in env variables.
|
|
145
193
|
- Private apps show a link preview to visitors without a login (chats unfurling a shared link):
|
|
146
194
|
only the app name and icon unless `wervt: { preview: { title, description, image: '/og.png' } }`
|
|
147
195
|
is set (`true` takes them from `app.head`; `false` turns it off). Put the image (1200×630) in
|
|
@@ -168,6 +216,101 @@ own bucket and `@wervt/nuxt` connects it; don't configure a provider or S3 crede
|
|
|
168
216
|
- No tus uploads and no `transform` / sharp: they need a disk and native modules.
|
|
169
217
|
- Check access in the route before serving a file.
|
|
170
218
|
|
|
219
|
+
## Real-world things
|
|
220
|
+
|
|
221
|
+
When the app is about things that exist (films, series, books, places, dishes, plants, people,
|
|
222
|
+
brands), show real ones with real pictures instead of made-up entries, and let people find them
|
|
223
|
+
by typing. Wikipedia covers most of that, in every language, with no key: a search returns the
|
|
224
|
+
title, a one-sentence description and the lead image. Covers of films and albums are only on the
|
|
225
|
+
English Wikipedia, so the route falls back to it for pictures.
|
|
226
|
+
|
|
227
|
+
```ts
|
|
228
|
+
// server/api/lookup.get.ts
|
|
229
|
+
import { useValidatedQuery } from '@wervt/nuxt/server'
|
|
230
|
+
import { defineEventHandler } from 'nuxt/server'
|
|
231
|
+
import * as v from 'valibot'
|
|
232
|
+
|
|
233
|
+
type Page = {
|
|
234
|
+
title: string
|
|
235
|
+
index: number
|
|
236
|
+
fullurl: string
|
|
237
|
+
extract?: string
|
|
238
|
+
thumbnail?: { source: string }
|
|
239
|
+
langlinks?: { title: string }[]
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Wikimedia asks every client to name itself.
|
|
243
|
+
const AGENT = 'wervt-app (https://wervt.app)'
|
|
244
|
+
|
|
245
|
+
async function wiki(lang: string, params: Record<string, string>) {
|
|
246
|
+
const url = new URL(`https://${lang}.wikipedia.org/w/api.php`)
|
|
247
|
+
const query = { action: 'query', format: 'json', formatversion: '2', ...params }
|
|
248
|
+
for (const [key, value] of Object.entries(query)) url.searchParams.set(key, value)
|
|
249
|
+
const res = await fetch(url, { headers: { 'user-agent': AGENT } })
|
|
250
|
+
if (!res.ok) return []
|
|
251
|
+
return ((await res.json()) as { query?: { pages?: Page[] } }).query?.pages ?? []
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export default defineEventHandler(async (event) => {
|
|
255
|
+
const { q } = await useValidatedQuery(event, {
|
|
256
|
+
q: v.pipe(v.string(), v.trim(), v.minLength(2), v.maxLength(100)),
|
|
257
|
+
})
|
|
258
|
+
const lang: string = 'de' // the app's language
|
|
259
|
+
const pages = (
|
|
260
|
+
await wiki(lang, {
|
|
261
|
+
// Adding the kind (`${q} Film`) keeps a film app from finding the physicist first.
|
|
262
|
+
generator: 'search',
|
|
263
|
+
gsrsearch: q,
|
|
264
|
+
gsrlimit: '6',
|
|
265
|
+
prop: 'pageimages|extracts|langlinks|info',
|
|
266
|
+
inprop: 'url',
|
|
267
|
+
piprop: 'thumbnail',
|
|
268
|
+
pithumbsize: '400',
|
|
269
|
+
pilicense: 'any',
|
|
270
|
+
exintro: '1',
|
|
271
|
+
explaintext: '1',
|
|
272
|
+
exsentences: '1',
|
|
273
|
+
exlimit: '6',
|
|
274
|
+
lllang: 'en',
|
|
275
|
+
lllimit: '6',
|
|
276
|
+
})
|
|
277
|
+
).sort((a, b) => a.index - b.index)
|
|
278
|
+
|
|
279
|
+
const english = pages.flatMap((p) =>
|
|
280
|
+
!p.thumbnail && p.langlinks?.[0] ? [p.langlinks[0].title] : [],
|
|
281
|
+
)
|
|
282
|
+
const covers = new Map<string, string>()
|
|
283
|
+
if (english.length && lang !== 'en') {
|
|
284
|
+
const params = {
|
|
285
|
+
titles: english.join('|'),
|
|
286
|
+
prop: 'pageimages',
|
|
287
|
+
piprop: 'thumbnail',
|
|
288
|
+
pithumbsize: '400',
|
|
289
|
+
pilicense: 'any',
|
|
290
|
+
}
|
|
291
|
+
for (const page of await wiki('en', params))
|
|
292
|
+
if (page.thumbnail) covers.set(page.title, page.thumbnail.source)
|
|
293
|
+
}
|
|
294
|
+
return pages.map((p) => ({
|
|
295
|
+
title: p.title,
|
|
296
|
+
description: p.extract,
|
|
297
|
+
image: p.thumbnail?.source ?? covers.get(p.langlinks?.[0]?.title ?? ''),
|
|
298
|
+
url: p.fullurl,
|
|
299
|
+
}))
|
|
300
|
+
})
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
- On the page: `UInputMenu` with `v-model:search-term`, `ignore-filter`, items from the route
|
|
304
|
+
(debounced, `refDebounced`), each with `avatar: { src: image }` and the description as a second
|
|
305
|
+
line. Picking one fills the form; typing something Wikipedia doesn't know still works.
|
|
306
|
+
- Save `title`, `image` and `url` with the entry, so lists don't ask Wikipedia again. Show the
|
|
307
|
+
image straight from Wikimedia (`<img :src loading="lazy">`), with a colored placeholder when
|
|
308
|
+
there is none.
|
|
309
|
+
- Example content (seed) uses the same route's results: real things with their pictures.
|
|
310
|
+
- Pictures from Wikipedia aren't yours: name the source in a small "Bilder: Wikipedia" line on an
|
|
311
|
+
about or settings screen. Film posters there are non-free; fine for a prototype, not for a
|
|
312
|
+
product, which needs a licensed source (TMDB and the like).
|
|
313
|
+
|
|
171
314
|
## Tasks (cron)
|
|
172
315
|
|
|
173
316
|
Periodic work (cleanup, syncs, renewals) goes into tasks, not into requests:
|
|
@@ -311,11 +454,34 @@ Queries are LogsQL. Logs may contain user data: quote only what's needed.
|
|
|
311
454
|
|
|
312
455
|
## Commands
|
|
313
456
|
|
|
314
|
-
- `pnpm dev`: dev server. Pages and API routes work on their own; the database
|
|
315
|
-
|
|
316
|
-
Without it, check database work on the deployed app.
|
|
457
|
+
- `pnpm dev`: dev server. Pages and API routes work on their own; the database and live data need
|
|
458
|
+
the local wervt stack (`docker compose up -d postgres electric` in the wervt repo, plus `garage`
|
|
459
|
+
for files), which is optional. Without it, check database work on the deployed app. If a new
|
|
460
|
+
composable or util is "not defined" in the running dev server, restart it: Nuxt 5's nightly
|
|
461
|
+
sometimes misses files added while it runs.
|
|
317
462
|
- `pnpm db:generate`: generate a migration from the schema.
|
|
318
|
-
- `pnpm exec vp check --fix`: format, lint and type check.
|
|
463
|
+
- `pnpm exec vp check --fix`: format, lint and type check the TypeScript. It reformats files, so
|
|
464
|
+
read a file again before editing it afterwards.
|
|
465
|
+
- `pnpm typecheck`: type check everything, `.vue` files included (Golar). Run it and
|
|
466
|
+
`vp check --fix` before finishing.
|
|
319
467
|
- Deploys: pushing to `main` deploys through `.github/workflows/deploy.yml`.
|
|
320
468
|
`pnpm exec wervt releases <app>` lists releases with their commits. Don't deploy, roll back or
|
|
321
|
-
create tokens unless asked.
|
|
469
|
+
create deploy tokens unless asked.
|
|
470
|
+
|
|
471
|
+
## Checking the deployed app
|
|
472
|
+
|
|
473
|
+
A private app sends curl and headless browsers to the login. After a deploy, check protected
|
|
474
|
+
routes and pages yourself instead of asking a human to: `wervt token` mints a short-lived token
|
|
475
|
+
(15 minutes, `--ttl 1h` at most) for your CLI account on this app, and `useWervtUser(event)` sees
|
|
476
|
+
that account.
|
|
477
|
+
|
|
478
|
+
```bash
|
|
479
|
+
TOKEN=$(pnpm exec wervt token <app>)
|
|
480
|
+
curl -sH "Authorization: Bearer $TOKEN" https://<app>.wervt.app/api/…
|
|
481
|
+
pnpm exec wervt token <app> --cookie > /tmp/wervt-cookie.json # for a headless browser
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
In Playwright: `await context.addCookies([JSON.parse(cookieJson)])`, then open the app and check the
|
|
485
|
+
pages you changed (icons, uploads, forms). It needs a `wervt login` account that owns, is a member
|
|
486
|
+
of, or administers the app; deploy and read tokens can't mint one. Don't write the token to files
|
|
487
|
+
or commits. Requests made with it are tagged `agentToken` in the logs.
|
|
@@ -1,18 +1,43 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
2
|
+
"type": "base",
|
|
3
|
+
"version": "9",
|
|
3
4
|
"dialect": "postgres",
|
|
4
5
|
"id": "89541799-b7fd-4ea4-bc66-6c6a95f8abf6",
|
|
5
6
|
"prevIds": [
|
|
6
7
|
"00000000-0000-0000-0000-000000000000"
|
|
7
8
|
],
|
|
9
|
+
"footprints": [
|
|
10
|
+
{
|
|
11
|
+
"statementType": "create_table",
|
|
12
|
+
"statementTarget": [
|
|
13
|
+
"table",
|
|
14
|
+
"public",
|
|
15
|
+
"todos"
|
|
16
|
+
],
|
|
17
|
+
"writes": [
|
|
18
|
+
"s|tbl|public.todos",
|
|
19
|
+
"n|tbl|public.todos",
|
|
20
|
+
"e|tbl|public.todos",
|
|
21
|
+
"n|rel|public.todos",
|
|
22
|
+
"n|type|public.todos",
|
|
23
|
+
"n|rel|public.todos_pkey"
|
|
24
|
+
],
|
|
25
|
+
"reads": [
|
|
26
|
+
"n|sch|public"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
],
|
|
8
30
|
"ddl": [
|
|
9
31
|
{
|
|
10
|
-
"
|
|
32
|
+
"schema": "public",
|
|
11
33
|
"name": "todos",
|
|
12
|
-
"
|
|
13
|
-
"
|
|
34
|
+
"isRlsEnabled": false,
|
|
35
|
+
"entityType": "tables"
|
|
14
36
|
},
|
|
15
37
|
{
|
|
38
|
+
"schema": "public",
|
|
39
|
+
"table": "todos",
|
|
40
|
+
"name": "id",
|
|
16
41
|
"type": "serial",
|
|
17
42
|
"typeSchema": null,
|
|
18
43
|
"notNull": true,
|
|
@@ -20,12 +45,12 @@
|
|
|
20
45
|
"default": null,
|
|
21
46
|
"generated": null,
|
|
22
47
|
"identity": null,
|
|
23
|
-
"
|
|
24
|
-
"entityType": "columns",
|
|
25
|
-
"schema": "public",
|
|
26
|
-
"table": "todos"
|
|
48
|
+
"entityType": "columns"
|
|
27
49
|
},
|
|
28
50
|
{
|
|
51
|
+
"schema": "public",
|
|
52
|
+
"table": "todos",
|
|
53
|
+
"name": "title",
|
|
29
54
|
"type": "text",
|
|
30
55
|
"typeSchema": null,
|
|
31
56
|
"notNull": true,
|
|
@@ -33,12 +58,12 @@
|
|
|
33
58
|
"default": null,
|
|
34
59
|
"generated": null,
|
|
35
60
|
"identity": null,
|
|
36
|
-
"
|
|
37
|
-
"entityType": "columns",
|
|
38
|
-
"schema": "public",
|
|
39
|
-
"table": "todos"
|
|
61
|
+
"entityType": "columns"
|
|
40
62
|
},
|
|
41
63
|
{
|
|
64
|
+
"schema": "public",
|
|
65
|
+
"table": "todos",
|
|
66
|
+
"name": "done",
|
|
42
67
|
"type": "boolean",
|
|
43
68
|
"typeSchema": null,
|
|
44
69
|
"notNull": true,
|
|
@@ -46,12 +71,12 @@
|
|
|
46
71
|
"default": "false",
|
|
47
72
|
"generated": null,
|
|
48
73
|
"identity": null,
|
|
49
|
-
"
|
|
50
|
-
"entityType": "columns",
|
|
51
|
-
"schema": "public",
|
|
52
|
-
"table": "todos"
|
|
74
|
+
"entityType": "columns"
|
|
53
75
|
},
|
|
54
76
|
{
|
|
77
|
+
"schema": "public",
|
|
78
|
+
"table": "todos",
|
|
79
|
+
"name": "createdAt",
|
|
55
80
|
"type": "timestamp with time zone",
|
|
56
81
|
"typeSchema": null,
|
|
57
82
|
"notNull": true,
|
|
@@ -59,21 +84,17 @@
|
|
|
59
84
|
"default": "now()",
|
|
60
85
|
"generated": null,
|
|
61
86
|
"identity": null,
|
|
62
|
-
"
|
|
63
|
-
"entityType": "columns",
|
|
64
|
-
"schema": "public",
|
|
65
|
-
"table": "todos"
|
|
87
|
+
"entityType": "columns"
|
|
66
88
|
},
|
|
67
89
|
{
|
|
90
|
+
"schema": "public",
|
|
91
|
+
"table": "todos",
|
|
92
|
+
"name": "todos_pkey",
|
|
68
93
|
"columns": [
|
|
69
94
|
"id"
|
|
70
95
|
],
|
|
71
96
|
"nameExplicit": false,
|
|
72
|
-
"name": "todos_pkey",
|
|
73
|
-
"schema": "public",
|
|
74
|
-
"table": "todos",
|
|
75
97
|
"entityType": "pks"
|
|
76
98
|
}
|
|
77
|
-
]
|
|
78
|
-
"renames": []
|
|
99
|
+
]
|
|
79
100
|
}
|
package/template/nuxt.config.ts
CHANGED
|
@@ -3,5 +3,12 @@ export default defineNuxtConfig({
|
|
|
3
3
|
// The link preview anyone sees when a link to this (private) app is shared. Name and icon only
|
|
4
4
|
// until set; see AGENTS.md > Users and sessions.
|
|
5
5
|
// wervt: { preview: { title: '', description: '', image: '/og.png' } },
|
|
6
|
+
// Configuration and secrets, typed by these defaults. Values come from
|
|
7
|
+
// `wervt env <app> --set NUXT_EXAMPLE_SECRET=…` (`public` keys: `NUXT_PUBLIC_*`), locally from
|
|
8
|
+
// `.env`. Only `public` reaches the browser. See AGENTS.md > Configuration and secrets.
|
|
9
|
+
runtimeConfig: {
|
|
10
|
+
exampleSecret: '',
|
|
11
|
+
public: {},
|
|
12
|
+
},
|
|
6
13
|
compatibilityDate: '2026-10-01',
|
|
7
14
|
})
|
package/template/package.json
CHANGED
|
@@ -5,19 +5,22 @@
|
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "nuxt dev",
|
|
7
7
|
"build": "nuxt build",
|
|
8
|
+
"typecheck": "nuxt typecheck",
|
|
8
9
|
"db:generate": "drizzle-kit generate",
|
|
9
10
|
"postinstall": "nuxt prepare"
|
|
10
11
|
},
|
|
11
12
|
"dependencies": {
|
|
12
|
-
"@wervt/nuxt": "^0.3.
|
|
13
|
-
"drizzle-orm": "1.0.0-rc.
|
|
13
|
+
"@wervt/nuxt": "^0.3.4",
|
|
14
|
+
"drizzle-orm": "1.0.0-rc.5",
|
|
14
15
|
"nuxt": "npm:nuxt-nightly@5x",
|
|
15
16
|
"valibot": "^1.5.0",
|
|
16
|
-
"vue": "^3.5.
|
|
17
|
+
"vue": "^3.5.44"
|
|
17
18
|
},
|
|
18
19
|
"devDependencies": {
|
|
19
|
-
"@
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"@golar/vue": "^0.1.11",
|
|
21
|
+
"@wervt/cli": "^0.2.16",
|
|
22
|
+
"drizzle-kit": "1.0.0-rc.5",
|
|
23
|
+
"golar": "^0.1.11",
|
|
24
|
+
"vite-plus": "^1.3.0"
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# pnpm only runs install scripts it has been told about; esbuild is the one this app needs.
|
|
2
2
|
allowBuilds:
|
|
3
3
|
esbuild: true
|
|
4
|
+
# Nuxt UI pulls it in; its install script only matters for Vue 2.
|
|
5
|
+
vue-demi: false
|
|
4
6
|
minimumReleaseAgeExclude:
|
|
5
7
|
# wervt's own packages, so a new app gets the release that was just published.
|
|
6
8
|
- '@wervt/*'
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineEventHandler, useRuntimeConfig } from 'nuxt/server'
|
|
2
|
+
|
|
3
|
+
// How server code reads `runtimeConfig` (see nuxt.config.ts). Replace it with a route that needs
|
|
4
|
+
// a secret, e.g. an API key for `$fetch`. Never return the secret itself.
|
|
5
|
+
export default defineEventHandler(() => {
|
|
6
|
+
const { exampleSecret } = useRuntimeConfig()
|
|
7
|
+
return { configured: exampleSecret !== '' }
|
|
8
|
+
})
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
# Composables
|
|
2
|
-
|
|
3
|
-
## useToast
|
|
4
|
-
|
|
5
|
-
Show notifications. Requires `<UApp>` wrapper.
|
|
6
|
-
|
|
7
|
-
```ts
|
|
8
|
-
const toast = useToast()
|
|
9
|
-
|
|
10
|
-
toast.add({
|
|
11
|
-
title: 'Success',
|
|
12
|
-
description: 'Item saved',
|
|
13
|
-
color: 'success', // primary, success, error, warning, info
|
|
14
|
-
icon: 'i-lucide-check-circle',
|
|
15
|
-
duration: 5000, // 0 = never dismiss
|
|
16
|
-
actions: [{ label: 'Undo', onClick: () => {} }]
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
toast.remove('toast-id')
|
|
20
|
-
toast.clear()
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## useOverlay
|
|
24
|
-
|
|
25
|
-
Programmatically create modals, slideovers, drawers.
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
const overlay = useOverlay()
|
|
29
|
-
|
|
30
|
-
// create() returns a reusable instance with open(), close(), patch()
|
|
31
|
-
const modal = overlay.create(MyComponent)
|
|
32
|
-
|
|
33
|
-
// open() accepts props and returns an object with .result (a Promise)
|
|
34
|
-
const { result } = modal.open({ title: 'Confirm' })
|
|
35
|
-
|
|
36
|
-
if (await result) {
|
|
37
|
-
// User confirmed
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Inside the overlay component, emit close with a value:
|
|
41
|
-
// emit('close', true) or emit('close', false)
|
|
42
|
-
|
|
43
|
-
// You can also close from outside:
|
|
44
|
-
modal.close(false)
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## defineShortcuts
|
|
48
|
-
|
|
49
|
-
Define keyboard shortcuts.
|
|
50
|
-
|
|
51
|
-
```ts
|
|
52
|
-
defineShortcuts({
|
|
53
|
-
meta_k: () => openSearch(), // Cmd+K (Mac) / Ctrl+K (Win)
|
|
54
|
-
meta_shift_p: () => openPalette(), // Cmd+Shift+P
|
|
55
|
-
escape: () => close(),
|
|
56
|
-
ctrl_s: () => save(),
|
|
57
|
-
|
|
58
|
-
// With condition
|
|
59
|
-
meta_enter: {
|
|
60
|
-
handler: () => submit(),
|
|
61
|
-
whenever: [isFormValid]
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
| Key | Meaning |
|
|
67
|
-
|---|---|
|
|
68
|
-
| `meta` | Cmd (Mac) / Ctrl (Windows) |
|
|
69
|
-
| `ctrl` | Ctrl key |
|
|
70
|
-
| `alt` | Alt / Option key |
|
|
71
|
-
| `shift` | Shift key |
|
|
72
|
-
| `_` | Key separator |
|
|
73
|
-
|
|
74
|
-
## defineLocale / extendLocale
|
|
75
|
-
|
|
76
|
-
i18n locale definition.
|
|
77
|
-
|
|
78
|
-
```ts
|
|
79
|
-
import { fr } from '@nuxt/ui/locale'
|
|
80
|
-
|
|
81
|
-
// Use a built-in locale (50+ available)
|
|
82
|
-
// <UApp :locale="fr">
|
|
83
|
-
|
|
84
|
-
// Define custom locale
|
|
85
|
-
const locale = defineLocale({
|
|
86
|
-
name: 'Español',
|
|
87
|
-
code: 'es',
|
|
88
|
-
dir: 'ltr',
|
|
89
|
-
messages: {
|
|
90
|
-
select: { placeholder: 'Seleccionar...' }
|
|
91
|
-
}
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
// Extend existing locale
|
|
95
|
-
import { en } from '@nuxt/ui/locale'
|
|
96
|
-
|
|
97
|
-
const customEn = extendLocale(en, {
|
|
98
|
-
messages: { commandPalette: { placeholder: 'Search a component...' } }
|
|
99
|
-
})
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
```vue
|
|
103
|
-
<UApp :locale="fr"><NuxtPage /></UApp>
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## extractShortcuts
|
|
107
|
-
|
|
108
|
-
Extract shortcut keys from a list of items (e.g., dropdown menu items) into a shortcuts map for `defineShortcuts`.
|
|
109
|
-
|
|
110
|
-
```ts
|
|
111
|
-
const items = [
|
|
112
|
-
{ label: 'New file', kbds: ['meta', 'n'], onSelect: () => newFile() },
|
|
113
|
-
{ label: 'Save', kbds: ['meta', 's'], onSelect: () => save() }
|
|
114
|
-
]
|
|
115
|
-
|
|
116
|
-
defineShortcuts(extractShortcuts(items))
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
## Quick reference
|
|
120
|
-
|
|
121
|
-
| Composable | Purpose |
|
|
122
|
-
|---|---|
|
|
123
|
-
| `useToast` | Show notifications |
|
|
124
|
-
| `useOverlay` | Programmatic modals/slideovers |
|
|
125
|
-
| `defineShortcuts` | Keyboard shortcuts |
|
|
126
|
-
| `defineLocale` / `extendLocale` | i18n locale |
|
|
127
|
-
| `extractShortcuts` | Parse shortcut definitions |
|