templates2.Base.Nuxt/README.md
w4c-templates a7a56fd5e0
Some checks failed
CI / quality (push) Has been cancelled
chore(template): publish Base.Nuxt
2026-10-11 23:23:38 +03:00

66 lines
2.4 KiB
Markdown

# Base — Nuxt 3 (templates2)
A **ready-to-run** Nuxt application — the shared core every Nuxt v2 case forks: authentication,
roles, Prisma, mock payments and email, an admin shell, SEO, i18n, observability, CI and a Docker
image. Feature-parity with `templates2.Base.Next`.
> Not listed in the user catalog (`"catalog": false` in `.w4c/template.json`).
## Quickstart
```bash
npm ci
cp .env.example .env # SQLite + mock providers by default — no keys needed
npm run db:setup # prisma db push + seed
npm run dev # http://localhost:3000
```
Demo accounts (seeded): `admin@example.com` (admin) and `user@example.com` (user) — password
`password`.
## Scripts
| Script | What it does |
|---|---|
| `npm run dev` | Dev server with HMR |
| `npm run build` / `npm start` | Production build / serve `.output` |
| `npm run lint` / `npm run typecheck` | ESLint / `nuxt typecheck` |
| `npm test` | Unit tests (Vitest) |
| `npm run test:e2e` | HTTP end-to-end smoke (server must be running) |
| `npm run db:setup` | `prisma db push` + seed |
## What works out of the box
- **Auth & roles** — email + password, bcrypt, httpOnly cookie sessions (`Session` table), `user`
and `admin` roles. `server/middleware/guard.ts` gates protected pages before render; server
routes enforce authorization (`requireUser`, `requireAdmin`).
- **Payments** — provider interface: a **mock provider with no keys** (activates the subscription
directly) plus Stripe from env. Webhooks are signature-checked and idempotent.
- **Email** — log provider by default, Resend from env.
- **Admin** — role-gated shell, stats dashboard, users table (role change / delete with
confirmation) and an audit log.
- **SEO** — `useSeoMeta` per page, JSON-LD, `sitemap.xml` and `robots.txt` served from
`server/routes`.
- **i18n** — English dictionary in `shared/en.json`, `t()` in `app/utils/i18n.ts`.
- **Observability** — `/api/health`, empty/loading states, error handling.
- **Delivery** — multi-stage Dockerfile with a healthcheck; CI runs lint + typecheck + unit + build
+ e2e.
## Data model
`prisma/schema.prisma`: `User`, `Session`, `Subscription`, `AuditLog` — identical to the Next base.
## Deployment
```bash
docker compose -f docker/docker-compose.yml up --build
```
## Quality
```bash
node templates2/qa.mjs Base.Nuxt
```
See [`../CONTRACT.md`](../CONTRACT.md) for the Definition of Done.