|
|
||
|---|---|---|
| .github/workflows | ||
| .w4c | ||
| app | ||
| components | ||
| docker | ||
| lib | ||
| messages | ||
| prisma | ||
| public | ||
| tests | ||
| .dockerignore | ||
| .env.example | ||
| .eslintrc.json | ||
| .gitignore | ||
| middleware.ts | ||
| next.config.ts | ||
| package-lock.json | ||
| package.json | ||
| postcss.config.mjs | ||
| README.md | ||
| tsconfig.json | ||
| vitest.config.ts | ||
Content / Blog & Docs — Next.js (templates2)
A ready-to-run content site: markdown-ish posts and docs with frontmatter-style fields (title, slug, date, tags, author, draft), a table of contents, code highlighting, taxonomy, server-side search, RSS/sitemap, JSON-LD and a role-gated authoring admin — all working on the first run.
Built by forking
Base.Next; it inherits auth, roles, Prisma, mock payments and email, the admin shell, SEO, i18n, CI and Docker.
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), password password:
| Role | Can do | |
|---|---|---|
| admin | admin@example.com |
everything, incl. users & audit |
| editor | editor@example.com |
author posts and docs |
| user | user@example.com |
read-only |
What works out of the box
- Content — posts and docs stored in Prisma (authored in the admin, not hard-coded), rendered by an in-repo markdown renderer with a table of contents, fenced-code highlighting + language labels, lists, quotes, links and inline formatting.
- Public site — paginated
/blog, post pages with byline + related posts,/docsgrouped by section with a sidebar and prev/next,/tags,/authors/[slug]and a server-side/search. - Authoring admin —
/admin/postsand/admin/docs: create/edit/preview/publish/draft, featured posts, tag multi-select, with live preview; server API under/api/admin/postsand/api/admin/docsenforces the role and writes an audit entry. - Feeds/SEO —
sitemap.xml(posts, docs, tags, authors),rss.xml, per-post metadata and JSON-LDArticle. - Core — auth + roles, mock payments/email, admin shell,
/api/health, both themes, responsive to 360 px, WCAG AA contrast.
Markdown support
Extending the base's minimal renderer (no mdx/remark/gray-matter dependency): #–###
headings, paragraphs, ordered/unordered lists, blockquotes, ---, **bold**, *italic*,
`inline code`, [links](/path), and fenced code blocks with a language label and lightweight
syntax highlighting.
Data model
prisma/schema.prisma: Author, Tag, PostTag, Post, Doc (plus the base User,
Session, Subscription, AuditLog). SQLite in development; point DATABASE_URL at Postgres
for production.
Scripts
| Script | What it does |
|---|---|
npm run dev |
Dev server with HMR |
npm run build / npm start |
Production build / serve |
npm run lint / npm run typecheck |
ESLint / tsc --noEmit |
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.Next # from the repo root: node templates2/qa.mjs Content.Next
The harness isolates a clean copy, then runs install → verify → test → build → boot → routes →
e2e → screenshot. See ../CONTRACT.md for the Definition of Done.