templates2.Content.Nuxt/README.md
w4c-templates 940313f8c5
Some checks failed
CI / quality (push) Has been cancelled
chore(template): publish Content.Nuxt
2026-10-11 23:26:40 +03:00

3.2 KiB

Content / Blog & Docs — Nuxt 3 (templates2)

A ready-to-run content site: posts and docs authored in a role-gated admin, rendered with a table of contents and code highlighting, with tags, author pages, search, RSS and a sitemap. A fork of templates2.Base.Nuxt that keeps the whole core — auth, roles, Prisma, mock payments/email, the admin shell, SEO, i18n, observability, CI and the Docker image.

Quickstart

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):

Role Email Password
admin admin@example.com password
editor editor@example.com password
user user@example.com password

Authoring

Sign in as editor (or admin) and open /admin/posts to create draft posts and publish them, or /admin/docs for the docs pages. A draft is invisible on the blog, the feed, the sitemap and search until it is published. Authors pick a byline, tags and (for posts) a featured flag; the slug is suggested from the title. The admin also offers a live preview. Deletion is admin-only; the editor role can author and publish.

What works out of the box

  • Content — posts and docs stored in Prisma (SQLite dev / Postgres prod), authored in the admin, never hard-coded. Markdown-lite bodies (headings, lists, quotes, links, fenced code) are rendered in-repo with a table of contents and language-labelled, highlighted code — no markdown package.
  • Taxonomy — tags and author pages, plus related posts (shared tag or author).
  • Search — a server route over post and doc titles and bodies, with a results page and empty state.
  • Feeds/SEO — sitemap.xml (incl. docs), rss.xml, per-post metadata and JSON-LD Article.
  • Auth & roles — email + password, bcrypt, httpOnly cookie sessions. user, editor and admin roles; authoring routes are gated server-side (requireStaff / requireAuthor).
  • Payments / Email — mock providers with no keys; Stripe and Resend activate from env.
  • Admin — the base shell plus Posts and Docs managers; admin-only users and audit log.
  • Delivery — multi-stage Dockerfile with a healthcheck; CI runs lint + typecheck + unit + build + e2e.

Data model

prisma/schema.prisma: the base (User, Session, Subscription, AuditLog) plus Author, Tag, PostTag, Post (with status, publishedAt, readingMinutes, featured) and Doc.

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

Deployment

docker compose -f docker/docker-compose.yml up --build

Quality

node templates2/qa.mjs Content.Nuxt

See ../CONTRACT.md for the Definition of Done.